blob: 3b4a032806cb21a0949a3641b79afb6925c39da0 (
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
80
|
set testlist {backtrace args pid}
if {![installtest_p]} {
foreach test $testlist {
untested $test
}
return
}
set build_dir ""
proc cleanup {} {
global build_dir
catch {send "\003"}
foreach n {1 2} {
catch {exec sudo /bin/rm -f /lib/modules/$::uname/kernel/systemtap_test_module$n.ko}
catch {exec sudo /sbin/rmmod systemtap_test_module$n}
}
if {$build_dir != ""} {exec rm -rf $build_dir}
}
proc build_modules {} {
global build_dir
if {[catch {exec mktemp -d staptestXXXXX} build_dir]} {
puts stderr "Failed to create temporary directory: $build_dir"
return 0
}
foreach f [glob systemtap_test_module*.c] {
exec cp $f $build_dir
}
set old_dir [pwd]
cd $build_dir
foreach n {2 1} {
exec cp $old_dir/makefile$n Makefile
if {[catch {exec make clean} res]} {
puts $res
cd $old_dir
return 0
}
catch {exec make} res
if {![file exists systemtap_test_module$n.ko]} {
puts $res
cd $old_dir
return 0
}
if {[catch {exec sudo cp systemtap_test_module$n.ko /lib/modules/$::uname/kernel} res]} {
puts $res
cd $old_dir
return 0
}
}
foreach n {2 1} {
catch {exec sudo /sbin/insmod systemtap_test_module$n.ko}
}
cd $old_dir
return 1
}
# first build the modules
cd $srcdir/$subdir
set uname [exec /bin/uname -r]
if {[build_modules] == 0} {
puts "BUILD FAILED"
foreach test $testlist {
fail "$test - could not build modules"
}
return
}
foreach test $testlist {
source $test.tcl
}
|