diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2024-05-07 17:04:45 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-05-16 15:38:27 +0000 |
| commit | b6954dce2f21b8feb1448edaaeeefc22f5ff4944 (patch) | |
| tree | 6f4358ba6609826b614847707e180662d986f98e /pkg/vminfo/linux_test.go | |
| parent | f694ecdc179cf43429135188934eed687ae28645 (diff) | |
pkg/vminfo: run programs interactively
Use the same interfaces as the fuzzer.
Now syz-manager no longer needs to treat machine check executions
differently.
Diffstat (limited to 'pkg/vminfo/linux_test.go')
| -rw-r--r-- | pkg/vminfo/linux_test.go | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/pkg/vminfo/linux_test.go b/pkg/vminfo/linux_test.go index e9be133c1..2a09a66cf 100644 --- a/pkg/vminfo/linux_test.go +++ b/pkg/vminfo/linux_test.go @@ -21,14 +21,6 @@ import ( func TestLinuxSyscalls(t *testing.T) { cfg := testConfig(t, targets.Linux, targets.AMD64) checker := New(cfg) - _, checkProgs := checker.StartCheck() - t.Logf("got %v test programs", len(checkProgs)) - if len(checkProgs) > 1000 { - // This is just a sanity check that we don't do something stupid accidentally. - // If it grows above the limit intentionally, the limit can be increased. - // Currently we have 641 (when we failed to properly dedup syscall tests, it was 4349). - t.Fatal("too many test programs") - } filesystems := []string{ // Without sysfs, the checks would also disable mount(). "", "sysfs", "ext4", "binder", "", @@ -45,8 +37,10 @@ func TestLinuxSyscalls(t *testing.T) { Data: []byte(strings.Join(filesystems, "\nnodev\t")), }, } - results, featureInfos := createSuccessfulResults(t, cfg.Target, checkProgs) - enabled, disabled, features, err := checker.FinishCheck(files, results, featureInfos) + stop := make(chan struct{}) + go createSuccessfulResults(checker, stop) + enabled, disabled, features, err := checker.Run(files, allFeatures()) + close(stop) if err != nil { t.Fatal(err) } @@ -70,6 +64,17 @@ func TestLinuxSyscalls(t *testing.T) { } t.Errorf("disabled call %v: %v", call.Name, reason) } + for _, id := range cfg.Syscalls { + call := cfg.Target.Syscalls[id] + if enabled[call] && disabled[call] != "" { + t.Fatalf("%s is both enabled and disabled", call.Name) + } + expected := !expectDisabled[call.Name] + got := enabled[call] + if expected != got { + t.Errorf("%s: expected %t, got %t", call.Name, expected, got) + } + } expectEnabled := len(cfg.Syscalls) - len(expectDisabled) if len(enabled) != expectEnabled { t.Errorf("enabled only %v calls out of %v", len(enabled), expectEnabled) |
