X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-init.sh;h=be447b33eb3730a01761db10ae8586d8dda43e8f;hb=cd56634a4a8179fd5a4419fbb3e27211b042ab1c;hp=32b523f7056505e85ab05ed635d818994577dc1b;hpb=3aa7f3195a4ebd4ef5ae3591e3b1ecce344b49aa;p=gnulib.git diff --git a/tests/test-init.sh b/tests/test-init.sh index 32b523f70..be447b33e 100755 --- a/tests/test-init.sh +++ b/tests/test-init.sh @@ -1,6 +1,6 @@ #!/bin/sh # Unit tests for init.sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# Copyright (C) 2011-2014 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # This program is free software: you can redistribute it and/or modify @@ -50,16 +50,21 @@ EOF case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac compare empty in >out 2>err && fail=1 - # Remove the TAB-date suffix on each --- and +++ line, - # for both the expected and the actual output files. - cat <<\EOF > exp + # Compare against expected output only if compare is using diff -u. + if grep @ out >/dev/null; then + # Remove the TAB-date suffix on each --- and +++ line, + # for both the expected and the actual output files. + # Also remove the @@ line, since Solaris 5.10 and GNU diff formats differ: + # -@@ -0,0 +1 @@ + # +@@ -1,0 +1,1 @@ + sed 's/ .*//;/^@@/d' out > k && mv k out + cat <<\EOF > exp --- empty +++ in -@@ -0,0 +1 @@ +xyz EOF - sed 's/ .*//' out > k && mv k out - compare exp out || fail=1 + compare exp out || fail=1 + fi case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac }