diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-02-04 18:42:21 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-02-04 19:04:54 +0000 |
| commit | b8793b80c86a1ef28adba22c14309d968bc4fc27 (patch) | |
| tree | b9b079b780d0dc75567fd75eabe76abd50b6896b | |
| parent | 02af57a28186dadf4e0faf263aa63d5ceafccbd6 (diff) | |
syz-cluster/workflow/fuzz-step: use deadline only for fuzzing
We cannot use the single context with a deadline for all processing
because it does not let us report the final status after finishing
fuzzing.
| -rw-r--r-- | syz-cluster/workflow/fuzz-step/main.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/syz-cluster/workflow/fuzz-step/main.go b/syz-cluster/workflow/fuzz-step/main.go index 3876e6918..4a07d2718 100644 --- a/syz-cluster/workflow/fuzz-step/main.go +++ b/syz-cluster/workflow/fuzz-step/main.go @@ -6,6 +6,7 @@ package main import ( "context" "encoding/json" + "errors" "flag" "fmt" "path/filepath" @@ -48,14 +49,17 @@ func main() { if !prog.GitRevisionKnown() { log.Fatalf("the binary is built without the git revision information") } - ctx, cancel := context.WithTimeout(context.Background(), d) - defer cancel() + ctx := context.Background() if err := reportStatus(ctx, client, api.TestRunning); err != nil { app.Fatalf("failed to report the test: %v", err) } - err = run(ctx, client) + // We want to only cancel the run() operation in order to be able to also report + // the final test result back. + runCtx, cancel := context.WithTimeout(context.Background(), d) + defer cancel() + err = run(runCtx, client) status := api.TestPassed // TODO: what about TestFailed? - if err != nil { + if err != nil && !errors.Is(err, context.DeadlineExceeded) { app.Errorf("the step failed: %v", err) status = api.TestError } |
