diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-11-17 17:13:31 +0100 |
---|---|---|
committer | The Plumber <50238977+systemd-rhel-bot@users.noreply.github.com> | 2021-01-25 15:05:18 +0100 |
commit | 2e50a00f6930f1c65ca804b78f4a853e2ae2d2c0 (patch) | |
tree | dbcdd441d6df901ea0df286fcb141acd9f8d1b35 | |
parent | e0cee95e0cc401ce120a1b56cdb7a8b9afbd6bcf (diff) | |
download | systemd-2e50a00f6930f1c65ca804b78f4a853e2ae2d2c0.tar.gz |
test/udev-test: gracefully exit when imports failv239-44
In Fedora rawhide various perl modules are now available as separate
packages that are not pulled in by dependencies. If we don't have some
package, skip the tests.
This ugly code is apparently the way to do conditional imports:
https://www.cs.ait.ac.th/~on/O/oreilly/perl/cookbook/ch12_03.htm.
(cherry picked from commit d40763838278246e2073d15ca927ee700e583afc)
Related: #1642728
-rwxr-xr-x | test/udev-test.pl | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl index cf6ca6b80c..5b1e33504e 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -18,11 +18,19 @@ use warnings; use strict; -use POSIX qw(WIFEXITED WEXITSTATUS); -use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR IPC_CREAT); -use IPC::Semaphore; -use Time::HiRes qw(usleep); -use Cwd qw(getcwd abs_path); + +BEGIN { + my $EXIT_TEST_SKIP = 77; + + unless (eval "use POSIX qw(WIFEXITED WEXITSTATUS); + use Cwd qw(getcwd abs_path); + use IPC::Semaphore; + use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR IPC_CREAT); + use Time::HiRes qw(usleep); 1") { + warn "Failed to import dependencies, skipping the test: $@"; + exit($EXIT_TEST_SKIP); + } +} my $udev_bin = "./test-udev"; my $valgrind = 0; |