summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-27 14:53:51 -0700
committerCarl Worth <cworth@cworth.org>2010-05-27 14:53:51 -0700
commitbaa17c87485b5e776ec142844f5df38a3df9dccc (patch)
tree9ed7d1a6d96c39e7cafc5e2cf2ef998c826d1dbf
parent050e3ded1ea05cfe336dd0cd20212d17d7960c9e (diff)
Remove blank lines from output files before comparing.
Recently I'm seeing cases where "gcc -E" mysteriously omits blank lines, (even though it prints the blank lines in other very similar cases). Rather than trying to decipher and imitate this, just get rid of the blank lines. This approach with sed to kill the lines before the diff is better than "diff -B" since when there is an actual difference, the presence of blank lines won't make the diff harder to read.
-rw-r--r--.gitignore1
-rwxr-xr-xtests/glcpp-test7
2 files changed, 5 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index d67bd38..b88f0cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@ glcpp-parse.h
*~
tests/*.expected
tests/*.gcc
+tests/*.glcpp
tests/*.out
diff --git a/tests/glcpp-test b/tests/glcpp-test
index bf88d44..92c9949 100755
--- a/tests/glcpp-test
+++ b/tests/glcpp-test
@@ -3,8 +3,9 @@ set -e
for test in *.c; do
echo "Testing $test"
- ../glcpp < $test > $test.out
+ ../glcpp < $test > $test.glcpp
+ grep -v '^$' < $test.glcpp > $test.out || true
gcc -E $test -o $test.gcc
- grep -v '^#' < $test.gcc > $test.expected
- diff -B -u $test.expected $test.out
+ grep -v '^#' < $test.gcc | grep -v '^$' > $test.expected || true
+ diff -u $test.expected $test.out
done