Fixing Memory Leak Test

Change-Id: I8446f2789adfbb07ea5f8925e7b2ae2bc5cdd468
This commit is contained in:
Ammar ELWazir
2023-06-20 19:56:36 +00:00
committed by Ammar Elwazir
vanhempi 93c28b5d39
commit 5987bc375b
3 muutettua tiedostoa jossa 1 lisäystä ja 26 poistoa
@@ -1,4 +1,3 @@
configure_file(run_asan_tests.sh ${PROJECT_BINARY_DIR}/tests-v2/memorytests COPYONLY)
configure_file(suppr.txt ${PROJECT_BINARY_DIR}/tests-v2/memorytests COPYONLY)
configure_file(test_mem.py ${PROJECT_BINARY_DIR}/tests-v2/memorytests COPYONLY)
configure_file(input.txt ${PROJECT_BINARY_DIR}/tests-v2/memorytests COPYONLY)
@@ -4,6 +4,4 @@ CURRENT_DIR="$( dirname -- "$0"; )";
export PATH=$rocprofilerdir:$PATH
echo -e "Running Memory Leaks Check From ${CURRENT_DIR}"
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.6 ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=suppressions=$CURRENT_DIR/suppr.txt ${CURRENT_DIR}/../../rocprofv2 -i $CURRENT_DIR/input.txt $1 > /tmp/rocprofv2-temp 2> $2
echo -e "Log with all detected leaks is available at build/memleaks.log"
eval python3 $CURRENT_DIR/test_mem.py $2
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.6 ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=suppressions=$CURRENT_DIR/suppr.txt ${CURRENT_DIR}/../../rocprofv2 -i $CURRENT_DIR/input.txt --sys-trace $*
-22
Näytä tiedosto
@@ -1,22 +0,0 @@
import sys
file = open(sys.argv[1], 'r')
Lines = file.readlines()
count = 0
flag = 0
print("Leaks Detected:")
for line in Lines:
if "object(s) allocated from" in line:
flag = 0
if "rocprofiler/src" in line and flag == 0:
print(line)
count+=1
flag = 1
if count == 0:
print("No Leaks were found!")
else:
print("Warning: Found (" + str(count) + ") Memory Leaks related to rocprofiler project!")