summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-12 12:26:33 +0200
committerGitHub <noreply@github.com>2018-10-12 12:26:33 +0200
commita55d8bedd28214c9948b5620cca9b05d4145b422 (patch)
tree988c9583beca66bb3ff4aa7c4af95be5b8b3797b /src/test
parentMerge pull request #10369 from yuwata/test-mempool (diff)
parentudev-builtin: move definitions related to builtin commands to udev-builtin.h (diff)
downloadsystemd-a55d8bedd28214c9948b5620cca9b05d4145b422.tar.xz
systemd-a55d8bedd28214c9948b5620cca9b05d4145b422.zip
Merge pull request #10176 from yuwata/udev-cleanup-7
udev: replace udev_device by sd_device
Diffstat (limited to 'src/test')
-rw-r--r--src/test/meson.build12
-rw-r--r--src/test/test-udev-build-argv.c78
2 files changed, 0 insertions, 90 deletions
diff --git a/src/test/meson.build b/src/test/meson.build
index 34dedb4f96..2e003f1fd2 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -640,18 +640,6 @@ tests += [
libacl],
'', 'manual', '-DLOG_REALM=LOG_REALM_UDEV'],
- [['src/test/test-udev-build-argv.c'],
- [libudev_core,
- libudev_static,
- libsystemd_network,
- libshared],
- [threads,
- librt,
- libblkid,
- libkmod,
- libacl],
- '', '', '-DLOG_REALM=LOG_REALM_UDEV'],
-
[['src/test/test-id128.c'],
[],
[]],
diff --git a/src/test/test-udev-build-argv.c b/src/test/test-udev-build-argv.c
deleted file mode 100644
index c71c706e2e..0000000000
--- a/src/test/test-udev-build-argv.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
-
-#include "alloc-util.h"
-#include "string-util.h"
-#include "strv.h"
-#include "tests.h"
-#include "udev.h"
-
-static void test_udev_build_argv_one(const char *c) {
- _cleanup_strv_free_ char **a = NULL;
- _cleanup_free_ char *arg = NULL;
- char *argv[128], **p;
- int argc;
- size_t i;
-
- assert_se(a = strv_split_full(c, NULL, SPLIT_QUOTES | SPLIT_RELAX));
-
- assert_se(arg = strdup(c));
- assert_se(udev_build_argv(arg, &argc, argv) >= 0);
-
- log_info("command: %s", c);
-
- i = 0;
- log_info("strv_split:");
- STRV_FOREACH(p, a)
- log_info("argv[%zu] = '%s'", i++, *p);
-
- i = 0;
- log_info("udev_build_argv:");
- STRV_FOREACH(p, argv)
- log_info("argv[%zu] = '%s'", i++, *p);
-
- assert_se(strv_equal(argv, a));
- assert_se(argc == (int) strv_length(a));
-
-}
-
-static void test_udev_build_argv(void) {
- test_udev_build_argv_one("one two three");
- test_udev_build_argv_one("one 'two three ' \" four five \" 'aaa bbb ");
- test_udev_build_argv_one("/bin/echo -e \\101");
- test_udev_build_argv_one("/bin/echo -n special-device");
- test_udev_build_argv_one("/bin/echo -n special-device");
- test_udev_build_argv_one("/bin/echo test");
- test_udev_build_argv_one("/bin/echo -n test-%b");
- test_udev_build_argv_one("/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9");
- test_udev_build_argv_one("/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'");
- test_udev_build_argv_one("/bin/echo -n 'foo3 foo4' 'foo5 foo6 foo7 foo8'");
- test_udev_build_argv_one("/bin/sh -c 'printf %%s \\\"foo1 foo2\\\" | grep \\\"foo1 foo2\\\"'");
- test_udev_build_argv_one("/bin/sh -c \\\"printf %%s 'foo1 foo2' | grep 'foo1 foo2'\\\"");
- test_udev_build_argv_one("/bin/sh -c 'printf \\\"%%s %%s\\\" \\\"foo1 foo2\\\" \\\"foo3\\\"| grep \\\"foo1 foo2\\\"'");
- test_udev_build_argv_one("/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9");
- test_udev_build_argv_one("/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9");
- test_udev_build_argv_one("/bin/echo -n foo");
- test_udev_build_argv_one("/bin/echo -n usb-%b");
- test_udev_build_argv_one("/bin/echo -n scsi-%b");
- test_udev_build_argv_one("/bin/echo -n foo-%b");
- test_udev_build_argv_one("/bin/echo test");
- test_udev_build_argv_one("/bin/echo symlink test this");
- test_udev_build_argv_one("/bin/echo symlink test this");
- test_udev_build_argv_one("/bin/echo link test this");
- test_udev_build_argv_one("/bin/echo -n node link1 link2");
- test_udev_build_argv_one("/bin/echo -n node link1 link2 link3 link4");
- test_udev_build_argv_one("/usr/bin/test -b %N");
- test_udev_build_argv_one("/bin/echo -e name; (/usr/bin/badprogram)");
- test_udev_build_argv_one("/bin/echo -e \\xc3\\xbcber");
- test_udev_build_argv_one("/bin/echo -e \\xef\\xe8garbage");
- test_udev_build_argv_one("/bin/echo 1 1 0400");
- test_udev_build_argv_one("/bin/echo 0 0 0400letsdoabuffferoverflow0123456789012345789012345678901234567890");
-}
-
-int main(int argc, char *argv[]) {
- test_setup_logging(LOG_DEBUG);
-
- test_udev_build_argv();
-
- return 0;
-}