Skip to content

Commit

Permalink
fixed missing parameters to memoryTest
Browse files Browse the repository at this point in the history
  • Loading branch information
ylogx committed Aug 4, 2013
1 parent e77d4ab commit 431c125
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions chaudhary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,26 @@ function helpFun {
############ Do automated testing by taking inputs from $filename.test file for C & C++ ##################
function memoryTest {
if test $compiled == true ; then
#echo #newline
if test -f $filename.test && test "$2" == "t" ; then
echo #newline
if test -f $filename.test; then
echo " * * * Valgrind Test: $filename.test found * * *"
time cat $filename.test | valgrind ./$filename.out
elif test -f $filename.test && test "$2" == "t1" ; then
echo " * * * Valgrind Test: $filename.test found * * *"
time cat $filename.test | valgrind --leak-check=full ./$filename.out
elif test -f $filename.test && test "$2" == "t2" ; then
echo " * * * Valgrind Test: $filename.test found * * *"
time cat $filename.test | valgrind --leak-check=full -v ./$filename.out
elif test -f $filename.test && test "$2" == "t3" ; then
echo " * * * Valgrind Test: $filename.test found * * *"
time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out
#else #No test arguments
#echo #newline
#echo "= = = For Copy/Paste = = = "
#echo "time cat $filename.test | valgrind ./$filename.out #[ t ]"
#echo "time cat $filename.test | valgrind --leak-check=full ./$filename.out #[ t1 ]"
#echo "time cat $filename.test | valgrind --leak-check=full -v ./$filename.out #[ t2 ]"
#echo "time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out #[ t3 ]"
if test "$2" == "t" ; then
time cat $filename.test | valgrind ./$filename.out
elif test "$2" == "t1" ; then
echo "in t1"
time cat $filename.test | valgrind --leak-check=full ./$filename.out
elif test "$2" == "t2" ; then
time cat $filename.test | valgrind --leak-check=full -v ./$filename.out
elif test "$2" == "t3" ; then
time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out
else #No test arguments
#echo #newline
echo "= = = For Copy/Paste = = = "
echo "time cat $filename.test | valgrind ./$filename.out #[ t ]"
#echo "time cat $filename.test | valgrind --leak-check=full ./$filename.out #[ t1 ]"
#echo "time cat $filename.test | valgrind --leak-check=full -v ./$filename.out #[ t2 ]"
#echo "time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out #[ t3 ]"
fi
fi
echo #newline
fi
Expand Down Expand Up @@ -134,7 +134,7 @@ function main {
echo "gcc -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename.out $1"
echo "Error(if any):" #newline
command gcc -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename.out $1 || compiled=false;
memoryTest
memoryTest $1 $2 $3
$compiled && echo "For Copy/Paste ===> ./$filename.out"
#gcc -Werror -pedantic-errors -std=c99 -O2 -fomit-frame-pointer -o prog prog.c #C99 strict (gcc-4.3.2)
#echo ".c file found"
Expand All @@ -150,7 +150,7 @@ function main {
echo "g++ -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename.out $1"
echo "Error(if any):" #newline
command g++ -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename.out $1 || compiled=false
memoryTest
memoryTest $1 $2 $3
$compiled && echo "For Copy/Paste ===> ./$filename.out"
#echo ".cpp file found"

Expand Down Expand Up @@ -196,12 +196,12 @@ function main {
then
echo #newline
echo "Ouch, The process of compilation failed."
echo "For Copy/Paste ===> gedit $1"
echo "For Copy/Paste ===> vi $1"
compiled=false
fi
} #end of main function
#if test $compiled == true ; then
#else #Show Usage & Help
#usage
#fi
main $1
main $1 $2 $3

0 comments on commit 431c125

Please sign in to comment.