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")
|
dockerTimeoutFlag := app.Flag("docker-timeout", "Timeout for docker")
|
||||||
dockerTimeout := dockerTimeoutFlag.Default("1m").Duration()
|
dockerTimeout := dockerTimeoutFlag.Default("1m").Duration()
|
||||||
|
|
||||||
pewCommand := app.Command("pew", "Build, run and test module/exploit")
|
pewCommand := app.Command("pew", "Build, run and test module/exploit")
|
||||||
|
|
||||||
pewMax := pewCommand.Flag("max", "Test no more than X kernels").
|
pewMax := pewCommand.Flag("max", "Test no more than X kernels").
|
||||||
PlaceHolder("X").Default(fmt.Sprint(KERNELS_ALL)).Int64()
|
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")
|
pewKernelFlag := pewCommand.Flag("kernel", "Override kernel regex")
|
||||||
pewKernel := pewKernelFlag.String()
|
pewKernel := pewKernelFlag.String()
|
||||||
|
|
||||||
@ -249,7 +255,7 @@ func main() {
|
|||||||
case pewCommand.FullCommand():
|
case pewCommand.FullCommand():
|
||||||
err = pewHandler(kcfg, *path, *pewKernel, *pewBinary,
|
err = pewHandler(kcfg, *path, *pewKernel, *pewBinary,
|
||||||
*pewTest, *pewGuess, *qemuTimeout, *dockerTimeout,
|
*pewTest, *pewGuess, *qemuTimeout, *dockerTimeout,
|
||||||
*pewMax, *pewDist, *pewTag, *pewThreads, db)
|
*pewMax, *pewRuns, *pewDist, *pewTag, *pewThreads, db)
|
||||||
case kernelListCommand.FullCommand():
|
case kernelListCommand.FullCommand():
|
||||||
err = kernelListHandler(kcfg)
|
err = kernelListHandler(kcfg)
|
||||||
case kernelAutogenCommand.FullCommand():
|
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,
|
func performCI(ka config.Artifact, kcfg config.KernelConfig, binaryPath,
|
||||||
testPath string, qemuTimeout, dockerTimeout time.Duration,
|
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
|
found := false
|
||||||
|
|
||||||
@ -392,9 +393,12 @@ func performCI(ka config.Artifact, kcfg config.KernelConfig, binaryPath,
|
|||||||
if supported {
|
if supported {
|
||||||
found = true
|
found = true
|
||||||
max -= 1
|
max -= 1
|
||||||
swg.Add()
|
for i := int64(0); i < runs; i++ {
|
||||||
go whatever(&swg, ka, kernel, binaryPath, testPath,
|
swg.Add()
|
||||||
qemuTimeout, dockerTimeout, dist, tag, db)
|
go whatever(&swg, ka, kernel, binaryPath,
|
||||||
|
testPath, qemuTimeout, dockerTimeout,
|
||||||
|
dist, tag, db)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
swg.Wait()
|
swg.Wait()
|
||||||
@ -448,7 +452,8 @@ func genAllKernels() (sk []config.KernelMask, err error) {
|
|||||||
func pewHandler(kcfg config.KernelConfig,
|
func pewHandler(kcfg config.KernelConfig,
|
||||||
workPath, ovrrdKrnl, binary, test string, guess bool,
|
workPath, ovrrdKrnl, binary, test string, guess bool,
|
||||||
qemuTimeout, dockerTimeout time.Duration,
|
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")
|
ka, err := config.ReadArtifactConfig(workPath + "/.out-of-tree.toml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -477,7 +482,7 @@ func pewHandler(kcfg config.KernelConfig,
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = performCI(ka, kcfg, binary, test, qemuTimeout, dockerTimeout,
|
err = performCI(ka, kcfg, binary, test, qemuTimeout, dockerTimeout,
|
||||||
max, dist, tag, threads, db)
|
max, runs, dist, tag, threads, db)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user