diff --git a/mantle/cmd/kola/testiso.go b/mantle/cmd/kola/testiso.go index e5c991fca8..7086b58c5b 100644 --- a/mantle/cmd/kola/testiso.go +++ b/mantle/cmd/kola/testiso.go @@ -729,7 +729,47 @@ func awaitCompletion(ctx context.Context, inst *platform.QemuInstance, outdir st } }() err := <-errchan - return time.Since(start), err + elapsed := time.Since(start) + if err == nil { + // No error so far, check the console and journal files + consoleFile := filepath.Join(outdir, "console.txt") + journalFile := filepath.Join(outdir, "journal.txt") + files := []string{consoleFile, journalFile} + for _, file := range files { + fileName := filepath.Base(file) + // Check if the file exists + _, err := os.Stat(file) + if os.IsNotExist(err) { + fmt.Printf("The file: %v does not exist\n", fileName) + continue + } else if err != nil { + fmt.Println(err) + return elapsed, err + } + // Read the contents of the file + fileContent, err := os.ReadFile(file) + if err != nil { + fmt.Println(err) + return elapsed, err + } + // Check for badness with CheckConsole + warnOnly, badlines := kola.CheckConsole([]byte(fileContent), nil) + if len(badlines) > 0 { + for _, badline := range badlines { + if warnOnly { + plog.Errorf("bad log line detected: %v", badline) + } else { + plog.Warningf("bad log line detected: %v", badline) + } + } + if !warnOnly { + err = fmt.Errorf("errors found in log files") + return elapsed, err + } + } + } + } + return elapsed, err } func printResult(test string, duration time.Duration, err error) bool {