summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Crestez <cdleonard@gmail.com>2010-02-01 21:28:17 +0200
committerVille Skyttä <ville.skytta@iki.fi>2010-02-01 21:29:47 +0200
commit61f83856fb1365e8c9df525dbcc5b74708ddbfe4 (patch)
tree2eef4a71efd6f340546df9087bf29d9822fd252b
parentd358036572070487391fa267e8a055a6916e8f34 (diff)
downloadbash-completion-61f83856fb1365e8c9df525dbcc5b74708ddbfe4.tar.gz
(testsuite) Fix chown test "crash" if root user/group is N/A (Alioth: 312306).
-rw-r--r--test/lib/completions/chown.exp12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp
index cc56149b..480f6743 100644
--- a/test/lib/completions/chown.exp
+++ b/test/lib/completions/chown.exp
@@ -24,10 +24,14 @@ set partgroup "roo"
# Skip tests if root:root not available or if roo:roo matches multiple
# users/groups
-if {[exec bash -c "compgen -A user $partuser" | wc -l] > 1 ||
- [exec bash -c "compgen -A user $fulluser" | wc -l] != 1 ||
- [exec bash -c "compgen -A group $partgroup" | wc -l] > 1 ||
- [exec bash -c "compgen -A group $fullgroup" | wc -l] != 1} {
+#
+# compgen -A is used because it's a bash builtin and available everywhere.
+# The || true part prevents exec from throwing an exception if nothing is
+# 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."
} else {
assert_complete $fulluser "chown $partuser"