From df37c7f1199ac2f4e3aff7bf2cbfb9a56d8eef41 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 30 May 2023 15:14:09 +0200 Subject: dashboard: amend configs during tree origin testing There are cases when e.g. an LTS kernel does not build if provided with some downstream kernel config. Introduce a special AppendConfig option to KernelRepo that can help in this case. --- dashboard/app/config.go | 2 ++ dashboard/app/jobs.go | 15 ++++++++++++- dashboard/app/tree.go | 1 + dashboard/app/tree_test.go | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) diff --git a/dashboard/app/config.go b/dashboard/app/config.go index 7c968ff0c..79304af77 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -254,6 +254,8 @@ type KernelRepo struct { CommitInflow []KernelRepoLink // Enable the missing backport tracking feature for this tree. DetectMissingBackports bool + // Append this string to the config file before running reproducers on this tree. + AppendConfig string } type KernelRepoLink struct { diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index b0d9a5e68..6c2abfcb0 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -89,6 +89,7 @@ type testJobArgs struct { crash *Crash crashKey *db.Key configRef int64 + configAppend string treeOrigin bool inTransaction bool testReqArgs @@ -109,6 +110,18 @@ func addTestJob(c context.Context, args *testJobArgs) (*Job, *db.Key, error) { if err != nil { return nil, nil, err } + configRef := args.configRef + if args.configAppend != "" { + kernelConfig, _, err := getText(c, textKernelConfig, configRef) + if err != nil { + return nil, nil, err + } + configRef, err = putText(c, args.bug.Namespace, textKernelConfig, + append(kernelConfig, []byte(args.configAppend)...), true) + if err != nil { + return nil, nil, err + } + } reportingName := "" if args.bugReporting != nil { reportingName = args.bugReporting.Name @@ -130,7 +143,7 @@ func addTestJob(c context.Context, args *testJobArgs) (*Job, *db.Key, error) { MergeBaseRepo: args.mergeBaseRepo, MergeBaseBranch: args.mergeBaseBranch, Patch: patchID, - KernelConfig: args.configRef, + KernelConfig: configRef, TreeOrigin: args.treeOrigin, } diff --git a/dashboard/app/tree.go b/dashboard/app/tree.go index e6ee6cc26..6e1b1e9d0 100644 --- a/dashboard/app/tree.go +++ b/dashboard/app/tree.go @@ -431,6 +431,7 @@ func (ctx *bugTreeContext) doRunRepro(repo KernelRepo, result expectedResult, ru crash: ctx.crash, crashKey: ctx.crashKey, configRef: ctx.build.KernelConfig, + configAppend: repo.AppendConfig, inTransaction: true, treeOrigin: true, testReqArgs: testReqArgs{ diff --git a/dashboard/app/tree_test.go b/dashboard/app/tree_test.go index 8ffcfdc07..30637c91b 100644 --- a/dashboard/app/tree_test.go +++ b/dashboard/app/tree_test.go @@ -633,6 +633,55 @@ var downstreamUpstreamBackports = []KernelRepo{ }, } +func TestTreeConfigAppend(t *testing.T) { + c := NewCtx(t) + defer c.Close() + + ctx := setUpTreeTest(c, []KernelRepo{ + { + URL: `https://downstream.repo/repo`, + Branch: `master`, + Alias: `downstream`, + CommitInflow: []KernelRepoLink{ + { + Alias: `lts`, + Merge: true, + }, + }, + LabelIntroduced: `downstream`, + }, + { + URL: `https://lts.repo/repo`, + Branch: `lts-master`, + Alias: `lts`, + LabelIntroduced: `lts`, + AppendConfig: "\nCONFIG_TEST=y", + }, + }) + ctx.uploadBug(`https://downstream.repo/repo`, `master`, dashapi.ReproLevelC) + ctx.entries = []treeTestEntry{ + { + alias: `downstream`, + results: []treeTestEntryPeriod{{fromDay: 0, result: treeTestCrash}}, + }, + { + alias: `lts`, + mergeAlias: `downstream`, + results: []treeTestEntryPeriod{{fromDay: 0, result: treeTestCrash}}, + }, + } + ctx.jobTestDays = []int{10} + tested := false + ctx.validateJob = func(resp *dashapi.JobPollResp) { + if resp.KernelBranch == "lts-master" { + tested = true + assert.Contains(t, string(resp.KernelConfig), "\nCONFIG_TEST=y") + } + } + ctx.moveToDay(10) + assert.True(t, tested) +} + func setUpTreeTest(ctx *Ctx, repos []KernelRepo) *treeTestCtx { ret := &treeTestCtx{ ctx: ctx, @@ -653,6 +702,7 @@ type treeTestCtx struct { perAlias map[string]KernelRepo jobTestDays []int manager string + validateJob func(*dashapi.JobPollResp) } func (ctx *treeTestCtx) now() time.Time { @@ -728,6 +778,9 @@ func (ctx *treeTestCtx) moveToDay(tillDay int) { if pollResp.ID == "" { break } + if ctx.validateJob != nil { + ctx.validateJob(pollResp) + } ctx.ctx.advanceTime(time.Minute) ctx.doJob(pollResp, seqDay) } -- cgit mrf-deployment