Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.apps/xulrunner.exp

raw
1 set test "xulrunner"
2
3 # Test sdt support in xulrunner.
4
5 global env
6
7 # deprecate as xulrunner is no longer supported
8 untested "$test test is deprecated"
9 return
10
11 if {! [info exists env(SYSTEMTAP_TESTAPPS)] || (
12 ! [string match "xulrunner" $env(SYSTEMTAP_TESTAPPS)] &&
13 ! [string match "all" $env(SYSTEMTAP_TESTAPPS)])} {
14 untested "$test sdt app"
15 return
16 }
17
18 ########## Create /tmp/stap-xul.stp ##########
19 set xulrelease "41.0.1"
20 set xuldir "[pwd]/xul/"
21 set testsuite "[pwd]"
22
23 set fp [open "$testsuite/stap-xul.stp" "w"]
24 puts $fp "
25 global funcinfo
26 global objinfo
27
28 probe process(@1).mark(\"function__info\")
29 {
30 file = user_string (\$arg1)
31 func = user_string (\$arg3)
32 funcinfo\[file,func\] <<< 1
33 }
34
35 probe process(@1).mark(\"object__create\")
36 {
37 file = user_string (\$arg1)
38 class = user_string (\$arg2)
39 objinfo\[file,class\] <<< 1
40 }
41
42 probe end
43 {
44 foreach (\[i,j\] in funcinfo+)
45 {
46 printf (\"probes: %-20s %-25s %d\\n\", substr(i,strlen(i)-20,strlen(i)), j, @count(funcinfo\[i,j\]))
47 }
48 foreach (\[i,j\] in objinfo+)
49 {
50 printf (\"probes: %-20s %-25s %d\\n\", substr(i,strlen(i)-20,strlen(i)), j, @count(funcinfo\[i,j\]))
51 }
52 }
53 "
54 close $fp
55
56 ########## Begin /tmp/stap-xul.sh ##########
57 set fp [open "$testsuite/stap-xul.sh" "w"]
58 puts $fp "
59 ##### begin run_tests #####
60 function run_tests \{
61 cd $testsuite/xul/bld/js/src
62 pwd
63 for i in \$(find $xuldir/src/js/src/tests -mindepth 2 -name 'regress*' -prune \
64 -o -name 'shell.js' -prune -o \\( -name '*js' -print \\)) ; do
65 $env(SYSTEMTAP_PATH)/stap -c \"./js -f $xuldir/src/js/src/tests/shell.js -f \$i\" \
66 $testsuite/stap-xul.stp ./js
67 done | tee $testsuite/stap-xul-markers.log
68
69 PROBES=\$(grep 'probes: ' $testsuite/stap-xul-markers.log | wc -l)
70 TESTS=\$(grep '-FAIL' $testsuite/stap-xul-markers.log)
71 echo PROBES=\$PROBES TESTS=\$TESTS
72
73 if \[ \$PROBES -gt 400 \] ; then
74 echo PASS: xulrunner javascript markers \$1
75 else
76 echo FAIL: xulrunner javascript markers \$1
77 fi
78
79 if \[ -z \$TESTS \] ; then
80 echo PASS: xulrunner javascript testsuite \$1
81 else
82 echo FAIL: xulrunner javascript testsuite \$1
83 fi
84
85 \}
86 ##### end run_tests #####
87
88 if \[ ! -r xulrunner-$xulrelease.source.tar.xz \] ; then
89 wget -q http://ftp.mozilla.org/pub/xulrunner/releases/$xulrelease/source/xulrunner-$xulrelease.source.tar.xz
90 # wget -q http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/latest/source/xulrunner-$xulrelease.source.tar.xz
91 fi
92 if \[ ! -r xulrunner-$xulrelease.source.tar.xz \] ; then
93 echo UNTESTED: wget xulrunner-$xulrelease.source.tar.xz
94 exit
95 fi
96
97 if \[ ! -d xul/src \] ; then
98 unxz xulrunner-$xulrelease.source.tar.xz
99 tar -x -f xulrunner-$xulrelease.source.tar
100 mkdir xul
101 mv mozilla-* xul/src
102 fi
103
104 if \[ ! -f xul/bld/js/src/js \] ; then
105 mkdir xul/bld
106 cd xul/bld
107 JAVA=`yum info available 'java*openjdk' |& awk '/Name/ {print \$3}'`
108 for P in glib-devel gtk+ ORBit-devel \$JAVA ; do
109 if rpm -q \$P ; then :
110 else echo UNTESTED: Need to: dnf install \$P
111 exit
112 fi
113 done
114 JAVA_HOME=/usr/lib/jvm/\$JAVA.`uname -i` \
115 CXXFLAGS='-g -I$env(SYSTEMTAP_INCLUDES)' \
116 CFLAGS='-g -I$env(SYSTEMTAP_INCLUDES)' \
117 PATH=$env(SYSTEMTAP_PATH)/:\$PATH \
118 ../src/configure --prefix=$xuldir --enable-dtrace \
119 --enable-application=xulrunner --disable-necko-wifi --disable-gconf \
120 --disable-dbus --disable-alsa --disable-pulseaudio --disable-webm --without-intl-api
121
122 if \[ \$\? -eq 0 \] ; then true ; else
123 # configure failure possibly due to gtk+-2.0 requirement
124 echo UNTESTED: xulrunner configure failed
125 exit
126 fi
127 sed -i '/include.*rules.mk/a\\
128 ifdef HAVE_DTRACE\\
129 PROGOBJS += ../mozjs-dtrace.\$(OBJ_SUFFIX)\\
130 endif\\
131 ' js/src/shell/Makefile
132 sed -i '/include.*rules.mk/a\\
133 ifdef HAVE_DTRACE\\
134 PROGOBJS += ../mozjs-dtrace.\$(OBJ_SUFFIX)\\
135 endif\\
136 ' js/src/jsapi-tests/Makefile
137 J=\$(getconf _NPROCESSORS_CONF)
138 make
139 if \[ \$\? -eq 0 \] ; then true ; else
140 echo UNTESTED: xulrunner build failed
141 exit
142 fi
143 fi
144
145 run_tests uprobe
146 "
147 ########## End /tmp/stap-xul.sh ##########
148 close $fp
149
150 ########## /tmp/stap-xul.sh does most of the work ##########
151 verbose -log Running xul testsuite
152 spawn sh stap-xul.sh 2>&1
153 expect {
154 -timeout 10000
155 -re {UNTESTED: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s;
156 untested "$s"; exp_continue }
157 -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s;
158 fail "$s"; exp_continue }
159 -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s;
160 pass "$s"; exp_continue }
161 -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s;
162 verbose -log "$s"
163 unsupported "$s"; exp_continue }
164 timeout { fail "$test (timeout)" }
165 eof { }
166 }
167 catch {close}; catch {wait}
168
169 if { $verbose == 0 } {
170 catch {exec rm -rf $testsuite/stap-xul.stp xulrunner-$xulrelease-source.tar \
171 $testsuite/stap-xul-markers.log $testsuite/stap-xul.sh }
172 catch {exec rm -rf xul}
173 }