-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtshref.out
executable file
·239 lines (239 loc) · 6.67 KB
/
tshref.out
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
make[2]: Entering directory '/h/u1/zingard/209-24s/shlab/src'
./sdriver.pl -t trace01.txt -s ./tsh -a "-p"
#
# trace01.txt - Properly terminate on EOF.
#
./sdriver.pl -t trace02.txt -s ./tsh -a "-p"
#
# trace02.txt - Process builtin quit command.
#
./sdriver.pl -t trace03.txt -s ./tsh -a "-p"
#
# trace03.txt - Run a foreground job.
#
tsh> ./myspin 1
./sdriver.pl -t trace04.txt -s ./tsh -a "-p"
#
# trace04.txt - Run a background job.
#
tsh> ./myspin 1 &
[1] (20315) ./myspin 1 &
./sdriver.pl -t trace05.txt -s ./tsh -a "-p"
#
# trace05.txt - Process jobs builtin command.
#
tsh> ./myspin 2 &
[1] (20334) ./myspin 2 &
tsh> ./myspin 3 &
[2] (20336) ./myspin 3 &
tsh> jobs
[1] (20334) Running ./myspin 2 &
[2] (20336) Running ./myspin 3 &
./sdriver.pl -t trace06.txt -s ./tsh -a "-p"
#
# trace06.txt - Forward SIGINT to foreground job.
#
tsh> ./myspin 4
Job [1] (20370) terminated by signal 2
./sdriver.pl -t trace07.txt -s ./tsh -a "-p"
#
# trace07.txt - Forward SIGINT only to foreground job.
#
tsh> ./myspin 4 &
[1] (20395) ./myspin 4 &
tsh> ./myspin 5
Job [2] (20397) terminated by signal 2
tsh> jobs
[1] (20395) Running ./myspin 4 &
./sdriver.pl -t trace08.txt -s ./tsh -a "-p"
#
# trace08.txt - Forward SIGTSTP only to foreground job.
#
tsh> ./myspin 4 &
[1] (20446) ./myspin 4 &
tsh> ./myspin 5
Job [2] (20448) stopped by signal 20
tsh> jobs
[1] (20446) Running ./myspin 4 &
[2] (20448) Stopped ./myspin 5
./sdriver.pl -t trace09.txt -s ./tsh -a "-p"
#
# trace09.txt - Process bg builtin command
#
tsh> ./myspin 4 &
[1] (20493) ./myspin 4 &
tsh> ./myspin 5
Job [2] (20495) stopped by signal 20
tsh> jobs
[1] (20493) Running ./myspin 4 &
[2] (20495) Stopped ./myspin 5
tsh> bg %2
[2] (20495) ./myspin 5
tsh> jobs
[1] (20493) Running ./myspin 4 &
[2] (20495) Running ./myspin 5
./sdriver.pl -t trace10.txt -s ./tsh -a "-p"
#
# trace10.txt - Process fg builtin command.
#
tsh> ./myspin 4 &
[1] (20541) ./myspin 4 &
tsh> fg %1
Job [1] (20541) stopped by signal 20
tsh> jobs
[1] (20541) Stopped ./myspin 4 &
tsh> fg %1
tsh> jobs
./sdriver.pl -t trace11.txt -s ./tsh -a "-p"
#
# trace11.txt - Forward SIGINT to every process in foreground process group
#
tsh> ./mysplit 4
Job [1] (20628) terminated by signal 2
tsh> /bin/ps t
PID TTY STAT TIME COMMAND
19378 pts/134 Ss 0:00 -bash
20273 pts/134 S+ 0:00 make
20277 pts/134 S+ 0:00 /bin/sh -c (cd src; make)
20278 pts/134 S+ 0:00 make
20279 pts/134 S+ 0:00 /bin/sh -c make tests > tshref.out 2>&1
20280 pts/134 S+ 0:00 make tests
20624 pts/134 S+ 0:00 /bin/sh -c ./sdriver.pl -t trace11.txt -s ./tsh -a "-p"
20625 pts/134 S+ 0:00 /usr/bin/perl ./sdriver.pl -t trace11.txt -s ./tsh -a -p
20626 pts/134 S+ 0:00 ./tsh -p
20645 pts/134 R 0:00 /bin/ps t
./sdriver.pl -t trace12.txt -s ./tsh -a "-p"
#
# trace12.txt - Forward SIGTSTP to every process in foreground process group
#
tsh> ./mysplit 4
Job [1] (20656) stopped by signal 20
tsh> jobs
[1] (20656) Stopped ./mysplit 4
tsh> /bin/ps t
PID TTY STAT TIME COMMAND
19378 pts/134 Ss 0:00 -bash
20273 pts/134 S+ 0:00 make
20277 pts/134 S+ 0:00 /bin/sh -c (cd src; make)
20278 pts/134 S+ 0:00 make
20279 pts/134 S+ 0:00 /bin/sh -c make tests > tshref.out 2>&1
20280 pts/134 S+ 0:00 make tests
20650 pts/134 S+ 0:00 /bin/sh -c ./sdriver.pl -t trace12.txt -s ./tsh -a "-p"
20651 pts/134 S+ 0:00 /usr/bin/perl ./sdriver.pl -t trace12.txt -s ./tsh -a -p
20654 pts/134 S+ 0:00 ./tsh -p
20656 pts/134 T 0:00 ./mysplit 4
20657 pts/134 T 0:00 ./mysplit 4
20668 pts/134 R 0:00 /bin/ps t
./sdriver.pl -t trace13.txt -s ./tsh -a "-p"
#
# trace13.txt - Restart every stopped process in process group
#
tsh> ./mysplit 4
Job [1] (20679) stopped by signal 20
tsh> jobs
[1] (20679) Stopped ./mysplit 4
tsh> /bin/ps t
PID TTY STAT TIME COMMAND
19378 pts/134 Ss 0:00 -bash
20273 pts/134 S+ 0:00 make
20277 pts/134 S+ 0:00 /bin/sh -c (cd src; make)
20278 pts/134 S+ 0:00 make
20279 pts/134 S+ 0:00 /bin/sh -c make tests > tshref.out 2>&1
20280 pts/134 S+ 0:00 make tests
20675 pts/134 S+ 0:00 /bin/sh -c ./sdriver.pl -t trace13.txt -s ./tsh -a "-p"
20676 pts/134 S+ 0:00 /usr/bin/perl ./sdriver.pl -t trace13.txt -s ./tsh -a -p
20677 pts/134 S+ 0:00 ./tsh -p
20679 pts/134 T 0:00 ./mysplit 4
20680 pts/134 T 0:00 ./mysplit 4
20700 pts/134 R 0:00 /bin/ps t
tsh> fg %1
tsh> /bin/ps t
PID TTY STAT TIME COMMAND
19378 pts/134 Ss 0:00 -bash
20273 pts/134 S+ 0:00 make
20277 pts/134 S+ 0:00 /bin/sh -c (cd src; make)
20278 pts/134 S+ 0:00 make
20279 pts/134 S+ 0:00 /bin/sh -c make tests > tshref.out 2>&1
20280 pts/134 S+ 0:00 make tests
20675 pts/134 S+ 0:00 /bin/sh -c ./sdriver.pl -t trace13.txt -s ./tsh -a "-p"
20676 pts/134 S+ 0:00 /usr/bin/perl ./sdriver.pl -t trace13.txt -s ./tsh -a -p
20677 pts/134 S+ 0:00 ./tsh -p
20715 pts/134 R 0:00 /bin/ps t
./sdriver.pl -t trace14.txt -s ./tsh -a "-p"
#
# trace14.txt - Simple error handling
#
tsh> ./bogus
./bogus: Command not found
tsh> ./myspin 4 &
[1] (20724) ./myspin 4 &
tsh> fg
fg command requires PID or %jid argument
tsh> bg
bg command requires PID or %jid argument
tsh> fg a
fg: argument must be a PID or %jid
tsh> bg a
bg: argument must be a PID or %jid
tsh> fg 9999999
(9999999): No such process
tsh> bg 9999999
(9999999): No such process
tsh> fg %2
%2: No such job
tsh> fg %1
Job [1] (20724) stopped by signal 20
tsh> bg %2
%2: No such job
tsh> bg %1
[1] (20724) ./myspin 4 &
tsh> jobs
[1] (20724) Running ./myspin 4 &
./sdriver.pl -t trace15.txt -s ./tsh -a "-p"
#
# trace15.txt - Putting it all together
#
tsh> ./bogus
./bogus: Command not found
tsh> ./myspin 10
Job [1] (20776) terminated by signal 2
tsh> ./myspin 3 &
[1] (20882) ./myspin 3 &
tsh> ./myspin 4 &
[2] (20884) ./myspin 4 &
tsh> jobs
[1] (20882) Running ./myspin 3 &
[2] (20884) Running ./myspin 4 &
tsh> fg %1
Job [1] (20882) stopped by signal 20
tsh> jobs
[1] (20882) Stopped ./myspin 3 &
[2] (20884) Running ./myspin 4 &
tsh> bg %3
%3: No such job
tsh> bg %1
[1] (20882) ./myspin 3 &
tsh> jobs
[1] (20882) Running ./myspin 3 &
[2] (20884) Running ./myspin 4 &
tsh> fg %1
tsh> quit
./sdriver.pl -t trace16.txt -s ./tsh -a "-p"
#
# trace16.txt - Tests whether the shell can handle SIGTSTP and SIGINT
# signals that come from other processes instead of the terminal.
#
tsh> ./mystop 2
Job [1] (20925) stopped by signal 20
tsh> jobs
[1] (20925) Stopped ./mystop 2
tsh> ./myint 2
Job [2] (20948) terminated by signal 2
./sdriver.pl -t trace17.txt -s ./tsh -a "-p"
#
# trace17.txt - Tests whether the shell can handle I/O redirection
#
tsh> /bin/echo hello > outfile
tsh> /bin/cat < outfile
hello
make[2]: Leaving directory '/h/u1/zingard/209-24s/shlab/src'