summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-04-06 03:04:27 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2016-04-06 04:08:39 +0000
commit21d9e3f339659c82db950ff2b4c6b81956cfa917 (patch)
treea2b07788aa2baa5eec78962e21006f623ab1fc5e
parent0c0d058325d6548a8c5acd1fb9e5dbc229f93e00 (diff)
tests: don't rely on the underlying fs in test-udev (v2)
* This reverts commit 646048b40a7b62c4e9bc59024ef6133613cda01b. Let's test really big numbers again * Don't be so brutal: use rmdir instead of rm -rf As suggested https://github.com/systemd/systemd/pull/2966#issuecomment-205751680
-rw-r--r--src/test/test-udev.c2
-rw-r--r--test/sys.tar.xzbin261380 -> 165116 bytes
-rwxr-xr-xtest/udev-test.pl22
3 files changed, 12 insertions, 12 deletions
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index 64ef08652c..8522e9925c 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -41,7 +41,7 @@ static int fake_filesystems(void) {
const char *error;
} fakefss[] = {
{ "test/tmpfs/sys", "/sys", "failed to mount test /sys" },
- { "test/dev", "/dev", "failed to mount test /dev" },
+ { "test/tmpfs/dev", "/dev", "failed to mount test /dev" },
{ "test/run", "/run", "failed to mount test /run" },
{ "test/run", "/etc/udev/rules.d", "failed to mount empty /etc/udev/rules.d" },
{ "test/run", UDEVLIBEXECDIR "/rules.d","failed to mount empty " UDEVLIBEXECDIR "/rules.d" },
diff --git a/test/sys.tar.xz b/test/sys.tar.xz
index 052c77d182..49ee8027b2 100644
--- a/test/sys.tar.xz
+++ b/test/sys.tar.xz
Binary files differ
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 3c8a480d0f..87041b1c36 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -27,9 +27,10 @@ my $strace = 0;
my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --track-origins=yes --quiet $udev_bin";
my $udev_bin_gdb = "gdb --args $udev_bin";
my $udev_bin_strace = "strace -efile $udev_bin";
-my $udev_dev = "test/dev";
my $udev_run = "test/run";
my $udev_tmpfs = "test/tmpfs";
+my $udev_sys = "${udev_tmpfs}/sys";
+my $udev_dev = "${udev_tmpfs}/dev";
my $udev_rules_dir = "$udev_run/udev/rules.d";
my $udev_rules = "$udev_rules_dir/udev-test.rules";
my $EXIT_TEST_SKIP = 77;
@@ -703,7 +704,7 @@ EOF
desc => "big major number test",
devpath => "/devices/virtual/misc/misc-fake1",
exp_name => "node",
- exp_majorminor => "511:1",
+ exp_majorminor => "4095:1",
rules => <<EOF
KERNEL=="misc-fake1", SYMLINK+="node"
EOF
@@ -712,7 +713,7 @@ EOF
desc => "big major and big minor number test",
devpath => "/devices/virtual/misc/misc-fake89999",
exp_name => "node",
- exp_majorminor => "511:89999",
+ exp_majorminor => "4095:89999",
rules => <<EOF
KERNEL=="misc-fake89999", SYMLINK+="node"
EOF
@@ -1406,18 +1407,18 @@ sub major_minor_test {
}
sub udev_setup {
- system("rm", "-rf", "$udev_dev");
+ 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,nodev", "-t", "tmpfs", "tmpfs", $udev_tmpfs) && die "unable to mount tmpfs";
+
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("umount", "$udev_tmpfs");
- system("rm", "-rf", "$udev_tmpfs");
- mkdir($udev_tmpfs) || die "unable to create udev_tmpfs: $udev_tmpfs\n";
- system("mount", "-o", "rw,mode=755,nosuid,noexec,nodev", "-t", "tmpfs", "tmpfs", "$udev_tmpfs") && die "unable to mount tmpfs";
- system("cp", "-r", "test/sys/", "$udev_tmpfs") && die "unable to copy test/sys";
+ system("cp", "-r", "test/sys/", $udev_sys) && die "unable to copy test/sys";
system("rm", "-rf", "$udev_run");
}
@@ -1550,10 +1551,9 @@ if ($list[0]) {
print "$error errors occurred\n\n";
# cleanup
-system("rm", "-rf", "$udev_dev");
system("rm", "-rf", "$udev_run");
system("umount", "$udev_tmpfs");
-system("rm", "-rf", "$udev_tmpfs");
+rmdir($udev_tmpfs);
if ($error > 0) {
exit(1);