[parted-devel] [PATCH 3/3] tests: Fix the tests for the case where stdout/stderr is different.

Richard W.M. Jones rjones at redhat.com
Wed Oct 12 21:16:36 UTC 2011


From: "Richard W.M. Jones" <rjones at redhat.com>

tests/t0000-basic.sh:
 - More than one bogus ^M[[:space:]]*^M had to be removed, hence
   use s,,,g sed expression.

tests/t0203-gpt-tiny-device-abort.sh:
 - Test was not expecting any output to stderr.  No longer true.

tests/t1100-busy-label.sh:
 - Another case of s,,,g as above.

tests/t7000-scripting.sh:
 - Only testing output to stdout.  Fold stdout & stderr together
   and test both.
 - Another case of s,,,g as above.

Some root tests still fail even with these fixes.  The failures appear
to be unrelated to these changes.
---
 tests/t0000-basic.sh                 |    2 +-
 tests/t0203-gpt-tiny-device-abort.sh |    2 --
 tests/t1100-busy-label.sh            |    2 +-
 tests/t7000-scripting.sh             |    6 +++---
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tests/t0000-basic.sh b/tests/t0000-basic.sh
index 4d6deeb..d07177e 100755
--- a/tests/t0000-basic.sh
+++ b/tests/t0000-basic.sh
@@ -61,7 +61,7 @@ parted ---pretend-input-tty $dev mklabel msdos < in > out 2>&1 || fail=1
 # Transform the actual output, to avoid spurious differences when
 # $PWD contains a symlink-to-dir.  Also, remove the ^M      ...^M bogosity.
 # normalize the actual output
-mv out o2 && sed -e "s,on /.*/$dev,on DEVICE,;s,
   *
,,;s, $,," \
+mv out o2 && sed -e "s,on /.*/$dev,on DEVICE,;s,
   *
,,g;s, $,," \
                       -e "s,^.*/lt-parted: ,parted: ," o2 > out
 
 # Create expected output file.
diff --git a/tests/t0203-gpt-tiny-device-abort.sh b/tests/t0203-gpt-tiny-device-abort.sh
index 22c8b21..690f286 100644
--- a/tests/t0203-gpt-tiny-device-abort.sh
+++ b/tests/t0203-gpt-tiny-device-abort.sh
@@ -37,8 +37,6 @@ for i in 33 34 35 67 68 69 101 102 103; do
   printf 'i\no\n' > in
   parted ---pretend-input-tty bad u s p < in > out 2> err || fail=1
   # don't bother comparing stdout
-  # expect no stderr
-  compare err /dev/null || fail=1
 done
 
 Exit $fail
diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh
index f388308..b88adaa 100755
--- a/tests/t1100-busy-label.sh
+++ b/tests/t1100-busy-label.sh
@@ -74,7 +74,7 @@ EOF
 
 # Transform the actual output, removing ^M   ...^M.
 # normalize the actual output
-mv out o2 && sed -e 's,
   *
,,;s, $,,;s/^.*Warning/Warning/' \
+mv out o2 && sed -e 's,
   *
,,g;s, $,,;s/^.*Warning/Warning/' \
                  -e 's,^.*/lt-parted: ,parted: ,' o2 > out
 
 # check for expected failure diagnostic
diff --git a/tests/t7000-scripting.sh b/tests/t7000-scripting.sh
index 4473cb6..1dc4c0c 100755
--- a/tests/t7000-scripting.sh
+++ b/tests/t7000-scripting.sh
@@ -47,7 +47,7 @@ for mkpart in mkpart; do
   dd if=/dev/zero of=testfile bs=${ss}c count=$N 2> /dev/null || fail=1
 
   # Test the scripting mode of $mkpart.
-  parted -s testfile -- mklabel gpt "$mkpart" primary ext3 1s -1s > out
+  parted -s testfile -- mklabel gpt "$mkpart" primary ext3 1s -1s > out 2>&1
   test $? = 1 || fail=1
 
   # Compare the real error and the expected one
@@ -61,12 +61,12 @@ for mkpart in mkpart; do
   # Test the interactive mode of $mkpart
   echo n | \
     parted ---pretend-input-tty testfile \
-      "mklabel gpt '$mkpart' primary ext3 1s -1s" > out && fail=1
+      "mklabel gpt '$mkpart' primary ext3 1s -1s" > out 2>&1 && fail=1
 
   # We have to format the output before comparing.
   # normalize the actual output
   printf x >> out || fail=1
-  sed "s,
   *
,,;s, x$,,;/ n$/ {N;s, n\nx,,}" out > o2 && mv -f o2 out \
+  sed "s,
   *
,,g;s, x$,,;/ n$/ {N;s, n\nx,,}" out > o2 && mv -f o2 out \
       || fail=1
   normalize_part_diag_ out || fail=1
 
-- 
1.7.6




More information about the parted-devel mailing list