From 69928350788dc1e89f53a8d1f4e9ab13f047eec8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 29 May 2015 11:02:10 -0400 Subject: Improve negtime test. --- test/ChangeLog | 6 ++++++ test/Makefile.am | 4 ++-- test/Makefile.in | 3 ++- test/checknegtime.awk | 22 ++++++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 test/checknegtime.awk (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index ca868bfc..d5387b36 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2015-05-29 Arnold D. Robbins + + * checknegtime.awk: New file. + * Makefile.am (negtime): Use checknegtime.awk to test results. + Should solve some problems with BSD and also MinGW. + 2015-05-21 Arnold D. Robbins * fts.awk: Really remove atime from the output. diff --git a/test/Makefile.am b/test/Makefile.am index 4a66a1fa..02c0aaa8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -137,6 +137,7 @@ EXTRA_DIST = \ charasbytes.awk \ charasbytes.in \ charasbytes.ok \ + checknegtime.awk \ childin.awk \ childin.in \ childin.ok \ @@ -2073,8 +2074,7 @@ paramasfunc2:: negtime:: @echo $@ @TZ=GMT AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - + @AWKPATH="$(srcdir)" $(AWK) -f checknegtime.awk $@.ok _$@ && rm -f _$@ # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index 98175bf7..9d51a3d8 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -394,6 +394,7 @@ EXTRA_DIST = \ charasbytes.awk \ charasbytes.in \ charasbytes.ok \ + checknegtime.awk \ childin.awk \ childin.in \ childin.ok \ @@ -2510,7 +2511,7 @@ paramasfunc2:: negtime:: @echo $@ @TZ=GMT AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + @AWKPATH="$(srcdir)" $(AWK) -f checknegtime.awk $@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: diff --git a/test/checknegtime.awk b/test/checknegtime.awk new file mode 100644 index 00000000..06dfcae9 --- /dev/null +++ b/test/checknegtime.awk @@ -0,0 +1,22 @@ +NR == 1 { + # Tue Dec 15 07:00:00 GMT 1959 + Weekday = $1 + Month = $2 + Day = $3 + Time = $4 + Timezone = $5 + Year = $6 +} + +NR == 2 { + if (NF == 0) # MinGW gives an empty line + exit 0 + + # Some BSDs give us UTC in the timezone + if ($1 == Weekday && $2 == Month && $3 == Day && + $4 == Time && $6 == Year) + exit 0 + + # Some other mismatch + exit 1 +} -- cgit v1.2.3