A corpus program that is not idempotent looks exactly like a tool finding
This commit is contained in:
parent
c2df38e139
commit
3a91c7ef06
@ -122,12 +122,38 @@ let summary text =
|
||||
|
||||
let suppressed_total = ref 0
|
||||
|
||||
(* Files a corpus program leaves in the working directory, cleared before
|
||||
*every* run of it.
|
||||
|
||||
Not housekeeping: two of these programs are not idempotent, and running one
|
||||
twice — which is precisely what this harness does, once plain and once
|
||||
under memcheck — makes the second run print something different from the
|
||||
first. slurp.flan is the case that found it. Its last section sets up a
|
||||
missing file, expects the handler to fire, and has the handler barf the
|
||||
file into existence and invoke retry; on a second run the file is already
|
||||
there, slurp succeeds first time, and the handler count prints 0 where the
|
||||
first run printed 1. That looks exactly like "the program behaves
|
||||
differently under memcheck" and is nothing of the kind — measured by
|
||||
running it twice with no valgrind anywhere near it, which reproduces the 0.
|
||||
|
||||
test_acceptance.ml removes the same two names for the same reason; this is
|
||||
that list, not a new fact about the corpus. It matters here and not in
|
||||
test_sanitize.ml only because slurp.flan is in this sweep's corpus and not
|
||||
in that one's. *)
|
||||
let artifacts =
|
||||
[ "slurp-out.txt"; "slurp-made.txt"; "web-files-out.txt" ]
|
||||
|
||||
let clean () =
|
||||
List.iter (fun f -> try Sys.remove f with Sys_error _ -> ()) artifacts
|
||||
|
||||
(* One program, both ways. *)
|
||||
let check label path args ~checks =
|
||||
match compile ~checks path with
|
||||
| exception Failure m -> fail "%s %s: build: %s" label path m
|
||||
| exe ->
|
||||
clean ();
|
||||
let c1, t1, _ = run exe args in
|
||||
clean ();
|
||||
let c2, t2, log = run ~vg:true exe args in
|
||||
(match summary log with
|
||||
| None ->
|
||||
@ -140,6 +166,7 @@ let check label path args ~checks =
|
||||
fail "%s %s: diverged under memcheck\n \
|
||||
plain (exit %d): %S\n memcheck (exit %d): %S"
|
||||
label path c1 t1 c2 t2;
|
||||
clean ();
|
||||
(try Sys.remove exe with Sys_error _ -> ())
|
||||
|
||||
(* The corpus. This list is *larger* than @sanitize's, deliberately: that one
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user