mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 11:30:15 +00:00
31 lines
489 B
Go
31 lines
489 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func FuzzValidateCommand(f *testing.F) {
|
|
seeds := []string{
|
|
"sensors -j",
|
|
"ipmitool sdr",
|
|
"sensors",
|
|
"ipmitool lan print",
|
|
}
|
|
for _, seed := range seeds {
|
|
f.Add(seed)
|
|
}
|
|
|
|
f.Fuzz(func(t *testing.T, input string) {
|
|
fields := strings.Fields(input)
|
|
if len(fields) == 0 {
|
|
return
|
|
}
|
|
cmd := fields[0]
|
|
args := []string{}
|
|
if len(fields) > 1 {
|
|
args = fields[1:]
|
|
}
|
|
validateCommand(cmd, args) // ensure no panics
|
|
})
|
|
}
|