diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-11-04 00:59:01 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-11-04 00:59:01 +0300 |
commit | 36c7526d60319289954bb0b49e9f4cb2c6dfe9da (patch) | |
tree | 229ee89709c7f274e633c70f56118eee94d910f5 /tests | |
parent | 4b05f261debf2320cd5b66df4a7becc36c4a8916 (diff) | |
download | sciteco-36c7526d60319289954bb0b49e9f4cb2c6dfe9da.tar.gz |
monkey-test.apl: avoid some bogus failures due to insufficient handling of the pclose() return value
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/monkey-parse.apl | 2 | ||||
-rwxr-xr-x | tests/monkey-test.apl | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/monkey-parse.apl b/tests/monkey-parse.apl index 9273962..3984d44 100755 --- a/tests/monkey-parse.apl +++ b/tests/monkey-parse.apl @@ -2,7 +2,7 @@ ⍝ Calculate frequency distribution of the characters/glyphs in a given number of input files. ⍝ This will be the input for monkey-test.apl. Files ← 4↓⎕ARG -Data ← 19 ⎕CR ∊⎕FIO['read_file']¨Files +Data ← 19 ⎕CR ∊⎕FIO.read_file¨Files ∇ Dist←GetDist Data; i; C ⍝Dist ← 38 ⌷CR ↑⍴Data ⍝ associative array diff --git a/tests/monkey-test.apl b/tests/monkey-test.apl index a8cac1c..36fb3a5 100755 --- a/tests/monkey-test.apl +++ b/tests/monkey-test.apl @@ -27,27 +27,27 @@ GenArg ← {(⍵ ? $3000)~0 27} Escape ← {"'",(∊{⍺,"'\\''",⍵}/(⍵≠"'") ⊂ ⍵),"'"} ⍝ File WriteFile Contents -WriteFile ← {⊣⍵ ⎕FIO['fwrite_UNI'] Hnd ← "w" ⎕FIO['fopen'] ⍺ ⋄ ⊣⎕FIO['fclose'] Hnd; Hnd} +WriteFile ← {⊣⍵ ⎕FIO.fwrite_UNI Hnd ← "w" ⎕FIO.fopen ⍺ ⋄ ⊣⎕FIO.fclose Hnd; Hnd} -∇ Sig←Arg Exec Macro; Hnd; Data; Stdout +∇ Sig←Arg Exec Macro; Hnd; Data; Stdout; WSTATUS ⍝ FIXME: We cannot currently mung files in --sandbox mode. ⍝ To support that, we would effectively have to add a test compilation unit, ⍝ in which case we could just generate the test macro in C code as well. Macro ← "EI",Arg,(⎕UCS 27),"J ",Macro ⍝ We can generate loops by accident, but they should all be interruptible with SIGINT. ⍝ If the process needs to be killed, this is also considered a fatal issue. - Hnd ← ⎕FIO['popen'] "timeout --signal SIGINT --kill-after 2 2 ",SciTECO," --sandbox --eval ",(Escape Macro)," 2>&1" + Hnd ← ⎕FIO.popen "timeout --signal SIGINT --kill-after 2 2 ",SciTECO," --sandbox --eval ",(Escape Macro)," 2>&1" Stdout ← "" ReadStdout: - Stdout ← Stdout,Data ← ⎕UCS (⎕FIO['fread'] Hnd) + Stdout ← Stdout,Data ← ⎕UCS (⎕FIO.fread Hnd) →(0≤↑Data)/ReadStdout Cleanup: ⍝⎕ ← Stdout ⍝ Extract WTERMSIG() ⍝ FIXME: This may work only on FreeBSD - Sig ← $7F ⊤∧ (⎕FIO['pclose'] Hnd) + Sig ← WSTATUS × $7F≠WSTATUS ← $7F ⊤∧ (⎕FIO.pclose Hnd) Sig≠0 →→ "monkey-bug.tec" WriteFile Macro ⋄ ⍞ ← Stdout ←← ∇ |