test: gate go-libraries integration tests behind -tags=integration
Assisted-by: GLM 5.2
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build integration
|
||||
|
||||
// Package lint 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 ./lint/
|
||||
package lint
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"sourcedock.dev/petrbalvin/gasm-devkit/arch"
|
||||
"sourcedock.dev/petrbalvin/gasm-devkit/parser"
|
||||
)
|
||||
|
||||
// TestRealGoLibrariesHasNoErrors asserts that the production go-flac kernels
|
||||
// lint free of errors.
|
||||
func TestRealGoLibrariesHasNoErrors(t *testing.T) {
|
||||
matches, _ := filepath.Glob("../../go-libraries/go-*/*.s")
|
||||
if len(matches) == 0 {
|
||||
t.Skip("go-libraries repository not present")
|
||||
}
|
||||
for _, path := range matches {
|
||||
src, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f, errs := parser.Parse(path, string(src))
|
||||
if len(errs) > 0 {
|
||||
t.Fatalf("parse %s: %v", path, errs)
|
||||
}
|
||||
a := arch.FromFilename(path)
|
||||
diags := File(f, Config{Arch: a})
|
||||
for _, d := range diags {
|
||||
if d.Severity == Error {
|
||||
t.Errorf("%s: %s %s: %s", filepath.Base(path), d.Pos, d.Code, d.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ package lint
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"sourcedock.dev/petrbalvin/gasm-devkit/arch"
|
||||
@@ -234,29 +233,3 @@ TEXT ·f(SB), NOSPLIT, $0
|
||||
t.Fatalf("label rules should be suppressed in macro files: %+v", diags)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRealGoLibrariesHasNoErrors asserts that the production go-flac kernels
|
||||
// lint free of errors. Skipped when the sibling repository is absent.
|
||||
func TestRealGoLibrariesHasNoErrors(t *testing.T) {
|
||||
matches, _ := filepath.Glob("../../go-libraries/go-*/*.s")
|
||||
if len(matches) == 0 {
|
||||
t.Skip("go-libraries repository not present")
|
||||
}
|
||||
for _, path := range matches {
|
||||
src, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f, errs := parser.Parse(path, string(src))
|
||||
if len(errs) > 0 {
|
||||
t.Fatalf("parse %s: %v", path, errs)
|
||||
}
|
||||
a := arch.FromFilename(path)
|
||||
diags := File(f, Config{Arch: a})
|
||||
for _, d := range diags {
|
||||
if d.Severity == Error {
|
||||
t.Errorf("%s: %s %s: %s", filepath.Base(path), d.Pos, d.Code, d.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user