diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 9 | ||||
-rwxr-xr-x | test/Gentests | 11 | ||||
-rw-r--r-- | test/Makefile.am | 8 | ||||
-rw-r--r-- | test/Makefile.in | 13 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/sandbox1.awk | 7 | ||||
-rw-r--r-- | test/sandbox1.ok | 2 |
7 files changed, 52 insertions, 3 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index e5b9dce2..c3d7475f 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,6 +1,13 @@ +2019-05-06 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): New test: sandbox1. + (NEED_SANDBOX): New list of tests. + * Gentests: Handle NEED_SANDBOX. + * sandbox1.awk, sandbox1.ok: New files. + 2019-02-22 Andrew J. Schorr <aschorr@telemetry-investments.com> - * Makefile.am (EXTRA_DIST): New test assignnumfield2. + * Makefile.am (EXTRA_DIST): New test: assignnumfield2. * assignnumfield2.awk, assignnumfield2.ok: New files. 2019-04-21 Arnold D. Robbins <arnold@skeeve.com> diff --git a/test/Gentests b/test/Gentests index cf4ba908..9f51b927 100755 --- a/test/Gentests +++ b/test/Gentests @@ -94,6 +94,13 @@ BEGIN { next } +/^NEED_SANDBOX *=/,/[^\\]$/ { + gsub(/(^NEED_SANDBOX *=|\\$)/,"") + for (i = 1; i <= NF; i++) + sandbox[$i] + next +} + /^GENTESTS_UNUSED *=/,/[^\\]$/ { gsub(/(^GENTESTS_UNUSED *=|\\$)/,"") for (i = 1; i <= NF; i++) @@ -204,6 +211,10 @@ function generate(x, s, i, locale_string) s = s " --traditional" delete traditional[x] } + if (x in sandbox) { + s = s " --sandbox" + delete sandbox[x] + } if (x in pretty) { s = s " --pretty-print=_$@" delete pretty[x] diff --git a/test/Makefile.am b/test/Makefile.am index 4a5ab2d2..3db7c04d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1067,6 +1067,8 @@ EXTRA_DIST = \ rwarray.awk \ rwarray.in \ rwarray.ok \ + sandbox1.awk \ + sandbox1.ok \ scalar.awk \ scalar.ok \ sclforin.awk \ @@ -1354,7 +1356,8 @@ GAWK_EXT_TESTS = \ profile7 profile8 profile9 profile10 profile11 profile12 pty1 pty2 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \ rsstart1 rsstart2 rsstart3 rstest6 \ - shadow shadowbuiltin sortfor sortfor2 sortu sourcesplit split_after_fpat \ + sandbox1 shadow shadowbuiltin sortfor sortfor2 sortu \ + sourcesplit split_after_fpat \ splitarg4 strftfld strftime strtonum strtonum1 switch2 symtab1 symtab2 \ symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \ timeout typedregex1 typedregex2 typedregex3 typedregex4 \ @@ -1414,6 +1417,9 @@ NEED_PRETTY = nsprof1 nsprof2 \ # List of tests that need --re-interval NEED_RE_INTERVAL = gsubtst3 reint reint2 +# List of tests that need --sandbox +NEED_SANDBOX = sandbox1 + # List of tests that need --traditional NEED_TRADITIONAL = litoct tradanch rscompat diff --git a/test/Makefile.in b/test/Makefile.in index bd261a5b..5496d3cf 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1326,6 +1326,8 @@ EXTRA_DIST = \ rwarray.awk \ rwarray.in \ rwarray.ok \ + sandbox1.awk \ + sandbox1.ok \ scalar.awk \ scalar.ok \ sclforin.awk \ @@ -1613,7 +1615,8 @@ GAWK_EXT_TESTS = \ profile7 profile8 profile9 profile10 profile11 profile12 pty1 pty2 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \ rsstart1 rsstart2 rsstart3 rstest6 \ - shadow shadowbuiltin sortfor sortfor2 sortu sourcesplit split_after_fpat \ + sandbox1 shadow shadowbuiltin sortfor sortfor2 sortu \ + sourcesplit split_after_fpat \ splitarg4 strftfld strftime strtonum strtonum1 switch2 symtab1 symtab2 \ symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \ timeout typedregex1 typedregex2 typedregex3 typedregex4 \ @@ -1673,6 +1676,9 @@ NEED_PRETTY = nsprof1 nsprof2 \ # List of tests that need --re-interval NEED_RE_INTERVAL = gsubtst3 reint reint2 +# List of tests that need --sandbox +NEED_SANDBOX = sandbox1 + # List of tests that need --traditional NEED_TRADITIONAL = litoct tradanch rscompat @@ -4591,6 +4597,11 @@ rstest6: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +sandbox1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --sandbox >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + shadow: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index ccce4f54..cf85ef8d 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1846,6 +1846,11 @@ rstest6: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +sandbox1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --sandbox >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + shadow: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/sandbox1.awk b/test/sandbox1.awk new file mode 100644 index 00000000..e84894d7 --- /dev/null +++ b/test/sandbox1.awk @@ -0,0 +1,7 @@ +BEGIN { + ARGV[ARGC++] = ARGV[1] # should be ok + ARGV[ARGC++] = "" # empty string, should be ok + ARGV[ARGC++] = "foo=bar" # assignment, should be ok + ARGV[ARGC++] = "junk::foo=bar" # assignment, should be ok + ARGV[ARGC++] = "/dev/null" # should fatal here +} diff --git a/test/sandbox1.ok b/test/sandbox1.ok new file mode 100644 index 00000000..210b7261 --- /dev/null +++ b/test/sandbox1.ok @@ -0,0 +1,2 @@ +gawk: sandbox1.awk:6: fatal: cannot add a new file (/dev/null) to ARGV in sandbox mode +EXIT CODE: 2 |