From 9f9b003697ac901008affd7008c428109d1afc5e Mon Sep 17 00:00:00 2001 From: varobert Date: Wed, 4 Apr 2012 11:59:38 +0000 Subject: Better fuzzing options git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1868 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- checklink/Validator.ml | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'checklink/Validator.ml') diff --git a/checklink/Validator.ml b/checklink/Validator.ml index f91a131..c413c75 100644 --- a/checklink/Validator.ml +++ b/checklink/Validator.ml @@ -6,6 +6,7 @@ open Fuzz let elf_file = ref (None: string option) let sdump_files = ref ([] : string list) let option_fuzz = ref false +let option_bytefuzz = ref false let option_printelf = ref false let set_elf_file s = @@ -14,20 +15,24 @@ let set_elf_file s = | Some _ -> raise (Arg.Bad "multiple ELF executables given on command line") let options = [ + "-exe ", Arg.String set_elf_file, + "Specify the ELF executable file to analyze"; + "-debug", Arg.Set Check.debug, + "Print a detailed trace of verification"; + "-noexhaust", Arg.Clear Check.exhaustivity, + "Disable the exhaustivity check of ELF function and data symbols"; "-printelf", Arg.Set option_printelf, - "Print the contents of the unanalyzed ELF executable"; + "Print the contents of the unanalyzed ELF executable"; "-printelfmap", Arg.Set Check.print_elfmap, - "Print a map of the analyzed ELF executable"; - "-debug", Arg.Set Check.debug, - "Print a detailed trace of verification"; + "Print a map of the analyzed ELF executable"; "-dumpelfmap", Arg.Set Check.dump_elfmap, - "Dump an ELF map to .elfmap, for use with random fuzzing"; - "-exe ", Arg.String set_elf_file, - "Specify the ELF executable file to analyze"; + "Dump an ELF map to .elfmap, for use with random fuzzing"; "-fuzz", Arg.Set option_fuzz, - "Random fuzzing test"; - "-noexhaust", Arg.Clear Check.exhaustivity, - "Disable the exhaustivity check of ELF function and data symbols" + "Random fuzz testing"; + "-bytefuzz", Arg.Set option_bytefuzz, + "Random fuzz testing byte per byte"; + "-debugfuzz", Arg.Set Fuzz.fuzz_debug, + "Print a detailed trace of ongoing fuzz testing"; ] let anonymous arg = @@ -37,7 +42,7 @@ let anonymous arg = set_elf_file arg let usage = -"The CompCert C post-linking validator, version " ^ Configuration.version ^ " + "The CompCert C post-linking validator, version " ^ Configuration.version ^ " Usage: cchecklink [options] <.sdump files> In the absence of options, checks are performed and a short result is displayed. Options are:" @@ -50,7 +55,10 @@ let _ = exit 2 | Some elffilename -> let sdumps = List.rev !sdump_files in - if !option_fuzz then begin + if !option_bytefuzz then begin + Random.self_init(); + fuzz_every_byte_loop elffilename sdumps + end else if !option_fuzz then begin Random.self_init(); fuzz_loop elffilename sdumps end else if !option_printelf then begin -- cgit v1.2.3