@@ -729,7 +729,47 @@ func awaitCompletion(ctx context.Context, inst *platform.QemuInstance, outdir st
729729 }
730730 }()
731731 err := <- errchan
732- return time .Since (start ), err
732+ elapsed := time .Since (start )
733+ if err == nil {
734+ // No error so far, check the console and journal files
735+ consoleFile := filepath .Join (outdir , "console.txt" )
736+ journalFile := filepath .Join (outdir , "journal.txt" )
737+ files := []string {consoleFile , journalFile }
738+ for _ , file := range files {
739+ fileName := filepath .Base (file )
740+ // Check if the file exists
741+ _ , err := os .Stat (file )
742+ if os .IsNotExist (err ) {
743+ fmt .Printf ("The file: %v does not exist\n " , fileName )
744+ continue
745+ } else if err != nil {
746+ fmt .Println (err )
747+ return elapsed , err
748+ }
749+ // Read the contents of the file
750+ fileContent , err := os .ReadFile (file )
751+ if err != nil {
752+ fmt .Println (err )
753+ return elapsed , err
754+ }
755+ // Check for badness with CheckConsole
756+ warnOnly , badlines := kola .CheckConsole ([]byte (fileContent ), nil )
757+ if len (badlines ) > 0 {
758+ for _ , badline := range badlines {
759+ if warnOnly {
760+ plog .Errorf ("bad log line detected: %v" , badline )
761+ } else {
762+ plog .Warningf ("bad log line detected: %v" , badline )
763+ }
764+ }
765+ if ! warnOnly {
766+ err = fmt .Errorf ("errors found in log files" )
767+ return elapsed , err
768+ }
769+ }
770+ }
771+ }
772+ return elapsed , err
733773}
734774
735775func printResult (test string , duration time.Duration , err error ) bool {
0 commit comments