Exemplo n.º 1
0
// Test the previous issues found by smat.
func TestSmatHits(t *testing.T) {
	smatDebugPrev := smatDebug
	smatDebug = true // Use true when diagnosing a crash.

	for i := 0; i < len(smatHits); i += 2 {
		desc := smatHits[i]
		hit := []byte(smatHits[i+1])

		log.Printf("testing smat hit: (%d) %s\n", i/2, desc)

		// fuzz the hit input
		smat.Fuzz(&smatContext{}, smat.ActionID('S'), smat.ActionID('T'),
			smatActionMap, hit)
	}

	smatDebug = smatDebugPrev
}
Exemplo n.º 2
0
// Test the previous crashers found by smat.
func TestSmatCrashers(t *testing.T) {
	smatDebugPrev := smatDebug
	smatDebug = false // Use true when diagnosing a crash.

	// smat.Logger = log.New(os.Stderr, "smat ", log.LstdFlags)

	for i := 0; i < len(smatCrashers); i += 2 {
		desc := smatCrashers[i]
		crasher := []byte(smatCrashers[i+1])

		log.Printf("testing smat crasher: (%d) %s", i/2, desc)

		// fuzz the crasher input
		smat.Fuzz(&smatContext{}, smat.ActionID('S'), smat.ActionID('T'),
			actionMap, crasher)
	}

	smatDebug = smatDebugPrev
}
Exemplo n.º 3
0
// fuzz test using state machine driven by byte stream.
func Fuzz(data []byte) int {
	return smat.Fuzz(&smatContext{}, smat.ActionID('S'), smat.ActionID('T'),
		actionMap, data)
}
Exemplo n.º 4
0
// Fuzz using state machine driven by byte stream
func Fuzz(data []byte) int {
	return smat.Fuzz(&context{}, setup, teardown, actionMap, data)
}