aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-08-01 11:41:21 +0530
committersinanmohd <sinan@sinanmohd.com>2024-08-01 11:42:03 +0530
commitfb801a2b7d0ae0ed0fc6b3543974bb8e9fc64357 (patch)
tree574ea8bde2c7185af2b0b5cbd66fb6c8d704f670
parent1a20f73b9df803703a567626aa712fadb3ff8f79 (diff)
tests/dag: refactor, drop queue_thread_new()
-rw-r--r--tests/dag.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/tests/dag.c b/tests/dag.c
index 065536b..806aa75 100644
--- a/tests/dag.c
+++ b/tests/dag.c
@@ -29,49 +29,42 @@ struct evanix_opts_t evanix_opts = {
static void test_merge()
{
- FILE *stream;
struct job *job, *a, *b, *c;
- struct queue_thread *qt;
+ FILE *stream;
int ret;
+ struct job *htab = NULL;
stream = fopen("../tests/dag_merge.json", "r");
test_assert(stream != NULL);
- ret = queue_thread_new(&qt, stream);
- if (ret < 0)
- goto out_free_stram;
-
-
/* A */
- ret = job_read(qt->stream, &job);
+ ret = job_read(stream, &job);
test_assert(ret == JOB_READ_SUCCESS);
- ret = queue_htab_job_merge(&job, &qt->queue->htab);
+ ret = queue_htab_job_merge(&job, &htab);
test_assert(ret >= 0);
a = job;
/* B */
- ret = job_read(qt->stream, &job);
+ ret = job_read(stream, &job);
test_assert(ret == JOB_READ_SUCCESS);
- ret = queue_htab_job_merge(&job, &qt->queue->htab);
+ ret = queue_htab_job_merge(&job, &htab);
test_assert(ret >= 0);
b = job;
/* C */
- ret = job_read(qt->stream, &job);
+ ret = job_read(stream, &job);
test_assert(ret == JOB_READ_SUCCESS);
- ret = queue_htab_job_merge(&job, &qt->queue->htab);
+ ret = queue_htab_job_merge(&job, &htab);
test_assert(ret >= 0);
c = job;
- ret = job_read(qt->stream, &job);
+ ret = job_read(stream, &job);
test_assert(ret == JOB_READ_EOF);
test_assert(a->deps[0] == b);
test_assert(a->deps[0] == c->deps[0]);
-out_free_stram:
fclose(stream);
- queue_thread_free(qt);
}
int main(void)