2 Commits
Author SHA1 Message Date
josh 75c2a4cbdf Install valgrind for Linux github runners 2026-07-08 22:09:53 -04:00
josh 2c8ce0a359 Skip valgrind tests on MacOS github runners 2026-07-08 20:01:29 -04:00
2 changed files with 12 additions and 8 deletions

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
steps: steps:
- name: Install dependencies (Linux) - name: Install dependencies (Linux)
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y gcc gdc ldc run: sudo apt-get update && sudo apt-get install -y gcc gdc ldc valgrind
- name: Install dependencies (macOS) - name: Install dependencies (macOS)
if: runner.os == 'macOS' if: runner.os == 'macOS'
+11 -7
View File
@@ -95,13 +95,17 @@ EOF
File.binwrite("spec/run/.stdout", stdout) File.binwrite("spec/run/.stdout", stdout)
stderr.sub!(/^.*modules passed unittests\n/, "") stderr.sub!(/^.*modules passed unittests\n/, "")
results = Results.new(stdout, stderr, status) results = Results.new(stdout, stderr, status)
stdout, stderr, status = Open3.capture3("valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose spec/run/testparser") # Valgrind is only reliably available on Linux, so limit the leak check to
vgout = stdout + stderr # Linux platforms.
File.binwrite("spec/run/.vgout", vgout) if RUBY_PLATFORM =~ /linux/
vgout.scan(/(?:definitely|indirectly) lost: (\d+) bytes/) do |match| stdout, stderr, status = Open3.capture3("valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose spec/run/testparser")
bytes = $1.to_i vgout = stdout + stderr
if bytes > 0 File.binwrite("spec/run/.vgout", vgout)
raise "Valgrind detected memory leak" vgout.scan(/(?:definitely|indirectly) lost: (\d+) bytes/) do |match|
bytes = $1.to_i
if bytes > 0
raise "Valgrind detected memory leak"
end
end end
end end
results results