diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2013-01-15 09:55:30 -0500 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2013-01-15 09:55:30 -0500 |
commit | edce216d276505437c9cc156f0db4fa586639d76 (patch) | |
tree | 15bd7d95fbd258eb5d580d966c5270367c0dd12d | |
parent | 74f4ac827622e938bb43d079dcaa87f1db749c63 (diff) | |
download | egawk-edce216d276505437c9cc156f0db4fa586639d76.tar.gz egawk-edce216d276505437c9cc156f0db4fa586639d76.tar.bz2 egawk-edce216d276505437c9cc156f0db4fa586639d76.zip |
Patch readdir test to protect against failure on filesystems lacking type info.
-rw-r--r-- | test/ChangeLog | 9 | ||||
-rw-r--r-- | test/Makefile.am | 3 | ||||
-rw-r--r-- | test/Makefile.in | 3 | ||||
-rw-r--r-- | test/readdir0.awk | 15 |
4 files changed, 25 insertions, 5 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 822b1db6..15015553 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,12 @@ +2013-01-15 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (readdir): Try to protect against failure on filesystems + lacking type information by invoking readdir.awk before readdir0.awk + and passing the results of readdir to readdir0 for inspection. + * readdir0.awk: Analyze the results of the readdir extension. + If all file types are set to "u", we infer that this filesystem lacks + type information. + 2013-01-14 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (rand): Let Gentests create the test. diff --git a/test/Makefile.am b/test/Makefile.am index 593013bc..b82b6040 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1723,10 +1723,9 @@ testext:: @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk readdir: - @echo This test can fail on some filesystems. @echo $@ - @ls -fli $(top_srcdir) | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk > $@.ok @$(AWK) -f $(srcdir)/readdir.awk $(top_srcdir) > _$@ + @ls -fli $(top_srcdir) | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk -v extout=_$@ > $@.ok @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ fts: diff --git a/test/Makefile.in b/test/Makefile.in index d2052480..edc472c0 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -2104,10 +2104,9 @@ testext:: @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk readdir: - @echo This test can fail on some filesystems. @echo $@ - @ls -fli $(top_srcdir) | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk > $@.ok @$(AWK) -f $(srcdir)/readdir.awk $(top_srcdir) > _$@ + @ls -fli $(top_srcdir) | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk -v extout=_$@ > $@.ok @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ fts: diff --git a/test/readdir0.awk b/test/readdir0.awk index 54306f10..c98ac674 100644 --- a/test/readdir0.awk +++ b/test/readdir0.awk @@ -1,3 +1,16 @@ +BEGIN { + while ((getline x < extout) > 0) { + numrec++ + if ((split(x, f, "/") == 3) && (f[3] == "u")) + num_unknown++ + } + close(extout) + if ((numrec > 0) && (num_unknown == numrec)) { + print "Notice: this filesystem does not appear to support file type information" > "/dev/stderr" + ftype_unknown = 1 + } +} + { ino = $1 name = $NF @@ -5,5 +18,5 @@ if (type == "-") type = "f" - printf "%s/%s/%s\n", ino, name, type + printf "%s/%s/%s\n", ino, name, (ftype_unknown ? "u" : type) } |