this repo has no description

Run with Valgrind

authored by bernsteinbear.com and committed by

Max Bernstein 1ee64ffb bdcbb1cf

+12 -1
+6
.github/workflows/ci.yml
··· 45 45 run: sudo apt install --yes ${{matrix.PYTHON}} 46 46 - name: Install compiler 47 47 run: sudo apt install --yes ${{matrix.CC}} 48 + - name: Install Valgrind 49 + run: sudo apt install --yes valgrind 48 50 - name: Run interpreter tests 49 51 run: ${{matrix.PYTHON}} scrapscript.py test 50 52 - name: Run compiler tests ··· 59 61 run: CC=${{matrix.CC}} CFLAGS=-fsanitize=undefined ${{matrix.PYTHON}} compiler_tests.py 60 62 - name: Run compiler tests with static heap with UBSAN 61 63 run: CC=${{matrix.CC}} CFLAGS="-DSTATIC_HEAP -fsanitize=undefined" ${{matrix.PYTHON}} compiler_tests.py 64 + - name: Run compiler tests with Valgrind 65 + run: CC=${{matrix.CC}} USE_VALGRIND=1 ${{matrix.PYTHON}} compiler_tests.py 66 + - name: Run compiler tests with static heap with Valgrind 67 + run: CC=${{matrix.CC}} CFLAGS="-DSTATIC_HEAP" USE_VALGRIND=1 ${{matrix.PYTHON}} compiler_tests.py 62 68 build_docker_image: 63 69 runs-on: ubuntu-latest 64 70 permissions:
+6 -1
compiler_tests.py
··· 29 29 30 30 class CompilerEndToEndTests(unittest.TestCase): 31 31 def _run(self, code: str) -> str: 32 + use_valgrind = bool(os.environ.get("USE_VALGRIND", False)) 32 33 binary = compile_to_binary(code, memory=4096, debug=True) 33 - result = subprocess.run(binary, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True) 34 + if use_valgrind: 35 + cmd = ["valgrind", binary] 36 + else: 37 + cmd = [binary] 38 + result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True) 34 39 return result.stdout 35 40 36 41 def test_int(self) -> None: