From 604c91bf2f8815327cd36eb2211d5ad896a450a3 Mon Sep 17 00:00:00 2001 From: kai Date: Wed, 4 Aug 2021 15:24:55 +0100 Subject: [PATCH] Add repeat count debug --- control/controldisplay/group_counter_graph.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/control/controldisplay/group_counter_graph.go b/control/controldisplay/group_counter_graph.go index c97edc5bf9..7e545567d8 100644 --- a/control/controldisplay/group_counter_graph.go +++ b/control/controldisplay/group_counter_graph.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "math" + "runtime/debug" "strings" ) @@ -61,6 +62,23 @@ func (r CounterGraphRenderer) Render() string { } func (r CounterGraphRenderer) buildGraphString(failSegments int, passSegments int, spaces int) string { + failSegments = -1 + if failSegments < 0 { + log.Printf("[WARN] buildGraphString negative repeat count: failSegments %d, passSegments %d, spaces %d", failSegments, passSegments, spaces) + failSegments = 0 + debug.PrintStack() + } + if passSegments < 0 { + log.Printf("[WARN] buildGraphString negative repeat count: failSegments %d, passSegments %d, spaces %d", failSegments, passSegments, spaces) + passSegments = 0 + debug.PrintStack() + } + if spaces < 0 { + log.Printf("[WARN] buildGraphString negative repeat count: failSegments %d, passSegments %d, spaces %d", failSegments, passSegments, spaces) + spaces = 0 + debug.PrintStack() + } + str := fmt.Sprintf("%s%s%s%s%s", ControlColors.CountGraphBracket("["), ControlColors.CountGraphFail(strings.Repeat("=", failSegments)),