[PATCH] tests: t0001-tiny.sh: avoid spurious failure when run as root.

Jim Meyering meyering at redhat.com
Tue Nov 17 14:39:00 UTC 2009


* tests/t0001-tiny.sh: Control characters were getting in the way.
Filter them out.
---
 tests/t0001-tiny.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tests/t0001-tiny.sh b/tests/t0001-tiny.sh
index 373a68d..c2ea128 100755
--- a/tests/t0001-tiny.sh
+++ b/tests/t0001-tiny.sh
@@ -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
--
1.6.6.rc0.236.ge0b94



More information about the parted-devel mailing list