diff options
author | fche <fche> | 2006-08-12 05:13:09 +0000 |
---|---|---|
committer | fche <fche> | 2006-08-12 05:13:09 +0000 |
commit | 814bc89d4635f101b2c0077598f31aad95ed15b7 (patch) | |
tree | 407a49dbaf446af4751f5068607a7fb8dad0611d /testsuite/systemtap.syscall/coverage.tcl | |
parent | 6b6d04673a1ef175821afc7d4fabdb496698e8e3 (diff) | |
download | systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.tar.gz systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.tar.xz systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.zip |
2006-08-12 Frank Ch. Eigler <fche@elastic.org>
* configure.ac, Makefile.am: Descend into testsuite/
directory. Remove local test logic.
* configure, Makefile.in: Regenerated.
* runtest.sh: Not yet removed.
* HACKING: Update for new testsuite layout.
2006-08-12 Frank Ch. Eigler <fche@elastic.org>
* all: Reorganized old pass-1..4 tests one dejagnu bucket.
Moved over old pass-5 tests, except for disabled syscalls tests.
* Makefile (installcheck): New target for running pass-1..5
tests against installed systemtap.
Diffstat (limited to 'testsuite/systemtap.syscall/coverage.tcl')
-rwxr-xr-x | testsuite/systemtap.syscall/coverage.tcl | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/testsuite/systemtap.syscall/coverage.tcl b/testsuite/systemtap.syscall/coverage.tcl new file mode 100755 index 00000000..559039c1 --- /dev/null +++ b/testsuite/systemtap.syscall/coverage.tcl @@ -0,0 +1,77 @@ +#!/usr/bin/env tclsh + +# List of systemcalls that may or may not be in kernels. Until we +# fix PR2645, we cannot implement syscall probes for these. + +set badlist { add_key tux } + +foreach f $badlist { + set funcname($f) -1 +} + +set cmd {stap -p2 -e "probe kernel.function(\"sys_*\"), kernel.function(\"sys32_*\") ? \{\}"} +if {[catch {eval exec $cmd} output]} { + puts "ERROR running stap: $output" + exit +} + + +foreach line [split $output "\n"] { + if {[regexp {kernel.function\(\"sys_([^@]+)} $line match fn]} { + if {![info exists funcname($fn)]} { + set funcname($fn) 0 + } + } + if {[regexp {kernel.function\(\"sys32_([^@]+)} $line match fn]} { + set fn "32_$fn" + if {![info exists funcname($fn)]} { + set funcname($fn) 0 + } + } +} + +foreach filename [glob *.c] { + if {[catch {open $filename r} fd]} { + puts "ERROR opening $filename: $fd" + exit + } + while {[gets $fd line] >= 0} { + if {[regexp {/* COVERAGE: ([^\*]*)\*/} $line match res]} { + foreach f [split $res] { + if {[info exists funcname($f)]} { + incr funcname($f) + } + } + } + } + close $fd +} + +set covlist {} +set uncovlist {} +set covered 0 +set uncovered 0 +foreach {func val} [array get funcname] { + if {$val > 0} { + incr covered + lappend covlist $func + } elseif {$val == 0} { + incr uncovered + lappend uncovlist $func + } +} + +set total [expr $covered + $uncovered] +puts "Covered $covered out of $total. [format "%2.1f" [expr ($covered * 100.0)/$total]]%" + +puts "\nUNCOVERED FUNCTIONS" +set i 0 +foreach f [lsort $uncovlist] { + puts -nonewline [format "%-24s" $f] + incr i + if {$i >= 3} { + puts "" + set i 0 + } +} +puts "\n" |