diff options
author | kevinrs <kevinrs> | 2005-12-23 21:09:32 +0000 |
---|---|---|
committer | kevinrs <kevinrs> | 2005-12-23 21:09:32 +0000 |
commit | f9f5199fb819ca7897ef895f9a4a86aecb147446 (patch) | |
tree | 290f03232fdcb1f16fc21af062fa4725fc96c5d9 /tapset/test/ctostp.sh | |
parent | d003aa24c4f339bdfc2b2e87ac0ba16b09cf221e (diff) | |
download | systemtap-steved-f9f5199fb819ca7897ef895f9a4a86aecb147446.tar.gz systemtap-steved-f9f5199fb819ca7897ef895f9a4a86aecb147446.tar.xz systemtap-steved-f9f5199fb819ca7897ef895f9a4a86aecb147446.zip |
2005-12-23 Kevin Stafford <krstaffo@us.ibm.com>
SCRIPTS:
run.sh - This is the driver for automated testing.
To run: ./run.sh stpdirectory c_binaries_directory
Result: log/timestamp.log discerpancy report
ctostp.sh - This script generates corresponding stp probe script
files for every C file found in the input directory.
To Run: ctostp.sh input output where input is the
directory containing the C files to convert. Output
is the directory to store the corresponding stp
files.
build.sh - This script expedites the process of compiling all
of the c files. When the "compile" flag is given
it creates a directory called bin, which stores the
compiled C programs. ./build.sh clean removes the
binaries, and ./build.sh run attempts to execute all
of the programs in cfiles/bin.
Diffstat (limited to 'tapset/test/ctostp.sh')
-rwxr-xr-x | tapset/test/ctostp.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tapset/test/ctostp.sh b/tapset/test/ctostp.sh new file mode 100755 index 00000000..1918ae83 --- /dev/null +++ b/tapset/test/ctostp.sh @@ -0,0 +1,54 @@ +# usage +if [ $# -ne 2 ]; then + echo -ne " \033[1mUsage:\033[0m ctostp src dest\n" + echo -ne " \033[1msrc:\033[0m\n" + echo -ne "\tthe source directory containing the\n" + echo -ne "\tC files used to generate the stp files\n" + echo -ne " \033[1mdest:\033[0m\n" + echo -ne "\tthe directory that will store the\n" + echo -ne "\tresulting stp files\n" + exit +fi +# strip trailing / +src=` echo $1|sed -e 's/\/$//'` +dest=`echo $2|sed -e 's/\/$//'` +# do some sanity checks +if [ `ls $src/*.c|wc -l` -le 0 ]; then + echo "ERROR: No C files found in $src" + exit +fi +if [ ! -d $dest ]; then + echo "ERROR: $dest does not exist!" + exit +else + #clear it out + rm -f $dest/* +fi +# ctostp +for file in `ls $src/*.c` +do + while read line + do + if [ `echo $line|grep ___________|wc -l` -eq 1 ] + then + fn=`basename $file|cut -d"." -f1` + echo "probe kernel.syscall.$fn {" >> $dest/$fn.stp + echo " if(execname()==\"e_$fn\") {" >> $dest/$fn.stp + fi + # ugly? yes. effective? yes. + if [[ `echo $line|grep dmsg|wc -l` -eq 1 + && `echo $line|grep char|wc -l` -eq 0 ]]; then + func=`echo $line|cut -d"\"" -f2` + var=` echo $line|cut -d"\"" -f4` + if [ `echo $var|grep void|wc -l` -eq 1 ] + then + echo " log(\"$func: $var = \".string(0))" >> $dest/$fn.stp + else + echo " log(\"$func: $var = \".string($var))" >> $dest/$fn.stp + fi + fi + done < $file + #close it up + echo " }" >> $dest/$fn.stp + echo -e "}\n" >> $dest/$fn.stp +done |