summaryrefslogtreecommitdiff
path: root/tests/id
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2019-03-06 21:04:26 -0800
committerPádraig Brady <P@draigBrady.com>2019-03-06 22:00:53 -0800
commitdaa46dbe7d04f8f7f416d8703a5cc162a86d04ba (patch)
tree6ae8beb373c92512c70aaae80d5b459e1745e32b /tests/id
parentb918a20234db81055f1e804fcd77378a246ddd98 (diff)
downloadcoreutils-daa46dbe7d04f8f7f416d8703a5cc162a86d04ba.tar.gz
tests: id/zero: avoid false failure due to sed differences
* tests/id/zero.sh: sed on OSX will output a \n even if the input doesn't have a \n on the last "line". So ensure we always have a trailing '\n' to avoid the disparity.
Diffstat (limited to 'tests/id')
-rwxr-xr-xtests/id/zero.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/id/zero.sh b/tests/id/zero.sh
index 085ea7c46..c3ef335eb 100755
--- a/tests/id/zero.sh
+++ b/tests/id/zero.sh
@@ -89,13 +89,15 @@ for o in G Gr ; do
for n in '' n ; do
id -${o}${n} $users >> gtmp1 ||
{ test $? -ne 1 || test -z "$n" && fail=1; }
+ echo >> gtmp1 || framework_failure_
+
id -${o}${n}z $users > gtmp2 ||
{ test $? -ne 1 || test -z "$n" && fail=1; }
# we replace all NULs with spaces, the result we get is there are two
# consecutive spaces instead of two NUL's, we pass this to sed
# to replace more than 1 space with a newline. This is ideally where a new
# line should be. This should make the output similar to without -z.
- tr '\0' ' ' < gtmp2 | sed "s/ /\\$NL/g" >> gtmp3
+ { tr '\0' ' ' < gtmp2; echo; } | sed "s/ /\\$NL/g" >> gtmp3
done
done
compare gtmp1 gtmp3 || fail=1