Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions check/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ The following methods are available in Ruby test programs.
`true` if the FORM job finished within the timeout, otherwise `false`.
- `succeeded? → bool`
`true` if the FORM job finished without any problems, otherwise `false`.
- `valgrind_clean? → bool`
`true` if no unexpected Valgrind errors are found, otherwise `false`.
- `warning? → bool`
`true` if the FORM job issued a warning, otherwise `false`.
- `warning?(expected_message : string) → bool`
Expand Down
47 changes: 27 additions & 20 deletions check/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,31 @@ def runtime_error?(expected_message = nil)
end
end

# true if no unexpected Valgrind errors are found.
def valgrind_clean?
if FormTest.cfg.valgrind.nil?
return true
end

# NOTE: we ignore invalid reads in TerminateImpl(), which are intentional
# in debug builds.
@stderr !~ /Invalid read(?![^\r\n]*\R[^\r\n]*\bTerminateImpl\b)/ &&
[email protected]?("Invalid write") &&
[email protected]?("Jump to the invalid address") &&
[email protected]?("Use of uninitialised value") &&
[email protected]?("Conditional jump or move depends on uninitialised value") &&
[email protected]?("points to unaddressable byte") &&
[email protected]?("points to uninitialised byte") &&
[email protected]?("contains uninitialised byte") &&
[email protected]?("Source and destination overlap in") &&
[email protected]?("Invalid free") &&
[email protected]?("Mismatched free") &&
[email protected]?("has a fishy") &&
@stderr !~ /definitely lost: [1-9]/ &&
@stderr !~ /indirectly lost: [1-9]/ &&
@stderr !~ /possibly lost: [1-9]/
end

# true if the FORM job completed without any warnings/errors and
# the exit code was 0.
def succeeded?
Expand All @@ -808,28 +833,10 @@ def succeeded?
return true
end

@stdout += "!!! stderr is not empty"
return false
end
# Check for Valgrind errors.
ok = [email protected]?("Invalid read") &&
[email protected]?("Invalid write") &&
[email protected]?("Invalid free") &&
[email protected]?("Mismatched free") &&
[email protected]?("Use of uninitialised value") &&
[email protected]?("Conditional jump or move depends on uninitialised value") &&
[email protected]?("points to unaddressable byte") &&
[email protected]?("points to uninitialised byte") &&
[email protected]?("contains uninitialised byte") &&
[email protected]?("Source and destination overlap in memcpy") &&
[email protected]?("has a fishy") &&
@stderr !~ /definitely lost: [1-9]/ &&
@stderr !~ /indirectly lost: [1-9]/ &&
@stderr !~ /possibly lost: [1-9]/
if !ok
@stdout += "!!! Valgrind test failed"
end
return ok

return valgrind_clean?
end
false
end
Expand Down