From b8793b80c86a1ef28adba22c14309d968bc4fc27 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 4 Feb 2025 18:42:21 +0100 Subject: 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. --- syz-cluster/workflow/fuzz-step/main.go | 12 ++++++++---- 1 file 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 } -- cgit mrf-deployment