File tree Expand file tree Collapse file tree 4 files changed +81
-1
lines changed Expand file tree Collapse file tree 4 files changed +81
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ script:
25
25
- cd $TRAVIS_BUILD_DIR
26
26
- sh build_px.sh "build_$TRAVIS_OS_NAME.sh" "testrunner_$TRAVIS_OS_NAME.sh"
27
27
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sh pxleakcheck_linux.sh; fi
28
+ - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sh valgrind_linux.sh; fi
28
29
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then cd $TRAVIS_BUILD_DIR; fi
29
30
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then tar -cvzf logs.tgz logs/* ; fi
30
31
addons :
Original file line number Diff line number Diff line change @@ -16,8 +16,23 @@ export LD_LIBRARY_PATH=$PathR
16
16
export NODE_PATH=.
17
17
18
18
# export RT_LOG_LEVEL=info
19
-
19
+
20
+ if [ $ENABLE_VALGRIND -eq 1 ]
21
+ then
22
+ if [ -z $VALGRINDLOGS ]
23
+ then
24
+ VALGRINDLOGS=valgrind_logs
25
+ fi
26
+ echo " valgrind --tool=memcheck --log-file=$VALGRINDLOGS --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./pxscene $1 $2 $3 $4 $5 $6 $7 "
27
+ if [ -z $SUPPRESSIONS ]
28
+ then
29
+ valgrind --tool=memcheck --log-file=$VALGRINDLOGS --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./pxscene $1 $2 $3 $4 $5 $6 $7
30
+ else
31
+ valgrind --tool=memcheck --suppressions=$SUPPRESSIONS --log-file=$VALGRINDLOGS --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./pxscene $1 $2 $3 $4 $5 $6 $7
32
+ fi
33
+ else
20
34
./pxscene $1 $2 $3 $4 $5 $6 $7
35
+ fi
21
36
# To run pxscene as background process
22
37
# ./pxscene $1 $2 $3 $4 $5 $6 $7 < `tty` >> /var/tmp/pxscene.log 2>&1 &
23
38
Original file line number Diff line number Diff line change
1
+ {
2
+ glutLeaks
3
+ Memcheck:Leak
4
+ match-leak-kinds:definite
5
+ fun:malloc
6
+ ...
7
+ fun:glXMakeContextCurrent
8
+ fun:fgOpenWindow
9
+ ...
10
+ }
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ export VALGRINDLOGS=$TRAVIS_BUILD_DIR /logs/valgrind_logs
3
+ export ENABLE_VALGRIND=1
4
+ export PX_DUMP_MEMUSAGE=1
5
+ export SUPPRESSIONS=$TRAVIS_BUILD_DIR /leak.supp
6
+ VALGRINDPXCORELOGS=$TRAVIS_BUILD_DIR /logs/valgrind_pxcore_logs
7
+
8
+ # run valgrind and monitor for completion
9
+ cd $TRAVIS_BUILD_DIR /examples/pxScene2d/src
10
+ ./pxscene.sh testRunner_memcheck.js > $VALGRINDPXCORELOGS &
11
+ grep " RUN COMPLETED" $VALGRINDPXCORELOGS
12
+ retVal=$?
13
+ count=0
14
+ while [ " $retVal " -ne 0 ] && [ " $count " -lt 600 ]; do
15
+ sleep 30;
16
+ grep " RUN COMPLETED" $VALGRINDPXCORELOGS
17
+ retVal=$?
18
+ count=$(( count+ 30 ))
19
+ echo " Valgrind execution going on for $count seconds" ;
20
+ done
21
+
22
+ # kill pxscene either after js terminates or no response for 5 minutes
23
+ echo " ` ps -ef | grep valgrind | grep -v grep| grep pxscene| grep -v pxscene.sh| awk ' {print $2}' ` "
24
+ kill -15 ` ps -ef | grep valgrind | grep -v grep| grep pxscene| grep -v pxscene.sh| awk ' {print $2}' `
25
+ sleep 5s;
26
+ pkill -9 -f pxscene.sh
27
+
28
+ # check whether valgrind got completed
29
+ grep " definitely lost" $VALGRINDLOGS
30
+ retVal=$?
31
+ if [ " $retVal " -ne 0 ]
32
+ then
33
+ echo " Valgrind execution got stuck and not terminated in 5 minutes" ;
34
+ if [ " $TRAVIS_PULL_REQUEST " != " false" ]
35
+ then
36
+ cat $VALGRINDLOGS
37
+ fi
38
+ exit 1;
39
+ fi
40
+
41
+ # check for memory leak
42
+ grep " definitely lost: 0 bytes in 0 blocks" $VALGRINDLOGS
43
+ retVal=$?
44
+ if [ " $retVal " -eq 0 ]
45
+ then
46
+ exit 0;
47
+ else
48
+ echo " !!!!!!!!!!!!! Memory leak present !!!!!!!!!!!!!!!!!!!" ;
49
+ if [ " $TRAVIS_PULL_REQUEST " != " false" ]
50
+ then
51
+ cat $VALGRINDLOGS
52
+ fi
53
+ exit 1;
54
+ fi
You can’t perform that action at this time.
0 commit comments