From 44892d91d048309234aebd820d312d357eb4b2df Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 6 Dec 2011 22:48:34 +0200 Subject: Revise pc/Makefile.tst. --- pc/ChangeLog | 9 +++++++++ pc/Makefile.tst | 13 ++++++++++--- pc/testoutcmp.awk | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 pc/testoutcmp.awk diff --git a/pc/ChangeLog b/pc/ChangeLog index 3d8ef415..429a88ed 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,12 @@ +2011-12-06 Scott Deifik + + * Makefile.tst: Sync with mainline version. + Use testoutcmp.awk script. + +2011-12-06 Arnold D. Robbins + + * testoutcmp.awk: Script to replace cmd for DJGPP. + 2011-11-01 Scott Deifik * config.sed: Additional update. diff --git a/pc/Makefile.tst b/pc/Makefile.tst index e63b8eb5..db214348 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -90,6 +90,10 @@ CMP = diff #CMP = diff -c #CMP = gcmp +# cmp replacement program for PC where the error messages aren't +# exactly the same. Should run even on old awk. +TESTOUTCMP = $(AWK) -f ../testoutcmp.awk + # Set your "cp," "mv," and "mkdir" commands here. Note: DOS's copy must take # forward slashes. #CP = cp @@ -115,6 +119,7 @@ PATH_SEPARATOR = ; # ============================================================================ srcdir = . +abs_builddir = . # Get rid of core files when cleaning and generated .ok file CLEANFILES = core core.* fmtspcl.ok @@ -512,9 +517,9 @@ gsubtst3:: space:: @echo $@ - @echo Expect space to fail with DJGPP. @$(AWK) -f ' ' $(srcdir)/space.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +# @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + @-$(TESTOUTCMP) $(srcdir)/$@.ok _$@ && rm -f _$@ printf0:: @echo $@ @@ -741,7 +746,8 @@ beginfile1:: beginfile2: @echo $@ @-( cd $(srcdir) && AWK="$(abs_builddir)/$(AWKPROG)" $(srcdir)/$@.sh $(srcdir)/$@.in ) > _$@ 2>&1 - @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +# @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + @-$(TESTOUTCMP) $(srcdir)/$@.ok _$@ && rm -f _$@ dumpvars:: @echo $@ @@ -1876,6 +1882,7 @@ procinfs: pty1: @echo pty1 + @echo Expect pty1 to fail with DJGPP. @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ diff --git a/pc/testoutcmp.awk b/pc/testoutcmp.awk new file mode 100644 index 00000000..ff190155 --- /dev/null +++ b/pc/testoutcmp.awk @@ -0,0 +1,38 @@ +# cmp replacement program for PC where the error messages aren't +# exactly the same. should run even on old awk + +{ + if (FNR == NR) + file = 0 + else + file = 1 + gsub(/\r/, "", $0) + lines[file, FNR] = $0 +} + +END { + if (NR/2 != FNR) { + printf("testoutcmp: warning: files are not of equal length!\n") > "/dev/stderr" + exit 1 + } + + for (i = 1; i <= FNR; i++) { + good = lines[0, i] + actual = lines[1, i] + if (good == actual) + continue + + l = length(good) + if (substr(good, l, 1) == ")") + l-- + if (substr(good, 1, l) == substr(actual, 1, l)) + continue + else { + printf("%s and %s are not equal\n", ARGV[1], + ARGV[2]) > "/dev/stderr" + exit 1 + } + } + + exit 0 +} -- cgit v1.2.3