Browse Source

Flag for number of runs per each kernel

tags/v1.0.0
dump_stack() 1 year ago
parent
commit
085690697d
Signed by: Mikhail Klementev <blame@dumpstack.io> GPG Key ID: BE44DA8C062D87DC
2 changed files with 18 additions and 7 deletions
  1. 7
    1
      main.go
  2. 11
    6
      pew.go

+ 7
- 1
main.go View File

@@ -114,9 +114,15 @@ func main() {

dockerTimeoutFlag := app.Flag("docker-timeout", "Timeout for docker")
dockerTimeout := dockerTimeoutFlag.Default("1m").Duration()

pewCommand := app.Command("pew", "Build, run and test module/exploit")

pewMax := pewCommand.Flag("max", "Test no more than X kernels").
PlaceHolder("X").Default(fmt.Sprint(KERNELS_ALL)).Int64()

pewRuns := pewCommand.Flag("runs", "Runs per each kernel").
Default("1").Int64()

pewKernelFlag := pewCommand.Flag("kernel", "Override kernel regex")
pewKernel := pewKernelFlag.String()

@@ -249,7 +255,7 @@ func main() {
case pewCommand.FullCommand():
err = pewHandler(kcfg, *path, *pewKernel, *pewBinary,
*pewTest, *pewGuess, *qemuTimeout, *dockerTimeout,
*pewMax, *pewDist, *pewTag, *pewThreads, db)
*pewMax, *pewRuns, *pewDist, *pewTag, *pewThreads, db)
case kernelListCommand.FullCommand():
err = kernelListHandler(kcfg)
case kernelAutogenCommand.FullCommand():

+ 11
- 6
pew.go View File

@@ -373,7 +373,8 @@ func shuffleKernels(a []config.KernelInfo) []config.KernelInfo {

func performCI(ka config.Artifact, kcfg config.KernelConfig, binaryPath,
testPath string, qemuTimeout, dockerTimeout time.Duration,
max int64, dist, tag string, threads int, db *sql.DB) (err error) {
max, runs int64, dist, tag string, threads int,
db *sql.DB) (err error) {

found := false

@@ -392,9 +393,12 @@ func performCI(ka config.Artifact, kcfg config.KernelConfig, binaryPath,
if supported {
found = true
max -= 1
swg.Add()
go whatever(&swg, ka, kernel, binaryPath, testPath,
qemuTimeout, dockerTimeout, dist, tag, db)
for i := int64(0); i < runs; i++ {
swg.Add()
go whatever(&swg, ka, kernel, binaryPath,
testPath, qemuTimeout, dockerTimeout,
dist, tag, db)
}
}
}
swg.Wait()
@@ -448,7 +452,8 @@ func genAllKernels() (sk []config.KernelMask, err error) {
func pewHandler(kcfg config.KernelConfig,
workPath, ovrrdKrnl, binary, test string, guess bool,
qemuTimeout, dockerTimeout time.Duration,
max int64, dist, tag string, threads int, db *sql.DB) (err error) {
max, runs int64, dist, tag string, threads int,
db *sql.DB) (err error) {

ka, err := config.ReadArtifactConfig(workPath + "/.out-of-tree.toml")
if err != nil {
@@ -477,7 +482,7 @@ func pewHandler(kcfg config.KernelConfig,
}

err = performCI(ka, kcfg, binary, test, qemuTimeout, dockerTimeout,
max, dist, tag, threads, db)
max, runs, dist, tag, threads, db)
if err != nil {
return
}

Loading…
Cancel
Save