summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-08-01 15:43:30 +0530
committersinanmohd <sinan@sinanmohd.com>2024-08-01 15:56:56 +0530
commit50a527f757f69befbe4081dd90467bdaef50a68f (patch)
tree85148a6d50126d7ffea9122c568bdd2bac02a5ba
parentfb801a2b7d0ae0ed0fc6b3543974bb8e9fc64357 (diff)
tests: clean up
-rw-r--r--.clang-format1
-rw-r--r--include/test.h26
-rw-r--r--src/solver_sjf.c2
-rw-r--r--tests/dag.c16
-rw-r--r--tests/meson.build5
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 = "<none>";
-#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 <queue.h>
#include <errno.h>
+#include <queue.h>
#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 <stdio.h>
#include <errno.h>
+#include <stdio.h>
#include <string.h>
-#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,