summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-12 13:12:09 +0900
committerGitHub <noreply@github.com>2018-11-12 13:12:09 +0900
commitfd5ef45eab250f89f80f6f6afafb85b8b98cdf10 (patch)
tree17a4b2d1c94b9c0a60b0e4e1a6cd943fa76dacb6 /test
parent5fb0720ebbf8813696b095806581a937a345cf2c (diff)
parent110a13202eab6d92678abcde08372d4afac1cc45 (diff)
downloadsystemd-fd5ef45eab250f89f80f6f6afafb85b8b98cdf10.tar.gz
Merge pull request #10694 from evverx/udev-test-in-container
udev-test: remove a check for whether the test is run in a container
Diffstat (limited to 'test')
-rwxr-xr-xtest/udev-test.pl25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 61bd3d703a..aa38bae0b1 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -1537,18 +1537,28 @@ sub udev_setup {
system("umount", $udev_tmpfs);
rmdir($udev_tmpfs);
mkdir($udev_tmpfs) || die "unable to create udev_tmpfs: $udev_tmpfs\n";
- system("mount", "-o", "rw,mode=755,nosuid,noexec", "-t", "tmpfs", "tmpfs", $udev_tmpfs) && die "unable to mount tmpfs";
+
+ if (system("mount", "-o", "rw,mode=755,nosuid,noexec", "-t", "tmpfs", "tmpfs", $udev_tmpfs)) {
+ warn "unable to mount tmpfs";
+ return 0;
+ }
mkdir($udev_dev) || die "unable to create udev_dev: $udev_dev\n";
# setting group and mode of udev_dev ensures the tests work
# even if the parent directory has setgid bit enabled.
chown (0, 0, $udev_dev) || die "unable to chown $udev_dev\n";
chmod (0755, $udev_dev) || die "unable to chmod $udev_dev\n";
- system("mknod", $udev_dev . "/null", "c", "1", "3") && die "unable to create $udev_dev/null";
+
+ if (system("mknod", $udev_dev . "/null", "c", "1", "3")) {
+ warn "unable to create $udev_dev/null";
+ return 0;
+ }
system("cp", "-r", "test/sys/", $udev_sys) && die "unable to copy test/sys";
system("rm", "-rf", "$udev_run");
+
+ return 1;
}
sub run_test {
@@ -1646,14 +1656,15 @@ if ($? >> 8 == 0) {
exit($EXIT_TEST_SKIP);
}
-# skip the test when running in a container
-system("systemd-detect-virt", "-c", "-q");
-if ($? >> 8 == 0) {
- print "Running in a container, skipping the test.\n";
+if (!udev_setup()) {
+ warn "Failed to set up the environment, skipping the test";
exit($EXIT_TEST_SKIP);
}
-udev_setup();
+if (!system($udev_bin, "check")) {
+ warn "$udev_bin failed to set up the environment, skipping the test";
+ exit($EXIT_TEST_SKIP);
+}
my $test_num = 1;
my @list;