summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-03 12:57:19 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-03 12:57:19 -0500
commitc2258e1c964af4baf6398ecb2357fec015c61401 (patch)
tree2779ff1e8e2638da25920a6303a9702f1001a005 /tests
parentc6d91e17e585e79617a432724c9ddc9f44876bca (diff)
downloadbash-c2258e1c964af4baf6398ecb2357fec015c61401.tar.gz
commit bash-20040506 snapshot
Diffstat (limited to 'tests')
-rw-r--r--tests/jobs.right38
-rw-r--r--tests/jobs.tests4
-rw-r--r--tests/jobs4.sub22
3 files changed, 49 insertions, 15 deletions
diff --git a/tests/jobs.right b/tests/jobs.right
index ad2bc197..3ec1bbed 100644
--- a/tests/jobs.right
+++ b/tests/jobs.right
@@ -16,20 +16,28 @@ Waiting for job 6
job 6 returns 0
Waiting for job 7
job 7 returns 0
+[1] Running sleep 5 &
+[2] Running sleep 5 &
+[3] Running sleep 5 &
+[4]- Running sleep 5 &
+[5]+ Running ( sleep 5; exit 4 ) &
+4
0
-./jobs.tests: line 15: wait: %1: no such job
-./jobs.tests: line 20: fg: no job control
+i killed it
+0
+./jobs.tests: line 19: wait: %1: no such job
+./jobs.tests: line 24: fg: no job control
wait-for-pid
wait-errors
-./jobs.tests: line 33: wait: `1-1': not a pid or valid job spec
-./jobs.tests: line 34: wait: `-4': not a pid or valid job spec
+./jobs.tests: line 37: wait: `1-1': not a pid or valid job spec
+./jobs.tests: line 38: wait: `-4': not a pid or valid job spec
wait-for-background-pids
async list wait-for-background-pids
async list wait for child
forked
wait-when-no-children
wait-for-job
-./jobs.tests: line 56: wait: %2: no such job
+./jobs.tests: line 60: wait: %2: no such job
127
async list wait-for-job
forked
@@ -42,19 +50,19 @@ sleep 5
fg-bg 4
sleep 5
fg-bg 5
-./jobs.tests: line 83: fg: %2: no such job
-./jobs.tests: line 84: bg: job 1 already in background
+./jobs.tests: line 87: fg: %2: no such job
+./jobs.tests: line 88: bg: job 1 already in background
fg-bg 6
-./jobs.tests: line 91: fg: -s: invalid option
+./jobs.tests: line 95: fg: -s: invalid option
fg: usage: fg [job_spec]
-./jobs.tests: line 92: bg: -s: invalid option
+./jobs.tests: line 96: bg: -s: invalid option
bg: usage: bg [job_spec]
-./jobs.tests: line 97: disown: -s: invalid option
+./jobs.tests: line 101: disown: -s: invalid option
disown: usage: disown [-h] [-ar] [jobspec ...]
-./jobs.tests: line 101: disown: %1: no such job
-./jobs.tests: line 104: disown: %2: no such job
+./jobs.tests: line 105: disown: %1: no such job
+./jobs.tests: line 108: disown: %2: no such job
wait-for-non-child
-./jobs.tests: line 107: wait: pid 1 is not a child of this shell
+./jobs.tests: line 111: wait: pid 1 is not a child of this shell
127
3 -- 1 2 3 -- 1 - 2 - 3
[1] Running sleep 300 &
@@ -64,8 +72,8 @@ running jobs:
[1] Running sleep 300 &
[2]- Running sleep 350 &
[3]+ Running sleep 400 &
-./jobs.tests: line 123: kill: %4: no such job
-./jobs.tests: line 125: jobs: %4: no such job
+./jobs.tests: line 127: kill: %4: no such job
+./jobs.tests: line 129: jobs: %4: no such job
current job:
[3]+ Running sleep 400 &
previous job:
diff --git a/tests/jobs.tests b/tests/jobs.tests
index 904e1f0c..5866b0c3 100644
--- a/tests/jobs.tests
+++ b/tests/jobs.tests
@@ -8,6 +8,10 @@ ${THIS_SH} ./jobs2.sub
# before 2.03
${THIS_SH} ./jobs3.sub
+# test out behavior of using job control notation when job control is not
+# active
+${THIS_SH} ./jobs4.sub
+
jobs
echo $?
diff --git a/tests/jobs4.sub b/tests/jobs4.sub
new file mode 100644
index 00000000..51980d1a
--- /dev/null
+++ b/tests/jobs4.sub
@@ -0,0 +1,22 @@
+# test being able to use job control notation in jobs/kill/wait without
+# job control active, as the SUS requires
+
+sleep 5 &
+
+sleep 5 &
+sleep 5 &
+sleep 5 &
+(sleep 5 ; exit 4) &
+
+jobs
+
+wait %%
+echo $?
+
+wait %1
+echo $?
+
+wait
+
+cat &
+kill -1 %% && echo i killed it || echo could not kill it