summaryrefslogtreecommitdiff
path: root/test-engine.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-21 00:51:37 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-21 00:51:37 +0100
commit1ffba6fe82d65f2a87b53a21c7927bca8176038c (patch)
treea7e25b779085247caa54b1e9ee8424f98e4c44bb /test-engine.c
parent9ea024f6b5a9626ddabeb4c4d4385481b52d211e (diff)
fix job merging
Diffstat (limited to 'test-engine.c')
-rw-r--r--test-engine.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/test-engine.c b/test-engine.c
index 15ce70f1ac..f92b05a7dd 100644
--- a/test-engine.c
+++ b/test-engine.c
@@ -9,7 +9,7 @@
int main(int argc, char *argv[]) {
Manager *m = NULL;
- Name *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e;
+ Name *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e = NULL, *g = NULL;
Job *j;
assert_se(chdir("test2") == 0);
@@ -33,13 +33,28 @@ int main(int argc, char *argv[]) {
manager_dump_names(m, stdout, "\t");
printf("Test2: (Cyclic Order, Unfixable)\n");
- assert_se(manager_add_job(m, JOB_START, d, JOB_REPLACE, false, &j) == -ELOOP);
+ assert_se(manager_add_job(m, JOB_START, d, JOB_REPLACE, false, &j) == -ENOEXEC);
manager_dump_jobs(m, stdout, "\t");
- printf("Test3: (Cyclic Order, Fixable)\n");
+ printf("Test3: (Cyclic Order, Fixable, Garbage Collector)\n");
assert_se(manager_add_job(m, JOB_START, e, JOB_REPLACE, false, &j) == 0);
manager_dump_jobs(m, stdout, "\t");
+ printf("Test4: (Identical transaction)\n");
+ assert_se(manager_add_job(m, JOB_START, e, JOB_FAIL, false, &j) == 0);
+ manager_dump_jobs(m, stdout, "\t");
+
+ printf("Loaded3:\n");
+ assert_se(manager_load_name(m, "g.service", &g) == 0);
+ manager_dump_names(m, stdout, "\t");
+
+ printf("Test5: (Colliding transaction, fail)\n");
+ assert_se(manager_add_job(m, JOB_START, g, JOB_FAIL, false, &j) == -EEXIST);
+
+ printf("Test6: (Colliding transaction, replace)\n");
+ assert_se(manager_add_job(m, JOB_START, g, JOB_REPLACE, false, &j) == 0);
+ manager_dump_jobs(m, stdout, "\t");
+
manager_free(m);
return 0;