diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-04-06 23:17:46 +0200 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-04-06 23:30:10 +0200 |
commit | efc9f7032532d8c1db5537742981c7245fbf24dc (patch) | |
tree | 90597fc28b1b1cc82ef8a5b72ad561bf0c9146b2 | |
parent | 64af424063c5277a97bdc9693a227019c7c2f16e (diff) |
test: udev: check exit code of test-udev
We expect test-udev to succeed. Verify that its exit code is zero, particularly
to spot crashes (e. g. a segfault would be error code 139).
-rwxr-xr-x | test/udev-test.pl | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl index 87041b1c36..60c10b3889 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1331,13 +1331,13 @@ sub udev { close CONF; if ($valgrind > 0) { - system("$udev_bin_valgrind $action $devpath"); + return system("$udev_bin_valgrind $action $devpath"); } elsif ($gdb > 0) { - system("$udev_bin_gdb $action $devpath"); + return system("$udev_bin_gdb $action $devpath"); } elsif ($strace > 0) { - system("$udev_bin_strace $action $devpath"); + return system("$udev_bin_strace $action $devpath"); } else { - system("$udev_bin", "$action", "$devpath"); + return system("$udev_bin", "$action", "$devpath"); } } @@ -1425,11 +1425,16 @@ sub udev_setup { sub run_test { my ($rules, $number) = @_; + my $rc; print "TEST $number: $rules->{desc}\n"; print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; - udev("add", $rules->{devpath}, \$rules->{rules}); + $rc = udev("add", $rules->{devpath}, \$rules->{rules}); + if ($rc != 0) { + print "$udev_bin add failed with code $rc\n"; + $error++; + } if (defined($rules->{not_exp_name})) { if ((-e "$udev_dev/$rules->{not_exp_name}") || (-l "$udev_dev/$rules->{not_exp_name}")) { @@ -1470,7 +1475,11 @@ sub run_test { return; } - udev("remove", $rules->{devpath}, \$rules->{rules}); + $rc = udev("remove", $rules->{devpath}, \$rules->{rules}); + if ($rc != 0) { + print "$udev_bin remove failed with code $rc\n"; + $error++; + } if ((-e "$udev_dev/$rules->{exp_name}") || (-l "$udev_dev/$rules->{exp_name}")) { print "remove: error"; |