internal/rosa/gnu: test skip helper

The terribleness of GNU invites interesting helpers.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-02 02:08:25 +09:00
parent bb5bbfe16a
commit 0dc254161f
2 changed files with 62 additions and 0 deletions

View File

@@ -2,10 +2,39 @@ 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
buf.WriteString("1-")
for _, n := range tests {
buf.WriteString(strconv.Itoa(n - 1))
buf.WriteString(" ")
buf.WriteString(strconv.Itoa(n + 1))
buf.WriteString("-")
}
return buf.String()
}
func (t Toolchain) newM4() (pkg.Artifact, string) {
const (
version = "1.4.21"