1
0

Read kernels config outside of pew command

This commit is contained in:
dump_stack() 2018-11-17 13:17:28 +00:00
parent 4fbc303c4f
commit c781511e72

19
main.go
View File

@ -431,7 +431,7 @@ func exists(path string) bool {
return true return true
} }
func pewHandler(workPath, kcfgPath, ovrrdKrnl, binaryPath, testPath string, func pewHandler(kcfg kernelConfig, workPath, ovrrdKrnl, binary, test string,
guess bool, qemuTimeout, dockerTimeout time.Duration) (err error) { guess bool, qemuTimeout, dockerTimeout time.Duration) (err error) {
ka, err := readArtifactConfig(workPath + "/.out-of-tree.toml") ka, err := readArtifactConfig(workPath + "/.out-of-tree.toml")
@ -473,14 +473,11 @@ func pewHandler(workPath, kcfgPath, ovrrdKrnl, binaryPath, testPath string,
} }
} }
kcfg, err := readKernelConfig(kcfgPath) err = performCI(ka, kcfg, binary, test, qemuTimeout, dockerTimeout)
if err != nil { if err != nil {
return return
} }
err = performCI(ka, kcfg, binaryPath, testPath, qemuTimeout,
dockerTimeout)
if err != nil {
return return
} }
@ -499,8 +496,8 @@ func main() {
pathFlag := app.Flag("path", "Path to work directory") pathFlag := app.Flag("path", "Path to work directory")
path := pathFlag.Default(".").ExistingDir() path := pathFlag.Default(".").ExistingDir()
kcfgFlag := app.Flag("kernels", "Path to kernels config") kcfgPathFlag := app.Flag("kernels", "Path to kernels config")
kcfg := kcfgFlag.Envar("OUT_OF_TREE_KCFG").Required().ExistingFile() kcfgPath := kcfgPathFlag.Envar("OUT_OF_TREE_KCFG").Required().ExistingFile()
qemuTimeoutFlag := app.Flag("qemu-timeout", "Timeout for qemu") qemuTimeoutFlag := app.Flag("qemu-timeout", "Timeout for qemu")
qemuTimeout := qemuTimeoutFlag.Default("1m").Duration() qemuTimeout := qemuTimeoutFlag.Default("1m").Duration()
@ -521,10 +518,14 @@ func main() {
pewTestFlag := pewCommand.Flag("test", "Override path test") pewTestFlag := pewCommand.Flag("test", "Override path test")
pewTest := pewTestFlag.String() pewTest := pewTestFlag.String()
var err error kcfg, err := readKernelConfig(*kcfgPath)
if err != nil {
return
}
switch kingpin.MustParse(app.Parse(os.Args[1:])) { switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case pewCommand.FullCommand(): case pewCommand.FullCommand():
err = pewHandler(*path, *kcfg, *pewKernel, *pewBinary, err = pewHandler(kcfg, *path, *pewKernel, *pewBinary,
*pewTest, *pewGuess, *qemuTimeout, *dockerTimeout) *pewTest, *pewGuess, *qemuTimeout, *dockerTimeout)
} }