From 1cd8c11cdae89218b3dde52d83cfd041895eb115 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 10 Sep 2026 12:33:13 +0200 Subject: [PATCH] make: run the slowest stdlib tests with -short archive/zip, encoding/xml, and index/suffixarray use most of the time of make tinygo-test on every platform. Almost all of it is in a few tests that Go marks as long running. For archive/zip, TestZip64LargeDirectory and TestZip64WriterCDGoldens give 89% of the time. Run these three packages with -short. That omits 9 tests of 143 and keeps the rest. index/suffixarray omits none, because those tests make their input smaller instead of stopping. The set of packages tested does not change. Related to #5659 --- make/test.mk | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/make/test.mk b/make/test.mk index cf0e99f4a..2bb64cadc 100644 --- a/make/test.mk +++ b/make/test.mk @@ -211,6 +211,17 @@ endif TEST_SKIP_FLAG := -skip='TestExtraMethods|TestParseAndBytesRoundTrip/P256/Generic|TestAsValidation|TestUnmarshalNestingLimitSlice|TestUnmarshalNestingLimitStruct' TEST_ADDITIONAL_FLAGS ?= +# These packages spend almost all of their test time in a few tests that Go +# marks as long running. -short omits those tests and keeps the rest. +# encoding/xml gets the same treatment on its own line below. +# See https://github.com/tinygo-org/tinygo/issues/5659 +TEST_PACKAGES_SHORT = \ + archive/zip \ + index/suffixarray \ + $(nil) + +TEST_PACKAGES_SHORT_HOST := $(filter $(TEST_PACKAGES_SHORT),$(TEST_PACKAGES_HOST) $(TEST_PACKAGES_SLOW)) + # Test known-working standard library packages. # TODO: parallelize, and only show failing tests (no implied -v flag). .PHONY: tinygo-test @@ -219,9 +230,12 @@ tinygo-test: @# TestParseAndBytesRoundTrip/P256/Generic: needs Goexit to run defers on wasm. @# TestUnmarshalNestingLimit{Slice,Struct}: encoding/asn1 nesting limit added in @# https://github.com/golang/go/commit/6a6d115f9a7422b2fa081ba6f567eefb4a099462 - $(TINYGO) test $(TEST_ADDITIONAL_FLAGS) $(TEST_SKIP_FLAG) $(filter-out encoding/xml,$(TEST_PACKAGES_HOST)) $(TEST_PACKAGES_SLOW) + $(TINYGO) test $(TEST_ADDITIONAL_FLAGS) $(TEST_SKIP_FLAG) $(filter-out encoding/xml $(TEST_PACKAGES_SHORT),$(TEST_PACKAGES_HOST) $(TEST_PACKAGES_SLOW)) +ifneq ($(TEST_PACKAGES_SHORT_HOST),) + $(TINYGO) test $(TEST_ADDITIONAL_FLAGS) $(TEST_SKIP_FLAG) -short $(TEST_PACKAGES_SHORT_HOST) +endif ifeq ($(TEST_ENCODING_XML),true) - $(TINYGO) test $(TEST_ADDITIONAL_FLAGS) $(TEST_SKIP_FLAG) -stack-size=16MB encoding/xml + $(TINYGO) test $(TEST_ADDITIONAL_FLAGS) $(TEST_SKIP_FLAG) -short -stack-size=16MB encoding/xml endif @# io/fs requires os.ReadDir, not yet supported on windows or wasi. It also @# requires a large stack-size. Hence, io/fs is only run conditionally.