Debian Codegraph @

tests/016_memleakcheck.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # test if there is much memory leaking.
3 set -ex
4
5 TESTDIR=$(mktempscip-shell system . . mktemp. -d )
6 TESTCODE=$(readlinkscip-shell system . . readlink. -f tests/016_memleakcheck.c)
7 COW_SHELL=$(readlinkscip-shell system . . readlink. -f cow-shell)
8 gccscip-shell system . . gcc. ${TESTCODE} -o ${TESTDIR}/tracer -g
9
10 (
11 set -ex
12 cd ${TESTDIR}
13 mkdirscip-shell system . . mkdir. 1/
14 # make a few files for testing.
15 touchscip-shell system . . touch. 1/a 1/b 1/c 1/d
16 ddscip-shell system . . dd. if=/dev/zeroscip-shell filesystem . . `/dev/zero`. of=1/e bs=512 count=2
17
18 cpscip-shell system . . cp. -al 1 2
19
20 # undefine LD_PRELOAD because it seems like loading cowdancer lib twice is causing memory leak?
21 LD_PRELOAD= MALLOC_TRACE="log" ${COW_SHELL} ${TESTDIR}/tracer
22 )
23 RESULT=$?
24
25 mtrace ${TESTDIR}/tracer ${TESTDIR}/log
26 rmscip-shell system . . rm. -rf ${TESTDIR}
27
28 exit $RESULT
29