aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/gnu.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-02 02:08:25 +0900
committerOphestra <cat@gensokyo.uk>2026-05-02 05:19:54 +0900
commitf12880688dad3dd9ac561927a765038d1c0990d4 (patch)
tree4b3627655fe90cfb9e5c8b0d7ddae01f194a0d4a /internal/rosa/gnu.go
parentbb5bbfe16ad3fa72f5eb9002e125dc9ec3e4b816 (diff)
internal/rosa/gnu: test skip helper
The terribleness of GNU invites interesting helpers. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/gnu.go')
-rw-r--r--internal/rosa/gnu.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/rosa/gnu.go b/internal/rosa/gnu.go
index c568bbdc..0a944d6a 100644
--- a/internal/rosa/gnu.go
+++ b/internal/rosa/gnu.go
@@ -2,10 +2,47 @@ package rosa
import (
"runtime"
+ "slices"
+ "strconv"
+ "strings"
"hakurei.app/internal/pkg"
)
+// skipGNUTests generates a string for skipping specific tests by number in a
+// GNU test suite. This is nontrivial because the test suite does not support
+// excluding tests in any way, so ranges for all but the skipped tests have to
+// be specified instead.
+//
+// For example, to skip test 764, ranges around the skipped test must be
+// specified:
+//
+// 1-763 765-
+//
+// Tests are numbered starting from 1. The resulting string is unquoted.
+func skipGNUTests(tests ...int) string {
+ tests = slices.Clone(tests)
+ slices.Sort(tests)
+
+ var buf strings.Builder
+
+ if tests[0] != 1 {
+ buf.WriteString("1-")
+ }
+
+ for i, n := range tests {
+ if n != 1 && (i == 0 || tests[i-1] != n-1) {
+ buf.WriteString(strconv.Itoa(n - 1))
+ buf.WriteString(" ")
+ }
+ if i == len(tests)-1 || tests[i+1] != n+1 {
+ buf.WriteString(strconv.Itoa(n + 1))
+ buf.WriteString("-")
+ }
+ }
+ return buf.String()
+}
+
func (t Toolchain) newM4() (pkg.Artifact, string) {
const (
version = "1.4.21"