Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion syz-cluster/pkg/db/stats_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (repo *StatsRepository) SessionStatusPerWeek(ctx context.Context) (
SQL: `WITH SessionTestAggregates AS (
SELECT
SessionID,
COUNTIF(Result = 'failed') > 0 AS HasFailedSteps,
COUNTIF(Result = 'error') > 0 AS HasFailedSteps,
COUNTIF(Result = 'skipped') > 0 AS HasSkippedSteps
FROM SessionTests
GROUP BY SessionID
Expand Down
45 changes: 27 additions & 18 deletions syz-cluster/workflow/build-step/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ func main() {
ret := &BuildResult{}
if err != nil {
log.Printf("failed to checkout: %v", err)
uploadReq.Log = []byte(err.Error())
reportResults(ctx, client, nil, nil, []byte(err.Error()))
return
} else {
if *flagSmokeBuild {
skip, err := alreadyBuilt(ctx, client, uploadReq)
Expand All @@ -95,7 +96,8 @@ func main() {
ret, err = buildKernel(tracer, req)
if err != nil {
log.Printf("build process failed: %v", err)
uploadReq.Log = []byte(err.Error())
reportResults(ctx, client, nil, nil, []byte(err.Error()))
return
} else {
uploadReq.Compiler = ret.Compiler
uploadReq.Config = ret.Config
Expand All @@ -108,38 +110,45 @@ func main() {
}
}
}
reportResults(ctx, client, req.SeriesID != "", uploadReq, ret.Finding, output.Bytes())
reportResults(ctx, client, uploadReq, ret.Finding, output.Bytes())
}

func reportResults(ctx context.Context, client *api.Client, patched bool,
func reportResults(ctx context.Context, client *api.Client,
uploadReq *api.UploadBuildReq, finding *api.NewFinding, output []byte) {
buildInfo, err := client.UploadBuild(ctx, uploadReq)
if err != nil {
app.Fatalf("failed to upload build: %v", err)
var buildID string
status := api.TestPassed
if uploadReq != nil {
if !uploadReq.BuildSuccess {
status = api.TestFailed
}
buildInfo, err := client.UploadBuild(ctx, uploadReq)
if err != nil {
app.Fatalf("failed to upload build: %v", err)
}
log.Printf("uploaded build, reply: %q", buildInfo)
buildID = buildInfo.ID
} else {
status = api.TestError
}
log.Printf("uploaded build, reply: %q", buildInfo)
osutil.WriteJSON(filepath.Join(*flagOutput, "result.json"), &api.BuildResult{
BuildID: buildInfo.ID,
Success: uploadReq.BuildSuccess,
BuildID: buildID,
Success: status == api.TestPassed,
})
if *flagSmokeBuild {
return
}
testResult := &api.TestResult{
SessionID: *flagSession,
TestName: *flagTestName,
Result: api.TestFailed,
Result: status,
Log: output,
}
if uploadReq.BuildSuccess {
testResult.Result = api.TestPassed
}
if patched {
testResult.PatchedBuildID = buildInfo.ID
if uploadReq.SeriesID != "" {
testResult.PatchedBuildID = buildID
} else {
testResult.BaseBuildID = buildInfo.ID
testResult.BaseBuildID = buildID
}
err = client.UploadTestResult(ctx, testResult)
err := client.UploadTestResult(ctx, testResult)
if err != nil {
app.Fatalf("failed to report the test result: %v", err)
}
Expand Down
Loading