blob: 5b9d8253b7458ceb9bb33630150fe4187a591e01 (
plain)
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
|
set test "flightrec3"
if {![installtest_p]} { untested $test; return }
# cleanup
system "rm -f flightlog.out*"
set pid 0
# check -S option with bulk(percpu file) mode
spawn stap -F -o flightlog.out -S 1,3 -b $srcdir/$subdir/$test.stp
expect {
-timeout 240
-re {([0-9]+)\r\n} {
pass "$test (-S option with bulk mode)"
set pid $expect_out(1,string)
exp_continue}
timeout { fail "$test (timeout)"}
eof { }
}
wait
if {$pid == 0} {
fail "$test (no pid)"
return -1
}
exec sleep 4
array set cpus {}
set scnt 0
# wait for log files
exec kill -STOP $pid
exec sleep 1
eval spawn stat -c \"%n %s\" [glob flightlog.out_cpu*]
expect {
-timeout 100
-re {flightlog.out_cpu([0-9]+).[0-9]+ ([0-9]+)\r\n} {
set cpuid $expect_out(1,string)
set size $expect_out(2,string)
if {[array get cpus $cpuid] == ""} {set cpus($cpuid) 0}
incr cpus($cpuid);
if {$size <= 1048576 } {incr scnt}
exp_continue}
timeout { fail "$test (logfile timeout)"}
}
wait
exec kill -CONT $pid
exec sleep 3
exec kill -STOP $pid
eval spawn stat -c \"%n %s\" [glob flightlog.out_cpu*]
expect {
-timeout 100
-re {flightlog.out_cpu([0-9]+).[0-9]+ ([0-9]+)\r\n} {
set cpuid $expect_out(1,string)
set size $expect_out(2,string)
if {[array get cpus $cpuid] == ""} {set cpus($cpuid) 0}
incr cpus($cpuid);
if {$size <= 1048576 } {incr scnt}
exp_continue}
timeout { fail "$test (logfile timeout)"}
}
wait
exec kill -CONT $pid
# check logfile number
set cnt 0
foreach e [array names cpus] {
if {$cpus($e) != 6} {
fail "$test (log file numbers cpu:$e, cnt:$cpus($e)))"
}
set cnt [expr $cnt + $cpus($e)]
}
# check logfile size
if {$scnt == $cnt} {
pass "$test (log file size limitation with bulk mode)"
} else {
fail "$test (log file size ($scnt != $cnt))"
}
exec kill -TERM $pid
# wait for exiting...
exec sleep 1
system "rm -f flightlog.out*"
|