OSDN Git Service

tests: t0001-tiny.sh: avoid spurious failure when run as root.
authorJim Meyering <meyering@redhat.com>
Tue, 17 Nov 2009 14:39:00 +0000 (15:39 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 24 Nov 2009 21:09:46 +0000 (22:09 +0100)
* tests/t0001-tiny.sh: Control characters were getting in the way.
Filter them out.

tests/t0001-tiny.sh

index 373a68d..c2ea128 100755 (executable)
@@ -40,7 +40,11 @@ for opt in '' -s; do
   parted $opt $dev mklabel msdos ---pretend-input-tty </dev/null > out 2>&1 \
       || fail=1
   # expect no output
-  sed 's/.*WARNING: You are not superuser.*//;/^$/d' out > k && mv k out || fail=1
+  sed 's/.*WARNING: You are not superuser.*//;/^$/d' out > k && mv k out \
+      || fail=1
+  # When run as root, there are just curses-related control chars. Remove them.
+  sed 's/^.\{1,12\}$//;/^$/d' out > k && mv k out \
+      || fail=1
   compare out /dev/null || fail=1
 
   parted -s $dev p || fail=1