From 56dc2882d77b06df555506355b2b55d6610ca217 Mon Sep 17 00:00:00 2001 From: pithikos Date: Thu, 12 Mar 2015 19:16:27 +0000 Subject: [PATCH] Tests for non-zero heap/stack bug --- tests/README.md | 2 +- tests/{bugtraq.sh => heap_stack_garbage.sh} | 8 ++++---- tests/normal_compile.sh | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) rename tests/{bugtraq.sh => heap_stack_garbage.sh} (65%) diff --git a/tests/README.md b/tests/README.md index 54549ef..45d805b 100644 --- a/tests/README.md +++ b/tests/README.md @@ -8,7 +8,7 @@ memleaks - Will run tests for memory leaks. valgrind is being used for this. threadpool - Will run general functional tests for the threadpool. pause_resume - Will test the synchronisation of the threadpool from the user. wait - Will run tests to assuse that the wait() function works correctly. - +heap_stack_garbage - Will test if previous garbage affects new threapools created. ```` Any test can be run with extra flags by exporting the variable COMPILATION_FLAGS. That's also how the optimized_compile test works. diff --git a/tests/bugtraq.sh b/tests/heap_stack_garbage.sh similarity index 65% rename from tests/bugtraq.sh rename to tests/heap_stack_garbage.sh index cbff60e..859dfe3 100755 --- a/tests/bugtraq.sh +++ b/tests/heap_stack_garbage.sh @@ -11,11 +11,11 @@ function test_with_nonzero_heap_and_stack { compile src/nonzero_heap_stack.c - if ! timeout 1 ./test; then - err "Fail running on nonzero heap and stack" + echo "Testing for non-zero heap and stack" + output=$(timeout 1 ./test) + if [[ $? != 0 ]]; then + err "Fail running on nonzero heap and stack" "$output" exit 1 - else - return fi } diff --git a/tests/normal_compile.sh b/tests/normal_compile.sh index 0e78eb0..3613606 100755 --- a/tests/normal_compile.sh +++ b/tests/normal_compile.sh @@ -10,6 +10,7 @@ . threadpool.sh . pause_resume.sh +. heap_stack_garbage.sh . memleaks.sh . wait.sh