diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-11-19 21:22:36 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-11-21 11:20:20 +0000 |
| commit | c31c1b0b7447502cdda234f0f43ab793644ffe83 (patch) | |
| tree | 66ee20309617c4b61f9da9b1ecc445822807852a /syz-cluster | |
| parent | 62d19cd28b707f46963fd2af8ba42a29d9ff89d7 (diff) | |
syz-cluster: improve boot test logging
Collect trace logs and make them accessible via the web UI.
Diffstat (limited to 'syz-cluster')
| -rw-r--r-- | syz-cluster/workflow/boot-step/main.go | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/syz-cluster/workflow/boot-step/main.go b/syz-cluster/workflow/boot-step/main.go index b2001a13c..1f5236c29 100644 --- a/syz-cluster/workflow/boot-step/main.go +++ b/syz-cluster/workflow/boot-step/main.go @@ -4,11 +4,14 @@ package main import ( + "bytes" "context" "flag" "fmt" - "log" + "io" + "os" + "github.com/google/syzkaller/pkg/debugtracer" "github.com/google/syzkaller/pkg/instance" "github.com/google/syzkaller/pkg/mgrconfig" "github.com/google/syzkaller/pkg/osutil" @@ -50,10 +53,16 @@ func main() { app.Fatalf("failed to upload test result: %v", err) } - bootedFine, err := runTest(ctx, client) + output := new(bytes.Buffer) + tracer := &debugtracer.GenericTracer{ + WithTime: true, + TraceWriter: io.MultiWriter(os.Stderr, output), + } + bootedFine, err := runTest(ctx, client, tracer) if err != nil { app.Fatalf("failed to run the boot test: %v", err) } + testResult.Log = output.Bytes() if bootedFine { testResult.Result = api.TestPassed } else { @@ -79,7 +88,7 @@ const retryCount = 3 // The base config may have more VMs, but we don't need that many. const vmCount = 3 -func runTest(ctx context.Context, client *api.Client) (bool, error) { +func runTest(ctx context.Context, client *api.Client, tracer debugtracer.DebugTracer) (bool, error) { cfg, err := fuzzconfig.GenerateBase(&api.FuzzConfig{}) if err != nil { return false, err @@ -94,7 +103,7 @@ func runTest(ctx context.Context, client *api.Client) (bool, error) { var rep *report.Report for i := 0; i < retryCount; i++ { - log.Printf("starting attempt #%d", i) + tracer.Log("starting attempt #%d", i) var err error rep, err = instance.RunSmokeTest(cfg) if err != nil { @@ -102,10 +111,10 @@ func runTest(ctx context.Context, client *api.Client) (bool, error) { } else if rep == nil { return true, nil } - log.Printf("attempt failed: %q", rep.Title) + tracer.Log("attempt failed: %q", rep.Title) } if *flagFindings { - log.Printf("reporting the finding") + tracer.Log("reporting the finding") findingErr := client.UploadFinding(ctx, &api.NewFinding{ SessionID: *flagSession, TestName: *flagTestName, @@ -117,8 +126,8 @@ func runTest(ctx context.Context, client *api.Client) (bool, error) { return false, fmt.Errorf("failed to report the finding: %w", findingErr) } } else { - log.Printf("report:\n%s", rep.Report) - log.Printf("output:\n%s", rep.Output) + tracer.Log("report:\n%s", rep.Report) + tracer.Log("output:\n%s", rep.Output) } return false, nil } |
