aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-10-09 13:44:31 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit0bd10132c6707353dba80bd89cf0102ee7ca4e34 (patch)
tree6ddefca863cb7dc50f539899dde6def80043601d /test
parent66c589578eb9b9dc89da6a34d274627f7f2435d7 (diff)
downloadserd-0bd10132c6707353dba80bd89cf0102ee7ca4e34.tar.gz
serd-0bd10132c6707353dba80bd89cf0102ee7ca4e34.tar.bz2
serd-0bd10132c6707353dba80bd89cf0102ee7ca4e34.zip
Test handling of deferred write errors that happen when closing
Diffstat (limited to 'test')
-rw-r--r--test/meson.build8
-rwxr-xr-xtest/test_write_error.py15
2 files changed, 18 insertions, 5 deletions
diff --git a/test/meson.build b/test/meson.build
index 08fb3200..dde17566 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -214,6 +214,7 @@ if is_variable('serd_pipe')
pipe_script_args = common_script_args + ['--tool', serd_pipe]
serd_ttl = files('../serd.ttl')[0]
bad_input_file = files('extra/bad/bad-lang.ttl')
+ small_ttl = files('w3c/turtle/turtle-syntax-number-01.ttl')
test('serd_ttl', serd_pipe, args: [serd_ttl], env: test_env, suite: 'data')
@@ -353,6 +354,13 @@ if is_variable('serd_pipe')
suite: 'io',
)
test(
+ 'deferred_write_error',
+ files('test_write_error.py'),
+ args: pipe_script_args + [small_ttl, '--', '-b', '1024'],
+ env: test_env,
+ suite: 'io',
+ )
+ test(
'missing_output',
serd_pipe,
args: ['-o', '/does/not/exist.ttl', serd_ttl],
diff --git a/test/test_write_error.py b/test/test_write_error.py
index 7d165a6a..84d32b49 100755
--- a/test/test_write_error.py
+++ b/test/test_write_error.py
@@ -5,15 +5,20 @@
"""Test errors writing to a file."""
-import sys
+import argparse
+import os
import shlex
import subprocess
-import os
+import sys
-import serd_test_util as util
+parser = argparse.ArgumentParser(description=__doc__)
+parser.add_argument("--tool", default="tools/serd-pipe", help="executable")
+parser.add_argument("--wrapper", default="", help="executable wrapper")
+parser.add_argument("input", help="valid input file")
+parser.add_argument("arg", nargs=argparse.REMAINDER, help="tool argument")
+args = parser.parse_args(sys.argv[1:])
-args = util.wrapper_args(__doc__, True)
-command = shlex.split(args.wrapper) + [args.tool, args.input]
+command = shlex.split(args.wrapper) + [args.tool] + args.arg + [args.input]
if os.path.exists("/dev/full"):
with open("/dev/full", "w", encoding="utf-8") as out: