mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-29 11:44:53 +01:00
Add TestLog call to help debug mysterious timeouts for certain fuzz tests
This commit is contained in:
parent
81081073a3
commit
a2d8a1065b
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -21,6 +22,7 @@ var tmp int = 0
|
|||||||
var runCounter *int = &tmp
|
var runCounter *int = &tmp
|
||||||
|
|
||||||
func fuzzTest(t *testing.T, tester shellTester, input string) {
|
func fuzzTest(t *testing.T, tester shellTester, input string) {
|
||||||
|
testutils.TestLog(t, fmt.Sprintf("Starting fuzz test for input=%#v", input))
|
||||||
*runCounter += 1
|
*runCounter += 1
|
||||||
// Parse the input
|
// Parse the input
|
||||||
if len(input) > 1_000 {
|
if len(input) > 1_000 {
|
||||||
@ -76,6 +78,7 @@ func fuzzTest(t *testing.T, tester shellTester, input string) {
|
|||||||
|
|
||||||
// Run the commands
|
// Run the commands
|
||||||
for _, op := range ops {
|
for _, op := range ops {
|
||||||
|
testutils.TestLog(t, fmt.Sprintf("Running op=%#v", op))
|
||||||
// Run the command
|
// Run the command
|
||||||
switchToDevice(&devices, op.device)
|
switchToDevice(&devices, op.device)
|
||||||
if op.cmd != "" {
|
if op.cmd != "" {
|
||||||
@ -117,6 +120,7 @@ func fuzzTest(t *testing.T, tester shellTester, input string) {
|
|||||||
if diff := cmp.Diff(expectedOutput, out); diff != "" {
|
if diff := cmp.Diff(expectedOutput, out); diff != "" {
|
||||||
t.Fatalf("hishtory export mismatch for input=%#v key=%s (-expected +got):\n%s\nout=%#v", input, op.device.key, diff, out)
|
t.Fatalf("hishtory export mismatch for input=%#v key=%s (-expected +got):\n%s\nout=%#v", input, op.device.key, diff, out)
|
||||||
}
|
}
|
||||||
|
testutils.TestLog(t, fmt.Sprintf("Finished running op=%#v", op))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that hishtory export has the expected results
|
// Check that hishtory export has the expected results
|
||||||
@ -129,6 +133,8 @@ func fuzzTest(t *testing.T, tester shellTester, input string) {
|
|||||||
t.Fatalf("hishtory export mismatch for key=%s (-expected +got):\n%s\nout=%#v", op.device.key, diff, out)
|
t.Fatalf("hishtory export mismatch for key=%s (-expected +got):\n%s\nout=%#v", op.device.key, diff, out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testutils.TestLog(t, fmt.Sprintf("Finished fuzz test for input=%#v", input))
|
||||||
}
|
}
|
||||||
|
|
||||||
func FuzzTestMultipleUsers(f *testing.F) {
|
func FuzzTestMultipleUsers(f *testing.F) {
|
||||||
|
Loading…
Reference in New Issue
Block a user