3 .
"${TEST_SCRIPTS_DIR}/unit.sh"
7 Process exited with error $(errcode ENOENT)
9 unit_test run_proc_test
0 -1 /a
/b
/c
12 prog
=$
(TMPDIR
="$TEST_VAR_DIR" mktemp
)
18 Process exited with error $(errcode EACCES)
20 unit_test run_proc_test
0 -1 "$prog"
26 Process exited with error $(errcode ENOEXEC)
28 unit_test run_proc_test
0 -1 "$prog"
37 Process exited with status 0
41 unit_test run_proc_test
0 -1 "$prog"
45 Process exited with status 0
49 unit_test run_proc_test
5 -1 "$prog"
52 output
=$
(TMPDIR
="$TEST_VAR_DIR" mktemp
)
60 Process exited with status 0
62 unit_test run_proc_test
0 -1 "$prog"
67 unit_test
cat "$output"
76 Process exited with status 1
78 unit_test run_proc_test
0 -1 "$prog"
87 Process exited with signal 15
89 unit_test run_proc_test
0 -1 "$prog"
94 echo "Sleeping for 5 seconds"
101 sed -e "s|= ${_pid}|= PID|"
105 Process exited with error $(errcode ETIMEDOUT)
107 Output = (Sleeping for 5 seconds
110 unit_test run_proc_test
1 -1 "$prog"
112 # No zombie processes
113 pidfile
=$
(TMPDIR
="$TEST_VAR_DIR" mktemp
)
117 echo \$$ > "$pidfile"
122 Process exited with error $(errcode ETIMEDOUT)
125 unit_test run_proc_test
1 -1 "$prog"
129 _header
=" *PID *TTY *TIME *CMD"
130 _header2
=" *PID *TT *STAT *TIME *COMMAND"
131 sed -e "s|^${_header}|HEADER|" -e "s|^${_header2}|HEADER|"
134 pid
=$
(cat "$pidfile")
135 required_result
1 <<EOF
138 unit_test ps
-p "$pid"
146 cat > "$output" <<EOF
151 Process exited with status 0
152 Output = (this is sample input
155 (unit_test run_proc_test
0 4 "$prog") 4<"$output"