Skip to content

Commit 431c125

Browse files
committedAug 4, 2013
fixed missing parameters to memoryTest
1 parent e77d4ab commit 431c125

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed
 

‎chaudhary.sh

+23-23
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,26 @@ function helpFun {
7070
############ Do automated testing by taking inputs from $filename.test file for C & C++ ##################
7171
function memoryTest {
7272
if test $compiled == true ; then
73-
#echo #newline
74-
if test -f $filename.test && test "$2" == "t" ; then
73+
echo #newline
74+
if test -f $filename.test; then
7575
echo " * * * Valgrind Test: $filename.test found * * *"
76-
time cat $filename.test | valgrind ./$filename.out
77-
elif test -f $filename.test && test "$2" == "t1" ; then
78-
echo " * * * Valgrind Test: $filename.test found * * *"
79-
time cat $filename.test | valgrind --leak-check=full ./$filename.out
80-
elif test -f $filename.test && test "$2" == "t2" ; then
81-
echo " * * * Valgrind Test: $filename.test found * * *"
82-
time cat $filename.test | valgrind --leak-check=full -v ./$filename.out
83-
elif test -f $filename.test && test "$2" == "t3" ; then
84-
echo " * * * Valgrind Test: $filename.test found * * *"
85-
time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out
86-
#else #No test arguments
87-
#echo #newline
88-
#echo "= = = For Copy/Paste = = = "
89-
#echo "time cat $filename.test | valgrind ./$filename.out #[ t ]"
90-
#echo "time cat $filename.test | valgrind --leak-check=full ./$filename.out #[ t1 ]"
91-
#echo "time cat $filename.test | valgrind --leak-check=full -v ./$filename.out #[ t2 ]"
92-
#echo "time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out #[ t3 ]"
76+
if test "$2" == "t" ; then
77+
time cat $filename.test | valgrind ./$filename.out
78+
elif test "$2" == "t1" ; then
79+
echo "in t1"
80+
time cat $filename.test | valgrind --leak-check=full ./$filename.out
81+
elif test "$2" == "t2" ; then
82+
time cat $filename.test | valgrind --leak-check=full -v ./$filename.out
83+
elif test "$2" == "t3" ; then
84+
time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out
85+
else #No test arguments
86+
#echo #newline
87+
echo "= = = For Copy/Paste = = = "
88+
echo "time cat $filename.test | valgrind ./$filename.out #[ t ]"
89+
#echo "time cat $filename.test | valgrind --leak-check=full ./$filename.out #[ t1 ]"
90+
#echo "time cat $filename.test | valgrind --leak-check=full -v ./$filename.out #[ t2 ]"
91+
#echo "time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out #[ t3 ]"
92+
fi
9393
fi
9494
echo #newline
9595
fi
@@ -134,7 +134,7 @@ function main {
134134
echo "gcc -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename.out $1"
135135
echo "Error(if any):" #newline
136136
command gcc -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename.out $1 || compiled=false;
137-
memoryTest
137+
memoryTest $1 $2 $3
138138
$compiled && echo "For Copy/Paste ===> ./$filename.out"
139139
#gcc -Werror -pedantic-errors -std=c99 -O2 -fomit-frame-pointer -o prog prog.c #C99 strict (gcc-4.3.2)
140140
#echo ".c file found"
@@ -150,7 +150,7 @@ function main {
150150
echo "g++ -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename.out $1"
151151
echo "Error(if any):" #newline
152152
command g++ -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename.out $1 || compiled=false
153-
memoryTest
153+
memoryTest $1 $2 $3
154154
$compiled && echo "For Copy/Paste ===> ./$filename.out"
155155
#echo ".cpp file found"
156156

@@ -196,12 +196,12 @@ function main {
196196
then
197197
echo #newline
198198
echo "Ouch, The process of compilation failed."
199-
echo "For Copy/Paste ===> gedit $1"
199+
echo "For Copy/Paste ===> vi $1"
200200
compiled=false
201201
fi
202202
} #end of main function
203203
#if test $compiled == true ; then
204204
#else #Show Usage & Help
205205
#usage
206206
#fi
207-
main $1
207+
main $1 $2 $3

0 commit comments

Comments
 (0)
Please sign in to comment.