my $udev_run = "test/run";
my $udev_rules_dir = "$udev_run/udev/rules.d";
my $udev_rules = "$udev_rules_dir/udev-test.rules";
+my $EXIT_TEST_SKIP = 77;
my @tests = (
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
exp_name => "there",
rules => <<EOF
-TEST=="/etc/hosts", SYMLINK+="there"
-TEST!="/etc/hosts", SYMLINK+="notthere"
+TEST=="/etc/machine-id", SYMLINK+="there"
+TEST!="/etc/machine-id", SYMLINK+="notthere"
EOF
},
{
exit;
}
+# 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";
+ exit($EXIT_TEST_SKIP);
+}
+
udev_setup();
my $test_num = 1;