summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2012-11-15 10:33:16 -0500
committerAnthony G. Basile <blueness@gentoo.org>2012-11-15 10:33:16 -0500
commit7d4a62f8c1404ed426500b97af03d4ef8d034a71 (patch)
tree2436cd4f0460a3a3d589875d4ffba55556f3c582 /src/test
parent2944f347d087ff24ec808e4b70fe104a772a97a0 (diff)
Isolation of udev code from remaining systemd
This commit is a first attempt to isolate the udev code from the remaining code base. It intentionally does not modify any files but purely delete files which, on a first examination, appear to not be needed. This is a sweeping commit which may easily have missed needed code. Files can be retrieved by doing a checkout from the previous commit: git checkout 2944f347d0 -- <filename>
Diffstat (limited to 'src/test')
l---------src/test/Makefile1
-rw-r--r--src/test/test-cgroup.c105
-rw-r--r--src/test/test-daemon.c37
-rw-r--r--src/test/test-date.c69
-rw-r--r--src/test/test-engine.c99
-rw-r--r--src/test/test-env-replace.c143
-rw-r--r--src/test/test-hostname.c38
-rw-r--r--src/test/test-id128.c52
-rw-r--r--src/test/test-install.c265
-rw-r--r--src/test/test-job-type.c105
-rw-r--r--src/test/test-log.c53
-rw-r--r--src/test/test-loopback.c37
-rw-r--r--src/test/test-ns.c61
-rw-r--r--src/test/test-replace-var.c46
-rw-r--r--src/test/test-sleep.c39
-rw-r--r--src/test/test-strv.c66
-rw-r--r--src/test/test-unit-file.c52
-rw-r--r--src/test/test-unit-name.c177
-rw-r--r--src/test/test-watchdog.c51
19 files changed, 0 insertions, 1496 deletions
diff --git a/src/test/Makefile b/src/test/Makefile
deleted file mode 120000
index d0b0e8e008..0000000000
--- a/src/test/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-../Makefile \ No newline at end of file
diff --git a/src/test/test-cgroup.c b/src/test/test-cgroup.c
deleted file mode 100644
index 6d64a4e47f..0000000000
--- a/src/test/test-cgroup.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <unistd.h>
-#include <string.h>
-
-#include "cgroup-util.h"
-#include "path-util.h"
-#include "util.h"
-#include "log.h"
-
-int main(int argc, char*argv[]) {
- char *path;
- char *c, *p;
-
- assert_se(cg_create(SYSTEMD_CGROUP_CONTROLLER, "/test-a") == 0);
- assert_se(cg_create(SYSTEMD_CGROUP_CONTROLLER, "/test-a") == 0);
- assert_se(cg_create(SYSTEMD_CGROUP_CONTROLLER, "/test-b") == 0);
- assert_se(cg_create(SYSTEMD_CGROUP_CONTROLLER, "/test-b/test-c") == 0);
- assert_se(cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, "/test-b", 0) == 0);
-
- assert_se(cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0);
- assert_se(streq(path, "/test-b"));
- free(path);
-
- assert_se(cg_attach(SYSTEMD_CGROUP_CONTROLLER, "/test-a", 0) == 0);
-
- assert_se(cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0);
- assert_se(path_equal(path, "/test-a"));
- free(path);
-
- assert_se(cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, "/test-b/test-d", 0) == 0);
-
- assert_se(cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0);
- assert_se(path_equal(path, "/test-b/test-d"));
- free(path);
-
- assert_se(cg_get_path(SYSTEMD_CGROUP_CONTROLLER, "/test-b/test-d", NULL, &path) == 0);
- assert_se(path_equal(path, "/sys/fs/cgroup/systemd/test-b/test-d"));
- free(path);
-
- assert_se(cg_is_empty(SYSTEMD_CGROUP_CONTROLLER, "/test-a", false) > 0);
- assert_se(cg_is_empty(SYSTEMD_CGROUP_CONTROLLER, "/test-b", false) > 0);
- assert_se(cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-a", false) > 0);
- assert_se(cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", false) == 0);
-
- assert_se(cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-a", 0, false, false, false, NULL) == 0);
- assert_se(cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", 0, false, false, false, NULL) > 0);
-
- assert_se(cg_migrate_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", "/test-a", false, false) > 0);
-
- assert_se(cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-a", false) == 0);
- assert_se(cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", false) > 0);
-
- assert_se(cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-a", 0, false, false, false, NULL) > 0);
- assert_se(cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", 0, false, false, false, NULL) == 0);
-
- cg_trim(SYSTEMD_CGROUP_CONTROLLER, "/", false);
-
- assert_se(cg_delete(SYSTEMD_CGROUP_CONTROLLER, "/test-b") < 0);
- assert_se(cg_delete(SYSTEMD_CGROUP_CONTROLLER, "/test-a") >= 0);
-
- assert_se(cg_split_spec("foobar:/", &c, &p) == 0);
- assert(streq(c, "foobar"));
- assert(streq(p, "/"));
- free(c);
- free(p);
-
- assert_se(cg_split_spec("foobar:", &c, &p) < 0);
- assert_se(cg_split_spec("foobar:asdfd", &c, &p) < 0);
- assert_se(cg_split_spec(":///", &c, &p) < 0);
- assert_se(cg_split_spec(":", &c, &p) < 0);
- assert_se(cg_split_spec("", &c, &p) < 0);
- assert_se(cg_split_spec("fo/obar:/", &c, &p) < 0);
-
- assert_se(cg_split_spec("/", &c, &p) >= 0);
- assert(c == NULL);
- assert(streq(p, "/"));
- free(p);
-
- assert_se(cg_split_spec("foo", &c, &p) >= 0);
- assert(streq(c, "foo"));
- assert(p == NULL);
- free(c);
-
- return 0;
-}
diff --git a/src/test/test-daemon.c b/src/test/test-daemon.c
deleted file mode 100644
index 3215f0c560..0000000000
--- a/src/test/test-daemon.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <unistd.h>
-
-#include <systemd/sd-daemon.h>
-
-int main(int argc, char*argv[]) {
-
- sd_notify(0, "STATUS=Starting up");
- sleep(5);
- sd_notify(0,
- "STATUS=Running\n"
- "READY=1");
- sleep(10);
- sd_notify(0, "STATUS=Quitting");
-
- return 0;
-}
diff --git a/src/test/test-date.c b/src/test/test-date.c
deleted file mode 100644
index 57f8b371d3..0000000000
--- a/src/test/test-date.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include "util.h"
-
-int main(int argc, char *argv[]) {
-
- usec_t t;
- char buf[FORMAT_TIMESTAMP_MAX];
-
- assert_se(parse_timestamp("17:41", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("18:42:44", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("12-10-02 12:13:14", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("12-10-2 12:13:14", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("12-10-03 12:13", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("2012-12-30 18:42", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("2012-10-02", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("now", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("yesterday", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("today", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("tomorrow", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("+2d", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- assert_se(parse_timestamp("+2y 4d", &t) >= 0);
- log_info("%s", format_timestamp(buf, sizeof(buf), t));
-
- return 0;
-}
diff --git a/src/test/test-engine.c b/src/test/test-engine.c
deleted file mode 100644
index 0f3862226a..0000000000
--- a/src/test/test-engine.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "manager.h"
-
-int main(int argc, char *argv[]) {
- Manager *m = NULL;
- Unit *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e = NULL, *g = NULL, *h = NULL;
- Job *j;
-
- assert_se(set_unit_path("test") >= 0);
-
- assert_se(manager_new(SYSTEMD_SYSTEM, &m) >= 0);
-
- printf("Load1:\n");
- assert_se(manager_load_unit(m, "a.service", NULL, NULL, &a) >= 0);
- assert_se(manager_load_unit(m, "b.service", NULL, NULL, &b) >= 0);
- assert_se(manager_load_unit(m, "c.service", NULL, NULL, &c) >= 0);
- manager_dump_units(m, stdout, "\t");
-
- printf("Test1: (Trivial)\n");
- assert_se(manager_add_job(m, JOB_START, c, JOB_REPLACE, false, NULL, &j) == 0);
- manager_dump_jobs(m, stdout, "\t");
-
- printf("Load2:\n");
- manager_clear_jobs(m);
- assert_se(manager_load_unit(m, "d.service", NULL, NULL, &d) >= 0);
- assert_se(manager_load_unit(m, "e.service", NULL, NULL, &e) >= 0);
- manager_dump_units(m, stdout, "\t");
-
- printf("Test2: (Cyclic Order, Unfixable)\n");
- assert_se(manager_add_job(m, JOB_START, d, JOB_REPLACE, false, NULL, &j) == -ENOEXEC);
- manager_dump_jobs(m, stdout, "\t");
-
- printf("Test3: (Cyclic Order, Fixable, Garbage Collector)\n");
- assert_se(manager_add_job(m, JOB_START, e, JOB_REPLACE, false, NULL, &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, NULL, &j) == 0);
- manager_dump_jobs(m, stdout, "\t");
-
- printf("Load3:\n");
- assert_se(manager_load_unit(m, "g.service", NULL, NULL, &g) >= 0);
- manager_dump_units(m, stdout, "\t");
-
- printf("Test5: (Colliding transaction, fail)\n");
- assert_se(manager_add_job(m, JOB_START, g, JOB_FAIL, false, NULL, &j) == -EEXIST);
-
- printf("Test6: (Colliding transaction, replace)\n");
- assert_se(manager_add_job(m, JOB_START, g, JOB_REPLACE, false, NULL, &j) == 0);
- manager_dump_jobs(m, stdout, "\t");
-
- printf("Test7: (Unmergeable job type, fail)\n");
- assert_se(manager_add_job(m, JOB_STOP, g, JOB_FAIL, false, NULL, &j) == -EEXIST);
-
- printf("Test8: (Mergeable job type, fail)\n");
- assert_se(manager_add_job(m, JOB_RESTART, g, JOB_FAIL, false, NULL, &j) == 0);
- manager_dump_jobs(m, stdout, "\t");
-
- printf("Test9: (Unmergeable job type, replace)\n");
- assert_se(manager_add_job(m, JOB_STOP, g, JOB_REPLACE, false, NULL, &j) == 0);
- manager_dump_jobs(m, stdout, "\t");
-
- printf("Load4:\n");
- assert_se(manager_load_unit(m, "h.service", NULL, NULL, &h) >= 0);
- manager_dump_units(m, stdout, "\t");
-
- printf("Test10: (Unmergeable job type of auxiliary job, fail)\n");
- assert_se(manager_add_job(m, JOB_START, h, JOB_FAIL, false, NULL, &j) == 0);
- manager_dump_jobs(m, stdout, "\t");
-
- manager_free(m);
-
- return 0;
-}
diff --git a/src/test/test-env-replace.c b/src/test/test-env-replace.c
deleted file mode 100644
index cd596a6e16..0000000000
--- a/src/test/test-env-replace.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <unistd.h>
-#include <string.h>
-
-#include "util.h"
-#include "log.h"
-#include "strv.h"
-
-int main(int argc, char *argv[]) {
-
- const char *env[] = {
- "FOO=BAR BAR",
- "BAR=waldo",
- NULL
- };
-
- const char *line[] = {
- "FOO$FOO",
- "FOO$FOOFOO",
- "FOO${FOO}$FOO",
- "FOO${FOO}",
- "${FOO}",
- "$FOO",
- "$FOO$FOO",
- "${FOO}${BAR}",
- "${FOO",
- NULL
- };
-
- char **i, **r, *t, **a, **b;
- const char nulstr[] = "fuck\0fuck2\0fuck3\0\0fuck5\0\0xxx";
-
- a = strv_parse_nulstr(nulstr, sizeof(nulstr)-1);
-
- STRV_FOREACH(i, a)
- printf("nulstr--%s\n", *i);
-
- strv_free(a);
-
- r = replace_env_argv((char**) line, (char**) env);
-
- STRV_FOREACH(i, r)
- printf("%s\n", *i);
-
- strv_free(r);
-
- t = normalize_env_assignment("foo=bar");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("=bar");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("foo=");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("=");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("a=\"waldo\"");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("a=\"waldo");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("a=waldo\"");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("a=\'");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment("a=\'\'");
- printf("%s\n", t);
- free(t);
-
- t = normalize_env_assignment(" xyz ");
- printf("<%s>\n", t);
- free(t);
-
- t = normalize_env_assignment(" xyz = bar ");
- printf("<%s>\n", t);
- free(t);
-
- t = normalize_env_assignment(" xyz = 'bar ' ");
- printf("<%s>\n", t);
- free(t);
-
- t = normalize_env_assignment(" ' xyz' = 'bar ' ");
- printf("<%s>\n", t);
- free(t);
-
- a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF", NULL);
- b = strv_new("FOO=KKK", "FOO=", "PIEP=", "SCHLUMPF=SMURFF", "NANANANA=YES", NULL);
-
- r = strv_env_merge(2, a, b);
- strv_free(a);
- strv_free(b);
-
- STRV_FOREACH(i, r)
- printf("%s\n", *i);
-
- printf("CLEANED UP:\n");
-
- r = strv_env_clean(r);
-
- STRV_FOREACH(i, r)
- printf("%s\n", *i);
-
- strv_free(r);
-
- return 0;
-}
diff --git a/src/test/test-hostname.c b/src/test/test-hostname.c
deleted file mode 100644
index ad4f285619..0000000000
--- a/src/test/test-hostname.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "hostname-setup.h"
-#include "util.h"
-
-int main(int argc, char* argv[]) {
- int r;
-
- r = hostname_setup();
- if (r < 0)
- fprintf(stderr, "hostname: %s\n", strerror(-r));
-
- return 0;
-}
diff --git a/src/test/test-id128.c b/src/test/test-id128.c
deleted file mode 100644
index bfd743eca3..0000000000
--- a/src/test/test-id128.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2011 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <string.h>
-
-#include <systemd/sd-id128.h>
-
-#include "util.h"
-#include "macro.h"
-
-#define ID128_WALDI SD_ID128_MAKE(01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10)
-
-int main(int argc, char *argv[]) {
- sd_id128_t id, id2;
- char t[33];
-
- assert_se(sd_id128_randomize(&id) == 0);
- printf("random: %s\n", sd_id128_to_string(id, t));
-
- assert_se(sd_id128_from_string(t, &id2) == 0);
- assert_se(sd_id128_equal(id, id2));
-
- assert_se(sd_id128_get_machine(&id) == 0);
- printf("machine: %s\n", sd_id128_to_string(id, t));
-
- assert_se(sd_id128_get_boot(&id) == 0);
- printf("boot: %s\n", sd_id128_to_string(id, t));
-
- printf("waldi: %s\n", sd_id128_to_string(ID128_WALDI, t));
-
- printf("waldi2: " SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(ID128_WALDI));
-
- return 0;
-}
diff --git a/src/test/test-install.c b/src/test/test-install.c
deleted file mode 100644
index 2c1b9efcb8..0000000000
--- a/src/test/test-install.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2011 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "util.h"
-#include "path-util.h"
-#include "install.h"
-
-static void dump_changes(UnitFileChange *c, unsigned n) {
- unsigned i;
-
- assert(n == 0 || c);
-
- for (i = 0; i < n; i++) {
- if (c[i].type == UNIT_FILE_UNLINK)
- printf("rm '%s'\n", c[i].path);
- else if (c[i].type == UNIT_FILE_SYMLINK)
- printf("ln -s '%s' '%s'\n", c[i].source, c[i].path);
- }
-}
-
-int main(int argc, char* argv[]) {
- Hashmap *h;
- UnitFileList *p;
- Iterator i;
- int r;
- const char *const files[] = { "avahi-daemon.service", NULL };
- const char *const files2[] = { "/home/lennart/test.service", NULL };
- UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
-
- h = hashmap_new(string_hash_func, string_compare_func);
- r = unit_file_get_list(UNIT_FILE_SYSTEM, NULL, h);
- assert_se(r == 0);
-
- HASHMAP_FOREACH(p, h, i) {
- UnitFileState s;
-
- s = unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(p->path));
-
- assert_se(p->state == s);
-
- fprintf(stderr, "%s (%s)\n",
- p->path,
- unit_file_state_to_string(p->state));
- }
-
- unit_file_list_free(h);
-
- log_error("enable");
-
- r = unit_file_enable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- log_error("enable2");
-
- r = unit_file_enable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, files[0]) == UNIT_FILE_ENABLED);
-
- log_error("disable");
-
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, files[0]) == UNIT_FILE_DISABLED);
-
- log_error("mask");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_mask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
- assert_se(r >= 0);
- log_error("mask2");
- r = unit_file_mask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, files[0]) == UNIT_FILE_MASKED);
-
- log_error("unmask");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_unmask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
- assert_se(r >= 0);
- log_error("unmask2");
- r = unit_file_unmask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, files[0]) == UNIT_FILE_DISABLED);
-
- log_error("mask");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_mask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, files[0]) == UNIT_FILE_MASKED);
-
- log_error("disable");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
- assert_se(r >= 0);
- log_error("disable2");
- r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, files[0]) == UNIT_FILE_MASKED);
-
- log_error("umask");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_unmask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, files[0]) == UNIT_FILE_DISABLED);
-
- log_error("enable files2");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_enable(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == UNIT_FILE_ENABLED);
-
- log_error("disable files2");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == _UNIT_FILE_STATE_INVALID);
-
- log_error("link files2");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_link(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == UNIT_FILE_LINKED);
-
- log_error("disable files2");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == _UNIT_FILE_STATE_INVALID);
-
- log_error("link files2");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_link(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == UNIT_FILE_LINKED);
-
- log_error("reenable files2");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_reenable(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == UNIT_FILE_ENABLED);
-
- log_error("disable files2");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == _UNIT_FILE_STATE_INVALID);
- log_error("preset files");
- changes = NULL;
- n_changes = 0;
-
- r = unit_file_preset(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
- assert_se(r >= 0);
-
- dump_changes(changes, n_changes);
- unit_file_changes_free(changes, n_changes);
-
- assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files[0])) == UNIT_FILE_ENABLED);
-
- return 0;
-}
diff --git a/src/test/test-job-type.c b/src/test/test-job-type.c
deleted file mode 100644
index 1066374436..0000000000
--- a/src/test/test-job-type.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "job.h"
-#include "unit.h"
-#include "service.h"
-
-int main(int argc, char*argv[]) {
- JobType a, b, c, ab, bc, ab_c, bc_a, a_bc;
- const ServiceState test_states[] = { SERVICE_DEAD, SERVICE_RUNNING };
- unsigned i;
- bool merged_ab;
-
- /* fake a unit */
- static Service s = {
- .meta.load_state = UNIT_LOADED,
- .type = SERVICE_SIMPLE,
- };
- Unit *u = UNIT(&s);
-
- for (i = 0; i < ELEMENTSOF(test_states); i++) {
- s.state = test_states[i];
- printf("\nWith collapsing for service state %s\n"
- "=========================================\n", service_state_to_string(s.state));
- for (a = 0; a < _JOB_TYPE_MAX_MERGING; a++) {
- for (b = 0; b < _JOB_TYPE_MAX_MERGING; b++) {
-
- ab = a;
- merged_ab = (job_type_merge_and_collapse(&ab, b, u) >= 0);
-
- if (!job_type_is_mergeable(a, b)) {
- assert(!merged_ab);
- printf("Not mergeable: %s + %s\n", job_type_to_string(a), job_type_to_string(b));
- continue;
- }
-
- assert(merged_ab);
- printf("%s + %s = %s\n", job_type_to_string(a), job_type_to_string(b), job_type_to_string(ab));
-
- for (c = 0; c < _JOB_TYPE_MAX_MERGING; c++) {
-
- /* Verify transitivity of mergeability of job types */
- assert(!job_type_is_mergeable(a, b) ||
- !job_type_is_mergeable(b, c) ||
- job_type_is_mergeable(a, c));
-
- /* Verify that merged entries can be merged with the same entries
- * they can be merged with separately */
- assert(!job_type_is_mergeable(a, c) || job_type_is_mergeable(ab, c));
- assert(!job_type_is_mergeable(b, c) || job_type_is_mergeable(ab, c));
-
- /* Verify that if a merged with b is not mergeable with c, then
- * either a or b is not mergeable with c either. */
- assert(job_type_is_mergeable(ab, c) || !job_type_is_mergeable(a, c) || !job_type_is_mergeable(b, c));
-
- bc = b;
- if (job_type_merge_and_collapse(&bc, c, u) >= 0) {
-
- /* Verify associativity */
-
- ab_c = ab;
- assert(job_type_merge_and_collapse(&ab_c, c, u) == 0);
-
- bc_a = bc;
- assert(job_type_merge_and_collapse(&bc_a, a, u) == 0);
-
- a_bc = a;
- assert(job_type_merge_and_collapse(&a_bc, bc, u) == 0);
-
- assert(ab_c == bc_a);
- assert(ab_c == a_bc);
-
- printf("%s + %s + %s = %s\n", job_type_to_string(a), job_type_to_string(b), job_type_to_string(c), job_type_to_string(ab_c));
- }
- }
- }
- }
- }
-
-
- return 0;
-}
diff --git a/src/test/test-log.c b/src/test/test-log.c
deleted file mode 100644
index 8dc3d5383f..0000000000
--- a/src/test/test-log.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <stddef.h>
-#include <unistd.h>
-
-#include "log.h"
-
-int main(int argc, char* argv[]) {
-
- log_set_target(LOG_TARGET_CONSOLE);
- log_open();
-
- log_struct(LOG_INFO,
- "MESSAGE=Waldo PID=%lu", (unsigned long) getpid(),
- "SERVICE=piepapo",
- NULL);
-
- log_set_target(LOG_TARGET_JOURNAL);
- log_open();
-
- log_struct(LOG_INFO,
- "MESSAGE=Foobar PID=%lu", (unsigned long) getpid(),
- "SERVICE=foobar",
- NULL);
-
- log_struct(LOG_INFO,
- "MESSAGE=Foobar PID=%lu", (unsigned long) getpid(),
- "FORMAT_STR_TEST=1=%i A=%c 2=%hi 3=%li 4=%lli 1=%p foo=%s 2.5=%g 3.5=%g 4.5=%Lg",
- (int) 1, 'A', (short) 2, (long int) 3, (long long int) 4, (void*) 1, "foo", (float) 2.5f, (double) 3.5, (long double) 4.5,
- "SUFFIX=GOT IT",
- NULL);
-
- return 0;
-}
diff --git a/src/test/test-loopback.c b/src/test/test-loopback.c
deleted file mode 100644
index ab330ac840..0000000000
--- a/src/test/test-loopback.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "loopback-setup.h"
-#include "util.h"
-
-int main(int argc, char* argv[]) {
- int r;
-
- if ((r = loopback_setup()) < 0)
- fprintf(stderr, "loopback: %s\n", strerror(-r));
-
- return 0;
-}
diff --git a/src/test/test-ns.c b/src/test/test-ns.c
deleted file mode 100644
index b1c759fc20..0000000000
--- a/src/test/test-ns.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/mount.h>
-#include <linux/fs.h>
-
-#include "namespace.h"
-#include "log.h"
-
-int main(int argc, char *argv[]) {
- const char * const writable[] = {
- "/home",
- NULL
- };
-
- const char * const readonly[] = {
- "/",
- "/usr",
- "/boot",
- NULL
- };
-
- const char * const inaccessible[] = {
- "/home/lennart/projects",
- NULL
- };
-
- int r;
-
- r = setup_namespace((char**) writable, (char**) readonly, (char**) inaccessible, true, 0);
- if (r < 0) {
- log_error("Failed to setup namespace: %s", strerror(-r));
- return 1;
- }
-
- execl("/bin/sh", "/bin/sh", NULL);
- log_error("execl(): %m");
-
- return 1;
-}
diff --git a/src/test/test-replace-var.c b/src/test/test-replace-var.c
deleted file mode 100644
index b1d42d77fd..0000000000
--- a/src/test/test-replace-var.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <string.h>
-
-#include "util.h"
-#include "macro.h"
-#include "replace-var.h"
-
-static char *lookup(const char *variable, void *userdata) {
- return strjoin("<<<", variable, ">>>", NULL);
-}
-
-int main(int argc, char *argv[]) {
- char *r;
-
- assert_se(r = replace_var("@@@foobar@xyz@HALLO@foobar@test@@testtest@TEST@...@@@", lookup, NULL));
- puts(r);
- assert_se(streq(r, "@@@foobar@xyz<<<HALLO>>>foobar@test@@testtest<<<TEST>>>...@@@"));
- free(r);
-
- assert_se(r = strreplace("XYZFFFFXYZFFFFXYZ", "XYZ", "ABC"));
- puts(r);
- assert_se(streq(r, "ABCFFFFABCFFFFABC"));
- free(r);
-
- return 0;
-}
diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c
deleted file mode 100644
index 5a98ecda2f..0000000000
--- a/src/test/test-sleep.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "util.h"
-#include "log.h"
-
-int main(int argc, char* argv[]) {
- log_info("Can Suspend: %s", yes_no(can_sleep("mem") > 0));
- log_info("Can Hibernate: %s", yes_no(can_sleep("disk") > 0));
- log_info("Can Hibernate+Suspend (Hybrid-Sleep): %s", yes_no(can_sleep_disk("suspend") > 0));
- log_info("Can Hibernate+Reboot: %s", yes_no(can_sleep_disk("reboot") > 0));
- log_info("Can Hibernate+Platform: %s", yes_no(can_sleep_disk("platform") > 0));
- log_info("Can Hibernate+Shutdown: %s", yes_no(can_sleep_disk("shutdown") > 0));
-
- return 0;
-}
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
deleted file mode 100644
index 5ee4447669..0000000000
--- a/src/test/test-strv.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <string.h>
-
-#include "util.h"
-#include "specifier.h"
-
-int main(int argc, char *argv[]) {
- const Specifier table[] = {
- { 'a', specifier_string, (char*) "AAAA" },
- { 'b', specifier_string, (char*) "BBBB" },
- { 0, NULL, NULL }
- };
-
- char *w, *state;
- size_t l;
- const char test[] = "test a b c 'd' e '' '' hhh '' ''";
-
- printf("<%s>\n", test);
-
- FOREACH_WORD_QUOTED(w, l, test, state) {
- char *t;
-
- assert_se(t = strndup(w, l));
- printf("<%s>\n", t);
- free(t);
- }
-
- printf("%s\n", default_term_for_tty("/dev/tty23"));
- printf("%s\n", default_term_for_tty("/dev/ttyS23"));
- printf("%s\n", default_term_for_tty("/dev/tty0"));
- printf("%s\n", default_term_for_tty("/dev/pty0"));
- printf("%s\n", default_term_for_tty("/dev/pts/0"));
- printf("%s\n", default_term_for_tty("/dev/console"));
- printf("%s\n", default_term_for_tty("tty23"));
- printf("%s\n", default_term_for_tty("ttyS23"));
- printf("%s\n", default_term_for_tty("tty0"));
- printf("%s\n", default_term_for_tty("pty0"));
- printf("%s\n", default_term_for_tty("pts/0"));
- printf("%s\n", default_term_for_tty("console"));
-
- w = specifier_printf("xxx a=%a b=%b yyy", table, NULL);
- printf("<%s>\n", w);
- free(w);
-
- return 0;
-}
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
deleted file mode 100644
index 95e2b68015..0000000000
--- a/src/test/test-unit-file.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <assert.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <string.h>
-
-#include "install.h"
-#include "util.h"
-#include "macro.h"
-#include "hashmap.h"
-
-int main(int argc, char *argv[]) {
-
- int r;
- Hashmap *h;
- Iterator i;
- UnitFileList *p;
-
- h = hashmap_new(string_hash_func, string_compare_func);
- assert(h);
-
- r = unit_file_get_list(UNIT_FILE_SYSTEM, NULL, h);
- log_info("unit_file_get_list: %s", strerror(-r));
- assert(r >= 0);
-
- HASHMAP_FOREACH(p, h, i)
- printf("%s = %s\n", p->path, unit_file_state_to_string(p->state));
-
- unit_file_list_free(h);
-
- return 0;
-}
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
deleted file mode 100644
index 50187e1129..0000000000
--- a/src/test/test-unit-name.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "unit-name.h"
-#include "util.h"
-
-int main(int argc, char* argv[]) {
- char *t, *k;
-
- t = unit_name_replace_instance("foo@.service", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("foo@xyz.service", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("xyz", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("", "");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("foo.service", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance(".service", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("foo@bar", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("foo@", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("@", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_replace_instance("@bar", "waldo");
- puts(t);
- free(t);
-
- t = unit_name_from_path("/waldo", ".mount");
- puts(t);
- k = unit_name_to_path(t);
- puts(k);
- free(k);
- free(t);
-
- t = unit_name_from_path("/waldo/quuix", ".mount");
- puts(t);
- k = unit_name_to_path(t);
- puts(k);
- free(k);
- free(t);
-
- t = unit_name_from_path("/waldo/quuix/", ".mount");
- puts(t);
- k = unit_name_to_path(t);
- puts(k);
- free(k);
- free(t);
-
- t = unit_name_from_path("/", ".mount");
- puts(t);
- k = unit_name_to_path(t);
- puts(k);
- free(k);
- free(t);
-
- t = unit_name_from_path("///", ".mount");
- puts(t);
- k = unit_name_to_path(t);
- puts(k);
- free(k);
- free(t);
-
- t = unit_name_from_path_instance("waldo", "/waldo", ".mount");
- puts(t);
- free(t);
-
- t = unit_name_from_path_instance("waldo", "/waldo////quuix////", ".mount");
- puts(t);
- free(t);
-
- t = unit_name_from_path_instance("waldo", "/", ".mount");
- puts(t);
- free(t);
-
- t = unit_name_from_path_instance("wa--ldo", "/--", ".mount");
- puts(t);
- free(t);
-
- assert_se(t = unit_name_mangle("/home"));
- assert_se(k = unit_name_mangle(t));
- puts(t);
- assert_se(streq(t, k));
- free(t);
- free(k);
-
- assert_se(t = unit_name_mangle("/dev/sda"));
- assert_se(k = unit_name_mangle(t));
- puts(t);
- assert_se(streq(t, k));
- free(t);
- free(k);
-
- assert_se(t = unit_name_mangle("üxknürz.service"));
- assert_se(k = unit_name_mangle(t));
- puts(t);
- assert_se(streq(t, k));
- free(t);
- free(k);
-
- assert_se(t = unit_name_mangle("foobar-meh...waldi.service"));
- assert_se(k = unit_name_mangle(t));
- puts(t);
- assert_se(streq(t, k));
- free(t);
- free(k);
-
- assert_se(t = unit_name_mangle("_____####----.....service"));
- assert_se(k = unit_name_mangle(t));
- puts(t);
- assert_se(streq(t, k));
- free(t);
- free(k);
-
- assert_se(t = unit_name_mangle("_____##@;;;,,,##----.....service"));
- assert_se(k = unit_name_mangle(t));
- puts(t);
- assert_se(streq(t, k));
- free(t);
- free(k);
-
- assert_se(t = unit_name_mangle("xxx@@@@/////\\\\\\\\\\yyy.service"));
- assert_se(k = unit_name_mangle(t));
- puts(t);
- assert_se(streq(t, k));
- free(t);
- free(k);
-
- return 0;
-}
diff --git a/src/test/test-watchdog.c b/src/test/test-watchdog.c
deleted file mode 100644
index ccb1854708..0000000000
--- a/src/test/test-watchdog.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <unistd.h>
-#include <string.h>
-
-#include "watchdog.h"
-#include "log.h"
-
-int main(int argc, char *argv[]) {
- usec_t t = 10 * USEC_PER_SEC;
- unsigned i;
- int r;
-
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
-
- r = watchdog_set_timeout(&t);
- if (r < 0)
- log_warning("Failed to open watchdog: %s", strerror(-r));
-
- for (i = 0; i < 5; i++) {
- log_info("Pinging...");
- r = watchdog_ping();
- if (r < 0)
- log_warning("Failed to ping watchdog: %s", strerror(-r));
-
- usleep(t/2);
- }
-
- watchdog_close(true);
- return 0;
-}