From 50a527f757f69befbe4081dd90467bdaef50a68f Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 1 Aug 2024 15:43:30 +0530 Subject: tests: clean up --- .clang-format | 1 + include/test.h | 26 +++++++++++++------------- src/solver_sjf.c | 2 +- tests/dag.c | 16 ++++++++++------ tests/meson.build | 5 ----- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.clang-format b/.clang-format index 8424e95..acc151f 100644 --- a/.clang-format +++ b/.clang-format @@ -15,3 +15,4 @@ ForEachMacros: - 'LIST_FOREACH' - 'CIRCLEQ_FOREACH' - 'cJSON_ArrayForEach' + - 'HASH_ITER' diff --git a/include/test.h b/include/test.h index 64716cc..45b786c 100644 --- a/include/test.h +++ b/include/test.h @@ -3,21 +3,21 @@ char *__curtestname = ""; -#define test_run(func) \ - do { \ - char *orig = __curtestname; \ - __curtestname = #func; \ - func(); \ - __curtestname = orig; \ +#define test_run(func) \ + do { \ + char *orig = __curtestname; \ + __curtestname = #func; \ + func(); \ + __curtestname = orig; \ } while (0) -#define test_assert(cond) \ - do { \ - if (!(cond)) { \ - fprintf(stderr, "%s:%d: %s: test_assert failed: %s\n", __FILE__, __LINE__, \ - __curtestname, #cond); \ - abort(); \ - } \ +#define test_assert(cond) \ + do { \ + if (!(cond)) { \ + fprintf(stderr, "%s:%d: %s: test_assert failed: %s\n", \ + __FILE__, __LINE__, __curtestname, #cond); \ + abort(); \ + } \ } while (0) #endif diff --git a/src/solver_sjf.c b/src/solver_sjf.c index 34d85ec..c81f718 100644 --- a/src/solver_sjf.c +++ b/src/solver_sjf.c @@ -1,5 +1,5 @@ -#include #include +#include #include "evanix.h" #include "jobs.h" diff --git a/tests/dag.c b/tests/dag.c index 806aa75..c49bf34 100644 --- a/tests/dag.c +++ b/tests/dag.c @@ -1,12 +1,12 @@ -#include #include +#include #include -#include "util.h" -#include "queue.h" #include "evanix.h" -#include "solver_sjf.h" +#include "jobs.h" +#include "queue.h" #include "test.h" +#include "util.h" /* * A C A C @@ -23,13 +23,13 @@ struct evanix_opts_t evanix_opts = { .system = NULL, .solver_report = false, .check_cache_status = false, - .solver = solver_sjf, + .solver = NULL, .break_evanix = false, }; static void test_merge() { - struct job *job, *a, *b, *c; + struct job *job, *a, *b, *c, *tmp; FILE *stream; int ret; struct job *htab = NULL; @@ -65,6 +65,10 @@ static void test_merge() test_assert(a->deps[0] == c->deps[0]); fclose(stream); + HASH_ITER (hh, htab, job, tmp) + HASH_DEL(htab, job); + job_free(a); + job_free(c); } int main(void) diff --git a/tests/meson.build b/tests/meson.build index 22ce6b8..d8f1ef6 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -5,11 +5,6 @@ dag_test = executable( '../src/jobs.c', '../src/util.c', '../src/queue.c', - '../src/build.c', - '../src/jobid.c', - '../src/solver_conformity.c', - '../src/solver_highs.c', - '../src/solver_sjf.c', ], include_directories: evanix_inc, -- cgit v1.2.3