fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

NahorAdd tests to exercise all builtin error messages99d63c21f

master
1.6 KiB81 linesraw
1# RUN: %fish %s
2
3# Ensure that we can wait for stuff.
4status job-control full
5
6set pids
7
8for i in (seq 16)
9    command true &
10    set -a pids $last_pid
11    command false &
12    set -a pids $last_pid
13end
14
15# Note fish does not (yet) report the exit status of waited-on commands.
16for pid in $pids
17    wait $pid
18end
19
20for i in (seq 16)
21    command true &
22    command false &
23end
24wait true false
25jobs
26# CHECK: jobs: There are no jobs
27
28# Ensure on-process-exit works for exited jobs.
29command false &
30set pid $last_pid
31
32# Ensure it gets reaped
33sleep .1
34
35function waiter --on-process-exit $pid
36    echo exited $argv
37end
38# (Solaris' false exits with 255, not 1)
39# CHECK: exited PROCESS_EXIT {{\d+}} {{1|255}}
40
41# Regression test for #9002
42sleep 1 &
43set p1 $last_pid
44
45sleep 2 &
46set p2 $last_pid
47
48function p1_cb --on-process-exit $p1
49    echo "P1 over"
50end
51
52function p2_cb --on-process-exit $p2
53    echo "P2 over"
54end
55
56wait
57# CHECK: P1 over
58# CHECK: P2 over
59
60# Events for background jobs from event handlers (#9096)
61function __test_background_job_exit_event --on-variable trigger_var
62    sleep .1 &
63    function callback --on-process-exit (jobs --last --pid)
64        echo -n "Callback called"
65    end
66end
67set trigger_var 123
68sleep .5
69# CHECK: Callback called
70
71wait (math 2 ^ 32)
72# CHECKERR: wait: '4294967296' is not a valid process ID
73wait 0
74# CHECKERR: wait: '0' is not a valid process ID
75wait -- -1
76# CHECKERR: wait: Could not find child processes with the name '-1'
77wait -- -(math 2 ^ 31)
78# CHECKERR: wait: Could not find child processes with the name '-2147483648'
79
80wait 999999999
81# CHECKERR: wait: Could not find a job with process ID '999999999'