Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Enable sub-second timeout in zsystem flock



On 11 Jan 2020, at 13:36, dana <dana@xxxxxxx> wrote:
> I should have time this week end actually, will get back to you

Here's a basic, almost-does-nothing test script for it. Obv need to change the
expected error messages in the second test to whatever you decide on. You can
run it with `make check TESTNUM=V13`

dana


diff --git a/Test/V13system.ztst b/Test/V13system.ztst
new file mode 100644
index 000000000..e3faca37d
--- /dev/null
+++ b/Test/V13system.ztst
@@ -0,0 +1,30 @@
+# Test zsh/system module
+
+%prep
+
+  if zmodload -s zsh/system; then
+    tst_dir=V13.tmp
+    mkdir -p -- $tst_dir
+  else
+    ZTST_unimplemented='the zsh/system module is not available'
+  fi
+
+%test
+
+  (
+    : > $tst_dir/file
+    zsystem flock -t 0.1 -i 0.1 $tst_dir/file
+  )
+0:zsystem flock valid time arguments
+
+  (
+    zsystem flock -t -1                  $tst_dir/file ||
+    zsystem flock -t 9999999999999999999 $tst_dir/file ||
+    zsystem flock -i -1                  $tst_dir/file ||
+    zsystem flock -i 9999999999999999999 $tst_dir/file
+  )
+1:zsystem flock invalid time arguments
+?(eval):zsystem:2: flock: invalid timeout
+?(eval):zsystem:3: flock: invalid timeout
+?(eval):zsystem:4: flock: invalid interval
+?(eval):zsystem:5: flock: invalid interval



Messages sorted by: Reverse Date, Date, Thread, Author