feat(verify): combine ABI checks with fuzzing for deep-path testing
This commit is contained in:
+22
-9
@@ -633,6 +633,7 @@ With -profile, the static basic-block structure is listed for each function.
|
||||
`)
|
||||
smoke := fs.Bool("smoke", false, "call each NOSPLIT function with zeroed args")
|
||||
abi := fs.Bool("abi", false, "run ABI-checking calls (sentinel registers + red zone)")
|
||||
abiN := fs.Int("abi-n", 100, "number of ABI check iterations with varied inputs")
|
||||
profile := fs.Bool("profile", false, "list basic-block structure per function")
|
||||
groundTruth := fs.Bool("ground-truth", false, "compare machine code byte-for-byte against go tool asm")
|
||||
fuzz := fs.Bool("fuzz", false, "differential fuzz: JIT both gasm and go-tool-asm versions, compare outputs")
|
||||
@@ -823,16 +824,28 @@ With -profile, the static basic-block structure is listed for each function.
|
||||
}
|
||||
|
||||
if *abi && fl.NoSplit {
|
||||
args := make([]byte, fl.Args)
|
||||
_, report, err := k.CallFuncChecked(name, args)
|
||||
if err != nil {
|
||||
fmt.Printf(" abi: FAIL — %v\n", err)
|
||||
rc = 1
|
||||
} else if !report.OK() {
|
||||
fmt.Printf(" abi: %s\n", report)
|
||||
rc = 1
|
||||
// Try varied-input ABI fuzzing first.
|
||||
if src, err := readSource(path); err == nil {
|
||||
result := k.FuzzFuncCheckedByName(name, src, *abiN, int64(*abiN))
|
||||
if result.Mismatches > 0 {
|
||||
fmt.Printf(" abi: %s\n", result)
|
||||
rc = 1
|
||||
} else {
|
||||
fmt.Printf(" abi: clean (%d varied inputs)\n", result.Matches)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf(" abi: clean\n")
|
||||
// Fallback: single zeroed-arg call.
|
||||
args := make([]byte, fl.Args)
|
||||
_, report, err := k.CallFuncChecked(name, args)
|
||||
if err != nil {
|
||||
fmt.Printf(" abi: FAIL — %v\n", err)
|
||||
rc = 1
|
||||
} else if !report.OK() {
|
||||
fmt.Printf(" abi: %s\n", report)
|
||||
rc = 1
|
||||
} else {
|
||||
fmt.Printf(" abi: clean\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user