diff options
author | Martin Wilck <mwilck@suse.com> | 2018-04-24 20:55:01 +0200 |
---|---|---|
committer | Michal Sekletár <msekleta@redhat.com> | 2020-11-02 11:43:15 +0100 |
commit | b95c43982ab7d0253b552ad56cffb3d68fcbb4f6 (patch) | |
tree | dd3960245f09a0b99739170b9bb5a5903c6ac97b /test/udev-test.pl | |
parent | test/udev-test.pl: merge import parent tests into one (diff) | |
download | systemd-b95c43982ab7d0253b552ad56cffb3d68fcbb4f6.tar.xz systemd-b95c43982ab7d0253b552ad56cffb3d68fcbb4f6.zip |
test/udev-test.pl: count "good" results
This is helpful to catch possible regressions in the test.
Also, don't count wait() errors, they are likely not udev errors.
Diffstat (limited to 'test/udev-test.pl')
-rwxr-xr-x | test/udev-test.pl | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl index 3228614ebe..a084343f3d 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -2114,6 +2114,7 @@ sub udev { } my $error = 0; +my $good = 0; sub permissions_test { my($rules, $uid, $gid, $mode) = @_; @@ -2144,6 +2145,7 @@ sub permissions_test { } if ($wrong == 0) { print "permissions: ok\n"; + $good++; } else { printf " expected permissions are: %s:%s:%#o\n", $1, $2, oct($3); printf " created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; @@ -2169,6 +2171,7 @@ sub major_minor_test { } if ($wrong == 0) { print "major:minor: ok\n"; + $good++; } else { printf " expected major:minor is: %i:%i\n", $1, $2; printf " created major:minor is : %i:%i\n", $major, $minor; @@ -2254,6 +2257,7 @@ sub check_devnode { major_minor_test($device, $rdev); } print "add $devnode: ok\n"; + $good++; return $devnode; } @@ -2282,11 +2286,13 @@ sub check_link_add { system("tree", "$udev_dev"); } else { print "symlink $link: ok\n"; + $good++; } } else { print "symlink $link: error"; if ($err_expected) { print " as expected\n"; + $good++; } else { print "\n"; system("tree", "$udev_dev"); @@ -2305,10 +2311,12 @@ sub check_link_nonexistent { if ($tgt ne $devnode) { print "nonexistent: '$link' points to other device (ok)\n"; + $good++; } else { print "nonexistent: error \'$link\' should not be there"; if ($err_expected) { print " (as expected)\n"; + $good++; } else { print "\n"; system("tree", "$udev_dev"); @@ -2319,6 +2327,7 @@ sub check_link_nonexistent { } } else { print "nonexistent $link: ok\n"; + $good++; } } @@ -2353,6 +2362,7 @@ sub check_remove_devnode { sleep(1); } else { print "remove $devnode: ok\n"; + $good++; } } @@ -2364,6 +2374,7 @@ sub check_link_remove { print "remove $link: error"; if ($err_expected) { print " as expected\n"; + $good++; } else { print "\n"; system("tree", "$udev_dev"); @@ -2373,6 +2384,7 @@ sub check_link_remove { } } else { print "remove $link: ok\n"; + $good++; } } @@ -2432,7 +2444,6 @@ sub fork_and_run_udev { $pid = waitpid($dev->{pid}, 0); if ($pid == -1) { print "error waiting for pid dev->{pid}\n"; - $error += 1; } if (WIFEXITED($?)) { $rc = WEXITSTATUS($?); @@ -2440,6 +2451,8 @@ sub fork_and_run_udev { if ($rc) { print "$udev_bin $action for $dev->{devpath} failed with code $rc\n"; $error += 1; + } else { + $good++; } } } @@ -2549,7 +2562,7 @@ if ($list[0]) { } $sema->remove; -print "$error errors occurred\n\n"; +print "$error errors occurred. $good good results.\n\n"; cleanup(); |