about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests b/tests
index 61500fd..322f541 100755
--- a/tests
+++ b/tests
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 : ${NQ:=../nq}
+: ${FQ:=../fq}
 
 set -e
 
@@ -16,7 +17,7 @@ check() {
   true
 }
 
-printf '1..26\n'
+printf '1..36\n'
 
 rm -rf test.dir
 mkdir test.dir
@@ -76,3 +77,21 @@ check 'all jobs are done' $NQ -w
 )
 
 rm -rf test.dir
+mkdir test.dir
+(
+cd test.dir
+
+check 'spawning four jobs' 'f1=$($NQ sleep 100)'
+check 'spawning four jobs' 'f2=$($NQ echo two)'
+check 'spawning four jobs' 'f3=$($NQ sleep 300)'
+check 'spawning four jobs' 'f4=$($NQ sleep 400)'
+check 'fq tracks first job' '($FQ & p=$!; sleep 1; kill $p) | sed 3q | grep -q sleep.*100'
+check 'killing first job' kill ${f1##*.}
+check 'killing fourth job' kill ${f4##*.}
+sleep 1
+check 'fq tracks third job' '($FQ & p=$!; sleep 1; kill $p) | sed 3q | grep -q sleep.*300'
+check 'killing third job' kill ${f3##*.}
+check 'fq outputs last job when no job running' '$FQ | sed 3q | grep -q sleep.*400'
+)
+
+rm -rf test.dir