77 "os/exec"
88 "path/filepath"
99 "regexp"
10+ "runtime"
1011 "sort"
1112 "strings"
1213 "testing"
@@ -68,16 +69,27 @@ func isInterpreterOnly(path string) bool {
6869 return strings .HasPrefix (string (data ), "\\ INTERPRETER-ONLY" )
6970}
7071
72+ // knownFailures lists tests that fail on specific GOOS/GOARCH combinations.
73+ var knownFailures = map [string ]map [string ]string {
74+ "memory_alloc.fth" : {"darwin/arm64" : "RESIZE behaviour differs on macOS ARM" },
75+ }
76+
7177func TestEndToEnd (t * testing.T ) {
7278 if _ , err := exec .LookPath ("cc" ); err != nil {
7379 t .Skip ("C compiler not found, skipping end-to-end tests" )
7480 }
7581
82+ platform := runtime .GOOS + "/" + runtime .GOARCH
7683 for _ , tt := range discoverTests (t ) {
7784 t .Run (filepath .Base (tt .source ), func (t * testing.T ) {
7885 if isInterpreterOnly (tt .source ) {
7986 t .Skip ("interpreter-only test" )
8087 }
88+ if reasons , ok := knownFailures [filepath .Base (tt .source )]; ok {
89+ if reason , ok := reasons [platform ]; ok {
90+ t .Skipf ("known failure on %s: %s" , platform , reason )
91+ }
92+ }
8193
8294 expected , err := os .ReadFile (tt .expectedFile )
8395 if err != nil {
@@ -148,6 +160,7 @@ func TestEndToEnd(t *testing.T) {
148160}
149161
150162func TestEndToEndInterpreter (t * testing.T ) {
163+ platform := runtime .GOOS + "/" + runtime .GOARCH
151164 for _ , tt := range discoverTests (t ) {
152165 t .Run (filepath .Base (tt .source ), func (t * testing.T ) {
153166 // Skip benchmarks in interpreter mode — they are too slow and
@@ -156,6 +169,11 @@ func TestEndToEndInterpreter(t *testing.T) {
156169 if strings .Contains (tt .source , "benchmarks/" ) || base == "bench.fth" || base == "whetstone.fth" {
157170 t .Skip ("benchmark file, skipping in interpreter mode" )
158171 }
172+ if reasons , ok := knownFailures [base ]; ok {
173+ if reason , ok := reasons [platform ]; ok {
174+ t .Skipf ("known failure on %s: %s" , platform , reason )
175+ }
176+ }
159177 expected , err := os .ReadFile (tt .expectedFile )
160178 if err != nil {
161179 t .Fatalf ("read expected: %v" , err )
0 commit comments