(testsuite) Fix chown test "crash" if root user/group is N/A (Alioth: 312306).

This commit is contained in:
Leonard Crestez 2010-02-01 21:28:17 +02:00 committed by Ville Skyttä
parent d358036572
commit 61f83856fb

View File

@ -24,10 +24,14 @@ set partgroup "roo"
# Skip tests if root:root not available or if roo:roo matches multiple # Skip tests if root:root not available or if roo:roo matches multiple
# users/groups # users/groups
if {[exec bash -c "compgen -A user $partuser" | wc -l] > 1 || #
[exec bash -c "compgen -A user $fulluser" | wc -l] != 1 || # compgen -A is used because it's a bash builtin and available everywhere.
[exec bash -c "compgen -A group $partgroup" | wc -l] > 1 || # The || true part prevents exec from throwing an exception if nothing is
[exec bash -c "compgen -A group $fullgroup" | wc -l] != 1} { # found.
if {[exec bash -c "compgen -A user $partuser || true" | wc -l] > 1 ||
[exec bash -c "compgen -A user $fulluser || true" | wc -l] != 1 ||
[exec bash -c "compgen -A group $partgroup || true" | wc -l] > 1 ||
[exec bash -c "compgen -A group $fullgroup || true" | wc -l] != 1} {
untested "Not running complex chown tests." untested "Not running complex chown tests."
} else { } else {
assert_complete $fulluser "chown $partuser" assert_complete $fulluser "chown $partuser"