Flag for number of runs per each kernel
This commit is contained in:
parent
574d5d45c3
commit
085690697d
8
main.go
8
main.go
@ -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():
|
||||
|
17
pew.go
17
pew.go
@ -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…
Reference in New Issue
Block a user