Skip to content

Commit

Permalink
Updating ConsoleCheckText
Browse files Browse the repository at this point in the history
  • Loading branch information
c4rt0 committed Sep 3, 2024
1 parent d8e6c82 commit 857743c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
3 changes: 1 addition & 2 deletions mantle/cmd/kola/testiso.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,7 @@ func awaitCompletion(ctx context.Context, inst *platform.QemuInstance, outdir st
if err != nil {
errchan <- err
}
}()
}
}
go func() {
err := inst.Wait()
// only one Wait() gets process data, so also manually check for signal
Expand Down
30 changes: 16 additions & 14 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -1919,30 +1919,33 @@ func ScpKolet(machines []platform.Machine) error {


// CheckConsoleText checks console output for badness
func CheckConsoleText(consoleOutput []byte) (bool, []string) {
var badlines []string
warnOnly, allowRerunSuccess := true, true
func CheckConsoleText(badlines []string) (bool, []string) {
badness := false
newBadlines := []string{}

// Ensure there are enough badlines to check
if len(badlines) < 2 {
return badness, badlines // Return early if not enough lines
}
for _, check := range consoleChecks {
if check.skipFlag != nil {
continue
}
match := check.match.FindSubmatch(consoleOutput)
match := check.match.FindStringSubmatch(badlines[1])
if match != nil {
badline := check.desc
if len(match) > 1 {
// include first subexpression
badline += fmt.Sprintf(" (%s)", match[1])
badline += fmt.Sprintf(" (%v)", match[1])
}
badlines = append(badlines, badline)
newBadlines = append(newBadlines, badline)
if !check.warnOnly {
warnOnly = false
}
if !check.allowRerunSuccess {
allowRerunSuccess = false
badness = false
}
}
}
return warnOnly, badlines
badlines = append(badlines, newBadlines...)
return badness, badlines
}

// CheckConsole checks some console output for badness and returns short
Expand Down Expand Up @@ -1972,9 +1975,8 @@ func CheckConsole(output []byte, t *register.Test) (bool, []string) {
if !check.allowRerunSuccess {
allowRerunSuccess = false
}
cc := CheckConsoleText([]byte(output))
fmt.Printf("Test failed: %v", cc)
fmt.Printf("// Leftovers \n\n")
is_it_err,checkConsole := CheckConsoleText([]string(badlines))
fmt.Printf("%v\n,%v", checkConsole, is_it_err)
}
}
if len(badlines) > 0 && allowRerunSuccess && t != nil {
Expand Down
1 change: 0 additions & 1 deletion mantle/platform/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
"syscall"
"time"

"github.com/coreos/coreos-assembler/mantle/kola"
"github.com/coreos/coreos-assembler/mantle/platform/conf"
"github.com/coreos/coreos-assembler/mantle/util"
coreosarch "github.com/coreos/stream-metadata-go/arch"
Expand Down

0 comments on commit 857743c

Please sign in to comment.