]> granicus.if.org Git - strace/commitdiff
tests: robustify options-syntax.test against ash
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 4 Apr 2018 21:36:07 +0000 (21:36 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 4 Apr 2018 21:36:07 +0000 (21:36 +0000)
* tests/options-syntax.test: Do not assume that shell provides $UID,
use "id -u" if it doesn't.

tests/options-syntax.test

index 7b4a620e646e5108f2c9a9f1bc75e0664943d892..af7002b2aae309dad4b37844e4f726ac63b07cb5 100755 (executable)
@@ -73,8 +73,9 @@ diff -u -- "$EXP" "$LOG" > /dev/null || {
                "zeroargc $STRACE $args output mismatch"
 }
 
-if [ -n "${UID-}" ]; then
-       if [ "${UID-}" = 0 ]; then
+uid="${UID:-`id -u`}"
+if [ "$uid" -ge 0 ]; then
+       if [ "$uid" -eq 0 ]; then
                umsg="Cannot find user ':nosuchuser:'"
        else
                umsg='You must be root to use the -u option'