From 0002e01d490812c141c9a7e8b536c024e9810fb7 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Wed, 24 Jul 2024 17:14:53 -0300 Subject: [PATCH] Improving detection of garbage collection bugs --- CONTRIBUTING.md | 13 ++++++++++++- run-tests | 5 +++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 31a83acd..15f73de4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,18 @@ Flag | Effect ./run-tests -k | Run all tests even if some tests are failing ./run-tests -o gtest | The gtest output format might be easier to read if you are using print statements for debugging. -For convenience, when the test script is run without any parameters, it also runs the linter at the end. +For convenience, when the test script is run without any busted parameters, it also runs the linter at the end. + +#### Testing garbage collection + +Doing proper GC testing takes longer, so we have a special mode for doing that. +For testing garbage collection more carefully, set the `EXTRACFLAGS` +environment variable to "-DHARDMEMTESTS" for the `run-tests` script. For +example: + +```sh +$ EXTRACFLAGS="-DHARDMEMTESTS" ./run-tests +``` ### Running the benchmarks suite diff --git a/run-tests b/run-tests index dd3bfcfe..4c9a8b29 100755 --- a/run-tests +++ b/run-tests @@ -1,6 +1,7 @@ #!/bin/bash -# HOW TO USE: This is a wrapper around busted. The command-line arguments are the same. +# HOW TO USE: This is a wrapper around busted. Pass "gc" as the first argument for testing the +# garbage collector. Except for "gc", the command-line arguments are the same of busted # # EXAMPLES: # ./run-tests @@ -19,7 +20,7 @@ FLAGS=(--verbose --no-keep-going) # To speed things up, we tell the C compiler to skip optimizations. (It's OK, the CI still uses -O2) # Also, add some compiler flags to verify standard compliance. -export CFLAGS='-O0 -std=c99 -Wall -Werror -Wundef -Wno-unused' +export CFLAGS="-O0 -std=c99 -Wall -Werror -Wundef -Wno-unused $EXTRACFLAGS" if [ "$#" -eq 0 ]; then if command -v parallel >/dev/null; then