4
# A driver program to test DBUG features - runs tests (shell commands)
5
# from the end of file to invoke tests.c, which does the real dbug work.
12
die unless $exe =~ s/(tests)-t(\.exe)?$/$1$2 /;
17
if (/^% \.\/tests /) {
22
push @{$tests[$#tests]}, $_
26
plan skip_all => "because dbug is disabled" if system $exe;
28
plan tests => scalar(@tests);
33
open F, '-|', $t or die "open($t|): $!";
35
$out=join($", <F>); close(F);
36
# special cases are handled here:
37
$out =~ s/Memory: 0x[0-9A-Fa-f]+/Memory: 0x####/g if $t =~ /dump/;
38
# compare ("\n" at the beginning makes better output in case of errors)
39
is("\n$out","\n@$_", $t);
48
main: explain: dbug explained: d
54
## Testing negative lists
61
main: explain: dbug explained: d:-d,ret3
78
% ./tests t:d,info:-d,ret3
95
% ./tests t:d,info:-d,ret3:-f,func2
106
% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate
109
% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate_if
112
% ./tests t:d:-d,ret3:-f,func2 d,evaluate_if
115
% ./tests t:d:-d,ret3:-f,func2
124
| explain: dbug explained: d:-d,ret3:f:-f,func2:t
129
## Adding incremental settings to the brew
131
% ./tests t:d:-d,ret3:-f,func2 +d,evaluate_if
145
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump
151
| dump: Memory: 0x#### Bytes: (27)
152
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
159
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump
165
| dump: Memory: 0x#### Bytes: (27)
166
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
173
% ./tests t:d:-d,ret3:f:-f,func2:+d,dump
179
| dump: Memory: 0x#### Bytes: (27)
180
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
187
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain
193
| dump: Memory: 0x#### Bytes: (35)
194
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
195
66 2C 66 75 6E 63 32 3A 74
198
| explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:t
202
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain:P
205
dbug-tests: | | | >func3
206
dbug-tests: | | | <func3
208
dbug-tests: | dump: Memory: 0x#### Bytes: (37)
209
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
210
66 2C 66 75 6E 63 32 3A 50 3A 74
213
dbug-tests: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:P:t
214
dbug-tests: | | >func3
215
dbug-tests: | | <func3
217
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain:P:F
219
dbug-tests: tests.c: | >func1
220
dbug-tests: tests.c: | | | >func3
221
dbug-tests: tests.c: | | | <func3
222
dbug-tests: tests.c: | <func1
223
dbug-tests: tests.c: | dump: Memory: 0x#### Bytes: (39)
224
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
225
66 2C 66 75 6E 63 32 3A 46 3A 50 3A 74
228
dbug-tests: tests.c: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:F:P:t
229
dbug-tests: tests.c: | | >func3
230
dbug-tests: tests.c: | | <func3
231
dbug-tests: tests.c: <main
233
## DBUG_EXPLAIN, DBUG_PUSH, DBUG_POP, DBUG_SET
235
% ./tests t:d:-d,ret3:f:-f,func2
244
| explain: dbug explained: d:-d,ret3:f:-f,func2:t
248
% ./tests t:d:-d,ret3
260
| explain: dbug explained: d:-d,ret3:t
267
% ./tests d,info:-d,ret3:d,push
277
% ./tests d,info:-d,ret3:d,push,explain
281
| explain: dbug explained: d,info,push,explain:-d,ret3:t
288
% ./tests d,info:-d,ret3:d,explain
292
main: explain: dbug explained: d,info,explain:-d,ret3
294
% ./tests d,info:-d,ret3:d,explain,pop
298
% ./tests d,info:-d,ret3:d,explain t:d,pop
308
main: explain: dbug explained: d,info,explain:-d,ret3
310
% ./tests d,info:-d,ret3:d,explain,pop +t
321
main: explain: dbug explained: d,info,explain,pop:-d,ret3
323
% ./tests d,info:-d,ret3:d,explain,set
327
tests.c: main: explain: dbug explained: d,info,explain,set:-d,ret3:F
328
tests.c: func2: info: s=ko
329
% ./tests d,info:-d,ret3:d,explain,set:t
340
tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t
344
tests.c: | | info: s=ko
347
% ./tests t d,info:-d,ret3:d,explain,set:t
358
tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t
362
tests.c: | | info: s=ko
365
% ./tests t d,info:-d,ret3:d,explain,set,pop
382
## Testing SUBDIR rules
384
% ./tests t:-f,func2/:d
391
| explain: dbug explained: d:f:-f,func2/:t
393
% ./tests t:f,func1/:d
403
% ./tests t:f,main/:d,pop
413
% ./tests f,main/:d,push
422
## Testing FixTraceFlags() - when we need to traverse the call stack
423
# (these tests fail with FixTraceFlags() disabled)
425
# delete the INCLUDE rule up the stack
426
% ./tests t:f,func1/ --push1=t:f,func3/
437
# delete the EXCLUDE rule up the stack
438
% ./tests t:-f,func1/ --push1=t
449
# add the INCLUDE rule up the stack
450
% ./tests t:f,func3 --push1=t:f,main/
462
# add the EXCLUDE rule up the stack
463
% ./tests t --push1=t:-f,main/
473
# change the defaults
474
% ./tests t:f,func3 --push1=t