test_logalloc.sh (1055B)
1 #!/bin/bash 2 3 set -e 4 5 LOGALLOC="${1#--logalloc=}" 6 PROGRAM="$2" 7 SRCDIR="$3" 8 PYTHON3="$4" 9 10 grep "^1 " ${SRCDIR}/replay.log > expected_output.log 11 12 # Test with MALLOC_LOG as a file descriptor number 13 # We filter out anything happening before the first jemalloc_stats (first 14 # command in replay.log) because starting with libstdc++ 5, a static 15 # initializer in the STL allocates memory, which we obviously don't have 16 # in expected_output.log. 17 MALLOC_LOG=1 ${LOGALLOC} ${PROGRAM} < ${SRCDIR}/replay.log | sed -n '/jemalloc_stats/,$p' | ${PYTHON3} ${SRCDIR}/logalloc_munge.py | diff -w - expected_output.log 18 19 # Test with MALLOC_LOG as a file name 20 rm -f test_output.log 21 MALLOC_LOG=test_output.log ${LOGALLOC} ${PROGRAM} < ${SRCDIR}/replay.log 22 sed -n '/jemalloc_stats/,$p' test_output.log | ${PYTHON3} ${SRCDIR}/logalloc_munge.py | diff -w - expected_output.log 23 24 MALLOC_LOG=1 MALLOC_LOG_MINIMAL=1 ${LOGALLOC} ${PROGRAM} < ${SRCDIR}/replay.log | sed -n '/jemalloc_stats/,$p' | ${PYTHON3} ${SRCDIR}/logalloc_munge.py | diff -w - ${SRCDIR}/expected_output_minimal.log