test: gate go-libraries integration tests behind -tags=integration
Test / vet (push) Successful in 44s
Test / test (push) Successful in 2m8s
Test / build (push) Successful in 40s

Assisted-by: GLM 5.2
This commit is contained in:
2026-08-07 21:28:24 +02:00
parent 176d856f67
commit ebd8ab8a3c
10 changed files with 398 additions and 205 deletions
+1 -4
View File
@@ -5,7 +5,6 @@ package format
import (
"os"
"path/filepath"
"strings"
"testing"
@@ -172,11 +171,9 @@ func TestIdempotent(t *testing.T) {
}
// TestRoundTrip checks that formatting produces source that still parses
// cleanly, on the fixture and on the real go-flac kernels when present.
// cleanly on the in-repository fixture.
func TestRoundTrip(t *testing.T) {
files := []string{"../testdata/sample_amd64.s"}
real, _ := filepath.Glob("../../go-libraries/go-*/*.s")
files = append(files, real...)
for _, path := range files {
src, err := os.ReadFile(path)
if err != nil {
+40
View File
@@ -0,0 +1,40 @@
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
// SPDX-License-Identifier: BSD-3-Clause
//go:build integration
// Package format integration tests against the production go-libraries kernels.
// Excluded from the default test run so coverage is identical locally and in CI.
// Run explicitly with: go test -tags=integration ./format/
package format
import (
"os"
"path/filepath"
"strings"
"testing"
"sourcedock.dev/petrbalvin/gasm-devkit/parser"
)
// TestRoundTripRealGoLibraries checks that formatting the production kernels
// still produces source that parses cleanly.
func TestRoundTripRealGoLibraries(t *testing.T) {
real, _ := filepath.Glob("../../go-libraries/go-*/*.s")
if len(real) == 0 {
t.Skip("go-libraries repository not present")
}
for _, path := range real {
src, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
formatted := Source(path, string(src))
if _, errs := parser.Parse(path, formatted); len(errs) > 0 {
t.Errorf("formatted %s no longer parses: %v", path, errs)
}
if strings.TrimSpace(formatted) == "" {
t.Errorf("formatted %s is empty", path)
}
}
}