blob: da9910b668ff9dfbabe43e49688226aa35e0aa93 (
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
81
82
83
84
85
86
87
88
|
set testlist {backtrace args pid num_args}
if {![installtest_p]} {
foreach test $testlist {
untested $test
}
return
}
set build_dir ""
proc cleanup {} {
global build_dir
catch { exec kill -INT -[exp_pid] }
foreach n {1 2} {
as_root [list /bin/rm -f /lib/modules/$::uname/kernel/systemtap_test_module$n.ko]
as_root [list /sbin/rmmod systemtap_test_module$n]
}
if {$build_dir != ""} {exec rm -rf $build_dir}
}
proc build_modules {} {
global build_dir
global srcdir subdir
if {[catch {exec mktemp -d staptestXXXXXX} build_dir]} {
verbose -log "Failed to create temporary directory: $build_dir"
return 0
}
foreach f [glob $srcdir/$subdir/systemtap_test_module*.c] {
exec cp $f $build_dir
}
set old_dir [pwd]
cd $build_dir
foreach n {2 1} {
exec cp -p $srcdir/$subdir/makefile$n Makefile
if {[catch {exec make clean} res]} {
verbose -log "$res"
cd $old_dir
return 0
}
catch {exec make} res
if {![file exists systemtap_test_module$n.ko]} {
verbose -log "$res"
cd $old_dir
return 0
}
set res [as_root [list cp systemtap_test_module$n.ko /lib/modules/$::uname/kernel]]
if { $res != 0 } {
verbose -log "$res"
cd $old_dir
return 0
}
}
foreach n {2 1} {
as_root [list /sbin/insmod systemtap_test_module$n.ko]
}
cd $old_dir
return 1
}
# first build the modules
# NB: We cannot "cd" on behalf the whole dejagnu process, especially
# without going back to the build tree, and especially not to the
# source tree expecting to be able to write there.
#
# cd $srcdir/$subdir
set uname [exec /bin/uname -r]
if {[build_modules] == 0} {
verbose -log "BUILD FAILED"
foreach test $testlist {
fail "$test - could not build modules"
}
return
}
foreach test $testlist {
send_log "sourcing: $srcdir/$subdir/$test.tcl\n"
source $srcdir/$subdir/$test.tcl
}
cleanup
|