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)/ &&
!@stderr.include?("Invalid write") &&
!@stderr.include?("Jump to the invalid address") &&
!@stderr.include?("Use of uninitialised value") &&
!@stderr.include?("Conditional jump or move depends on uninitialised value") &&
!@stderr.include?("points to unaddressable byte") &&
!@stderr.include?("points to uninitialised byte") &&
!@stderr.include?("contains uninitialised byte") &&
!@stderr.include?("Source and destination overlap in") &&
!@stderr.include?("Invalid free") &&
!@stderr.include?("Mismatched free") &&
!@stderr.include?("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 = !@stderr.include?("Invalid read") &&
!@stderr.include?("Invalid write") &&
!@stderr.include?("Invalid free") &&
!@stderr.include?("Mismatched free") &&
!@stderr.include?("Use of uninitialised value") &&
!@stderr.include?("Conditional jump or move depends on uninitialised value") &&
!@stderr.include?("points to unaddressable byte") &&
!@stderr.include?("points to uninitialised byte") &&
!@stderr.include?("contains uninitialised byte") &&
!@stderr.include?("Source and destination overlap in memcpy") &&
!@stderr.include?("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