mirror of
https://github.com/systemd/systemd
synced 2024-10-07 08:40:44 +00:00
test/udev-test.pl: cleanup if skipping test
In Ubuntu CI, udev-test.pl is run from the debian/test/udev script, in a test dir created for it; but udev-test.pl setup mounts a dir, so if it doesn't cleanup/unmount before exiting, the test dir autopkgtest created for it can't be removed, and autopkgtest aborts the entire test suite, for example this output (from a test run inside an armhf container): autopkgtest [12:45:36]: test udev: [----------------------- umount: test/tmpfs: no mount point specified. mknod: test/tmpfs/dev/null: Operation not permitted unable to create test/tmpfs/dev/null at ./udev-test.pl line 1611. Failed to set up the environment, skipping the test at ./udev-test.pl line 1731. autopkgtest [12:45:41]: test udev: -----------------------] autopkgtest [12:45:44]: test udev: - - - - - - - - - - results - - - - - - - - - - udev FAIL non-zero exit status 77 rm: cannot remove '/tmp/autopkgtest.ocPFA6/autopkgtest_tmp/test/tmpfs': Device or resource busy autopkgtest [12:46:22]: ERROR: "rm -rf /tmp/autopkgtest.ocPFA6/udev-artifacts /tmp/autopkgtest.ocPFA6/autopkgtest_tmp" failed with stderr "rm:
This commit is contained in:
parent
869250e6b8
commit
abb9cc50af
|
@ -1713,6 +1713,12 @@ sub run_test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub cleanup {
|
||||||
|
system("rm", "-rf", "$udev_run");
|
||||||
|
system("umount", "$udev_tmpfs");
|
||||||
|
rmdir($udev_tmpfs);
|
||||||
|
}
|
||||||
|
|
||||||
# only run if we have root permissions
|
# only run if we have root permissions
|
||||||
# due to mknod restrictions
|
# due to mknod restrictions
|
||||||
if (!($<==0)) {
|
if (!($<==0)) {
|
||||||
|
@ -1729,11 +1735,13 @@ if ($? >> 8 == 0) {
|
||||||
|
|
||||||
if (!udev_setup()) {
|
if (!udev_setup()) {
|
||||||
warn "Failed to set up the environment, skipping the test";
|
warn "Failed to set up the environment, skipping the test";
|
||||||
|
cleanup();
|
||||||
exit($EXIT_TEST_SKIP);
|
exit($EXIT_TEST_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (system($udev_bin, "check")) {
|
if (system($udev_bin, "check")) {
|
||||||
warn "$udev_bin failed to set up the environment, skipping the test";
|
warn "$udev_bin failed to set up the environment, skipping the test";
|
||||||
|
cleanup();
|
||||||
exit($EXIT_TEST_SKIP);
|
exit($EXIT_TEST_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1776,10 +1784,7 @@ if ($list[0]) {
|
||||||
|
|
||||||
print "$error errors occurred\n\n";
|
print "$error errors occurred\n\n";
|
||||||
|
|
||||||
# cleanup
|
cleanup();
|
||||||
system("rm", "-rf", "$udev_run");
|
|
||||||
system("umount", "$udev_tmpfs");
|
|
||||||
rmdir($udev_tmpfs);
|
|
||||||
|
|
||||||
if ($error > 0) {
|
if ($error > 0) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in a new issue