summaryrefslogtreecommitdiffstats
path: root/tapset/test/build.sh
diff options
context:
space:
mode:
authorkevinrs <kevinrs>2005-12-23 21:09:32 +0000
committerkevinrs <kevinrs>2005-12-23 21:09:32 +0000
commitf9f5199fb819ca7897ef895f9a4a86aecb147446 (patch)
tree290f03232fdcb1f16fc21af062fa4725fc96c5d9 /tapset/test/build.sh
parentd003aa24c4f339bdfc2b2e87ac0ba16b09cf221e (diff)
downloadsystemtap-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/build.sh')
-rwxr-xr-xtapset/test/build.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/tapset/test/build.sh b/tapset/test/build.sh
new file mode 100755
index 00000000..05b64f67
--- /dev/null
+++ b/tapset/test/build.sh
@@ -0,0 +1,56 @@
+function usage {
+ echo -ne " \033[1mUsage:\033[0m build [compile|clean|run]\n"
+ echo -ne " \033[1mDo not remove this script from this dir!\033[0m\n"
+ exit
+}
+function clean {
+ rm -rf bin
+}
+function compile {
+ if [ ! -d bin ]; then
+ mkdir bin
+ else
+ rm -rf bin/*
+ fi
+ for file in `ls *.c`
+ do
+ execn=e_`echo $file|cut -d"." -f1`
+ # some depend on external realtime lib...
+ if [[ `echo $file|grep clock|wc -l` -gt 0
+ || `echo $file|grep timer|wc -l` -gt 0 ]]
+ then
+ gcc -lrt $file -o bin/$execn
+ else
+ gcc $file -o bin/$execn
+ fi
+ done
+ if [ `ls *.c|wc -l` -eq `ls bin|wc -l` ]; then
+ echo "Success: compiled `ls bin|wc -l` files."
+ else
+ echo "Some files failed to compile! Try again."
+ fi
+}
+function run {
+ if [ ! -d bin -o `ls bin|wc -l` -le 0 ]; then
+ echo "No compiled C files! First build compile!"
+ exit
+ else
+ for execn in `ls bin`
+ do
+ echo "$execn _______________________________"
+ ./bin/$execn
+ done
+ fi
+}
+
+if [ $# -ne 1 ]; then
+ usage
+elif [ $1 == "compile" ]; then
+ compile
+elif [ $1 == "clean" ]; then
+ clean
+elif [ $1 == "run" ]; then
+ run
+else
+ usage
+fi