From f847f7678c16bc5aa6b82f83bdd9a96e27e1d42d Mon Sep 17 00:00:00 2001 From: Martin Treml Date: Wed, 5 Feb 2025 12:53:51 +0100 Subject: [PATCH] Add property flag to specify an offset for the result path Part of #403 --- cmd/eval-dev-quality/cmd/evaluate.go | 7 +++++++ evaluate/evaluate.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/cmd/eval-dev-quality/cmd/evaluate.go b/cmd/eval-dev-quality/cmd/evaluate.go index 8d6d2bb5..1d129e1f 100644 --- a/cmd/eval-dev-quality/cmd/evaluate.go +++ b/cmd/eval-dev-quality/cmd/evaluate.go @@ -73,6 +73,8 @@ type Evaluate struct { Configuration string `long:"configuration" description:"Configuration file to set up an evaluation run."` // ExecutionTimeout holds the timeout for an execution. ExecutionTimeout uint `long:"execution-timeout" description:"Execution timeout for compilation and tests in minutes." default:"5"` + // RunIDOffset holds the offset increment for the run id used in creating the result folders. + RunIDOffset uint `long:"run-id-starts-at" description:"Sets the offset for the ID used in creating result folders." default:"1"` // Runs holds the number of runs to perform. Runs uint `long:"runs" description:"Number of runs to perform." default:"1"` // RunsSequential indicates that interleaved runs are disabled and runs are performed sequentially. @@ -175,6 +177,11 @@ func (command *Evaluate) Initialize(args []string) (evaluationContext *evaluate. language.DefaultExecutionTimeout = time.Duration(command.ExecutionTimeout) * time.Minute } + if command.RunIDOffset == 0 { + command.logger.Panicf("number of run-id-starts-at must be greater than zero") + } + evaluationContext.RunIDOffset = command.RunIDOffset + if command.Runs == 0 { command.logger.Panicf("number of configured runs must be greater than zero") } diff --git a/evaluate/evaluate.go b/evaluate/evaluate.go index 919e944f..3f55b000 100644 --- a/evaluate/evaluate.go +++ b/evaluate/evaluate.go @@ -38,6 +38,8 @@ type Context struct { // TestdataPath determines the testdata path where all repositories reside grouped by languages. TestdataPath string + // RunIDOffset holds the offset for folders created when running a evaluation multiple times. + RunIDOffset uint // Runs holds the number of runs to perform. Runs uint // RunsSequential indicates that interleaved runs are disabled and runs are performed sequentially.