ci: run the full smoke test once, and split the GNUmakefile (#5616)

* GNUmakefile: split into topic files in make/

The GNUmakefile had 1295 lines and mixed build configuration, LLVM
bootstrapping, device generation, four test suites, the smoke tests,
release packaging, and lint tools. The smoke tests alone were 500 lines.

Move each part into its own file in make/ and include them from
GNUmakefile. config.mk must be included first because the other files
use its variables in immediate assignments and conditionals.

There is no change in behavior. The parsed make database is identical
for the default build and for ASSERT=1, STATIC=1, XTENSA=0, STM32=0,
WASM=0, and CROSS=aarch64-linux-gnu, except for MAKEFILE_LIST and the
.PHONY list, which now also includes targets that were phony but not
declared.

The Dockerfile copies GNUmakefile alone before it builds LLVM, to keep
that layer independent of the source tree. It must copy make/ too.

* make/smoketest.mk: split into groups and add smoketest-quick

The smoke test was one recipe of about 500 lines with 236 builds that
always ran in sequence. Split it at the group boundaries that were
already there, so that:

- `make -j smoketest` builds the groups in parallel. A full run goes
  from 325 to 91 seconds on a 32 core machine.
- CI can shard the groups across runners.

Each group writes to its own name in build/smoke/, because all builds
wrote to test.hex before and would overwrite each other in a parallel
build. The output extension selects the format, so it stays per line.

Add smoketest-quick, which builds one board for each processor
architecture. The full smoke test answers "can TinyGo build for every
board", which does not depend on the host OS, so it only needs to run
on one OS. The other jobs use smoketest-quick.

The comment above the esp32c3 group had 4 spaces of indentation instead
of a tab. That was harmless in the middle of a recipe, but it is now the
first line of a group, where it would stop the recipe from starting.

The set of build commands is unchanged for the default flags and for
XTENSA=0, STM32=0, and WASM=0. All 226 checksums are the same as before,
for a sequential build and for `make -j16`.

* ci: run the full smoke test once, on Linux only

The smoke test ran six times for each push: twice on Linux, twice on
macOS, once on Windows, and once in the compatibility test. Together
that was about 97 minutes of the CI time.

The smoke test checks that TinyGo can build a binary for each board.
That does not depend on the host OS. The only part that does is one
build behind a Windows check.

Add a smoketest-linux job that runs the full set, split across four
runners that use the tarball from the build-linux job. The groups are
balanced with the measured build time of each group. Remove the full
smoke test from test-linux-build, which the new job replaces, and use
smoketest-quick for the other four jobs.

Expected result: about 55 to 39 minutes for the slowest workflow, and
about 97 to 35 minutes of total smoke test time.

* make/smoketest.mk: build nintendoswitch in smoketest-quick

It is the only target that uses the aarch64 LLVM triple. With it,
smoketest-quick covers all 13 triples that the full smoke test uses.
This commit is contained in:
Ron Evans
2026-08-28 09:08:26 +02:00
committed by GitHub
parent ac98a3df85
commit a213d9ae46
15 changed files with 1526 additions and 1299 deletions
+1 -1
View File
@@ -107,7 +107,7 @@ jobs:
path: build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
archive: false
- name: Smoke tests
run: make smoketest TINYGO=$(PWD)/build/tinygo
run: make smoketest-quick TINYGO=$(PWD)/build/tinygo
test-macos-homebrew:
name: homebrew-install
runs-on: macos-latest
+1 -1
View File
@@ -69,4 +69,4 @@ jobs:
- run: tinygo version
- run: make gen-device -j4
- run: go test -tags=llvm${{ env.LLVM }} -short -skip=TestErrors
- run: make smoketest XTENSA=0
- run: make smoketest-quick XTENSA=0
+38 -2
View File
@@ -180,7 +180,43 @@ jobs:
- run: make tinygo-test-wasip1-fast
- run: make tinygo-test-wasip2-fast
- run: make tinygo-test-wasm
- run: make smoketest
smoketest-linux:
# Build a binary for every supported board, using the binaries built in the
# build-linux job. This is the only job that runs the full smoke test. The
# result does not depend on the host OS, so the other jobs build a
# representative board for each architecture with smoketest-quick.
runs-on: ubuntu-latest
needs: build-linux
strategy:
fail-fast: false
matrix:
# Balanced with the measured build time of each group, so that the
# shards finish at about the same time.
group:
- smoketest-rp2xxx smoketest-selftest smoketest-wasm-sim
- smoketest-esp smoketest-riscv smoketest-flags
- smoketest-examples smoketest-nxp smoketest-pwm-usb smoketest-avr
- smoketest-samd smoketest-stm32 smoketest-nrf smoketest-wasm
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: '1.27.0'
cache: true
- name: Download release artifact
uses: actions/download-artifact@v8
with:
name: tinygo${{ needs.build-linux.outputs.version }}.linux-amd64.tar.gz
- name: Extract release tarball
run: |
mkdir -p ~/lib
tar -C ~/lib -xf tinygo${{ needs.build-linux.outputs.version }}.linux-amd64.tar.gz
ln -s ~/lib/tinygo/bin/tinygo ~/go/bin/tinygo
- run: make testchdir ${{ matrix.group }}
assert-test-linux:
# Run all tests that can run on Linux, with LLVM assertions enabled to catch
# potential bugs.
@@ -293,7 +329,7 @@ jobs:
echo "$(pwd)/build" >> $GITHUB_PATH
- name: Test stdlib packages
run: make tinygo-test
- run: make smoketest
- run: make smoketest-quick
- run: make wasmtest
- run: make tinygo-test-baremetal
- name: Check Go code formatting
+1 -1
View File
@@ -139,7 +139,7 @@ jobs:
# This build is already unzipped.
- name: Smoke tests
shell: bash
run: make smoketest TINYGO=$(PWD)/build/tinygo/bin/tinygo
run: make smoketest-quick TINYGO=$(PWD)/build/tinygo/bin/tinygo
stdlib-test-windows:
runs-on: windows-2022
+5 -2
View File
@@ -30,7 +30,10 @@ on a different system like Mac.
## Using GNU Make
The static build of TinyGo is driven by GNUmakefile, which provides a help target for quick reference:
The static build of TinyGo is driven by GNUmakefile, which includes the topic
files in the `make/` directory (`config.mk`, `llvm.mk`, `gen-device.mk`,
`build.mk`, `test.mk`, `smoketest.mk`, `release.mk`, and `tools.mk`).
It provides a help target for quick reference:
% make help
clean Remove build directory
@@ -64,7 +67,7 @@ while producing binaries that are about as fast.
export CC=clang
export CXX=clang++
The Makefile includes a default configuration that is good for most users. It
`make/config.mk` holds a default configuration that is good for most users. It
builds a release version of LLVM (optimized, no asserts) and includes all
targets supported by TinyGo:
+1
View File
@@ -10,6 +10,7 @@ RUN apt-get update && \
/tmp/*
COPY ./GNUmakefile /tinygo/GNUmakefile
COPY ./make /tinygo/make
RUN cd /tinygo/ && \
make llvm-source
+10 -1292
View File
File diff suppressed because it is too large Load Diff
+41
View File
@@ -0,0 +1,41 @@
# Build the TinyGo compiler, plus housekeeping and code generation helpers.
.PHONY: all tinygo clean fmt fmt-check
clean: ## Remove build directory
@rm -rf build
FMT_PATHS = ./*.go builder cgo/*.go compiler interp loader src transform
fmt: ## Reformat source
@gofmt -l -w $(FMT_PATHS)
fmt-check: ## Warn if any source needs reformatting
@unformatted=$$(gofmt -l $(FMT_PATHS)); [ -z "$$unformatted" ] && exit 0; echo "Unformatted:"; for fn in $$unformatted; do echo " $$fn"; done; exit 1
# Generate WASI syscall bindings
WASM_TOOLS_MODULE=go.bytecodealliance.org
.PHONY: wasi-syscall
wasi-syscall: wasi-cm
rm -rf ./src/internal/wasi/*
go run $(WASM_TOOLS_MODULE)/cmd/wit-bindgen-go generate --versioned -o ./src/internal -p internal --cm internal/cm ./lib/wasi-cli/wit
# Copy package cm into src/internal/cm
.PHONY: wasi-cm
wasi-cm:
rm -rf ./src/internal/cm/*
rsync -rv --delete --exclude go.mod --exclude '*_test.go' --exclude '*_json.go' --exclude '*.md' --exclude LICENSE $(shell go list -m -f {{.Dir}} $(WASM_TOOLS_MODULE)/cm)/ ./src/internal/cm
# Check for Node.js used during WASM tests.
MIN_NODEJS_VERSION=22
.PHONY: check-nodejs-version
check-nodejs-version:
@# Check whether NodeJS is available.
@if ! command -v node 2>&1 >/dev/null; then echo "Install NodeJS version ${MIN_NODEJS_VERSION}+ to run tests."; exit 1; fi
@# Check whether the version is high enough.
@if [ "`node -v | sed 's/v\([0-9]\+\).*/\\1/g'`" -lt $(MIN_NODEJS_VERSION) ]; then echo "Install NodeJS version $(MIN_NODEJS_VERSION)+ to run tests."; exit 1; fi
tinygo: ## Build the TinyGo compiler
@if [ ! -f "$(LLVM_BUILDDIR)/bin/llvm-config" ]; then echo "Fetch and build LLVM first by running:"; echo " $(MAKE) llvm-source"; echo " $(MAKE) $(LLVM_BUILDDIR)"; exit 1; fi
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOENVFLAGS) $(GO) build -buildmode exe -o build/tinygo$(EXE) -tags "byollvm llvm22 osusergo" .
+132
View File
@@ -0,0 +1,132 @@
# Build configuration: host detection, LLVM paths, and CGO flags.
# Default build and source directories, as created by `make llvm-build`.
LLVM_BUILDDIR ?= llvm-build
LLVM_PROJECTDIR ?= llvm-project
CLANG_SRC ?= $(LLVM_PROJECTDIR)/clang
LLD_SRC ?= $(LLVM_PROJECTDIR)/lld
ifeq ($(OS),Windows_NT)
# avoid calling uname on Windows
uname := Windows_NT
else
uname := $(shell uname -s)
endif
# Try to autodetect LLVM build tools.
# Versions are listed here in descending priority order.
LLVM_VERSIONS = 19 18 17 16 15
errifempty = $(if $(1),$(1),$(error $(2)))
detect = $(shell which $(call errifempty,$(firstword $(foreach p,$(2),$(shell command -v $(p) 2> /dev/null && echo $(p)))),failed to locate $(1) at any of: $(2)))
toolSearchPathsVersion = $(1)-$(2)
ifeq ($(uname),Darwin)
# Also explicitly search Brew's copy, which is not in PATH by default.
BREW_PREFIX := $(shell brew --prefix)
toolSearchPathsVersion += $(BREW_PREFIX)/opt/llvm@$(2)/bin/$(1)-$(2) $(BREW_PREFIX)/opt/llvm@$(2)/bin/$(1)
endif
# First search for a custom built copy, then move on to explicitly version-tagged binaries, then just see if the tool is in path with its normal name.
findLLVMTool = $(call detect,$(1),$(abspath llvm-build/bin/$(1)) $(foreach ver,$(LLVM_VERSIONS),$(call toolSearchPathsVersion,$(1),$(ver))) $(1))
CLANG ?= $(call findLLVMTool,clang)
LLVM_AR ?= $(call findLLVMTool,llvm-ar)
LLVM_NM ?= $(call findLLVMTool,llvm-nm)
# Go binary and GOROOT to select
GO ?= go
# Flags to pass to go test.
GOTESTFLAGS ?=
GOTESTPKGS ?= ./builder ./cgo ./compileopts ./compiler ./interp ./transform .
# tinygo binary for tests
TINYGO ?= $(call detect,tinygo,tinygo $(CURDIR)/build/tinygo)
# Check for ccache if the user hasn't set it to on or off.
ifeq (, $(CCACHE))
LLVM_OPTION += '-DLLVM_CCACHE_BUILD=$(if $(shell command -v ccache 2> /dev/null),ON,OFF)'
else
LLVM_OPTION += '-DLLVM_CCACHE_BUILD=$(CCACHE)'
endif
# Allow enabling LLVM assertions
ifeq (1, $(ASSERT))
LLVM_OPTION += '-DLLVM_ENABLE_ASSERTIONS=ON'
else
LLVM_OPTION += '-DLLVM_ENABLE_ASSERTIONS=OFF'
endif
# Enable AddressSanitizer
ifeq (1, $(ASAN))
LLVM_OPTION += -DLLVM_USE_SANITIZER=Address
CGO_LDFLAGS += -fsanitize=address
endif
ifeq (1, $(STATIC))
# Build TinyGo as a fully statically linked binary (no dynamically loaded
# libraries such as a libc). This is not supported with glibc which is used
# on most major Linux distributions. However, it is supported in Alpine
# Linux with musl.
CGO_LDFLAGS += -static
# Also set the thread stack size to 1MB. This is necessary on musl as the
# default stack size is 128kB and LLVM uses more than that.
# For more information, see:
# https://wiki.musl-libc.org/functional-differences-from-glibc.html#Thread-stack-size
CGO_LDFLAGS += -Wl,-z,stack-size=1048576
# Build wasm-opt with static linking.
# For details, see:
# https://github.com/WebAssembly/binaryen/blob/version_102/.github/workflows/ci.yml#L181
BINARYEN_OPTION += -DCMAKE_CXX_FLAGS="-static" -DCMAKE_C_FLAGS="-static"
endif
# Optimize the binary size for Linux.
# These flags may work on other platforms, but have only been tested on Linux.
ifeq ($(uname),Linux)
HAS_MOLD := $(shell command -v ld.mold 2> /dev/null)
HAS_LLD := $(shell command -v ld.lld 2> /dev/null)
LLVM_CFLAGS := -ffunction-sections -fdata-sections -fvisibility=hidden
LLVM_LDFLAGS := -Wl,--gc-sections
ifneq ($(HAS_MOLD),)
# Mold might be slightly faster.
LLVM_LDFLAGS += -fuse-ld=mold -Wl,--icf=all
else ifneq ($(HAS_LLD),)
# LLD is more commonly available.
LLVM_LDFLAGS += -fuse-ld=lld -Wl,--icf=all
endif
LLVM_OPTION += \
-DCMAKE_C_FLAGS="$(LLVM_CFLAGS)" \
-DCMAKE_CXX_FLAGS="$(LLVM_CFLAGS)"
CGO_LDFLAGS += $(LLVM_LDFLAGS)
endif
# Cross compiling support.
ifneq ($(CROSS),)
CC = $(CROSS)-gcc
CXX = $(CROSS)-g++
LLVM_OPTION += \
-DCMAKE_C_COMPILER=$(CC) \
-DCMAKE_CXX_COMPILER=$(CXX) \
-DLLVM_DEFAULT_TARGET_TRIPLE=$(CROSS) \
-DCROSS_TOOLCHAIN_FLAGS_NATIVE="-UCMAKE_C_COMPILER;-UCMAKE_CXX_COMPILER"
ifeq ($(CROSS), arm-linux-gnueabihf)
# Assume we're building on a Debian-like distro, with QEMU installed.
LLVM_CONFIG_PREFIX = qemu-arm -L /usr/arm-linux-gnueabihf/
# The CMAKE_SYSTEM_NAME flag triggers cross compilation mode.
LLVM_OPTION += \
-DCMAKE_SYSTEM_NAME=Linux \
-DLLVM_TARGET_ARCH=ARM
GOENVFLAGS = GOARCH=arm CC=$(CC) CXX=$(CXX) CGO_ENABLED=1
BINARYEN_OPTION += -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
else ifeq ($(CROSS), aarch64-linux-gnu)
# Assume we're building on a Debian-like distro, with QEMU installed.
LLVM_CONFIG_PREFIX = qemu-aarch64 -L /usr/aarch64-linux-gnu/
# The CMAKE_SYSTEM_NAME flag triggers cross compilation mode.
LLVM_OPTION += \
-DCMAKE_SYSTEM_NAME=Linux \
-DLLVM_TARGET_ARCH=AArch64
GOENVFLAGS = GOARCH=arm64 CC=$(CC) CXX=$(CXX) CGO_ENABLED=1
BINARYEN_OPTION += -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
else
$(error Unknown cross compilation target: $(CROSS))
endif
endif
+60
View File
@@ -0,0 +1,60 @@
# Generate microcontroller-specific sources from SVD files.
.PHONY: gen-device gen-device-avr gen-device-esp gen-device-nrf gen-device-sam \
gen-device-sifive gen-device-kendryte gen-device-nxp gen-device-rp \
gen-device-stm32 gen-device-renesas
gen-device: gen-device-avr gen-device-esp gen-device-nrf gen-device-sam gen-device-sifive gen-device-kendryte gen-device-nxp gen-device-rp ## Generate microcontroller-specific sources
ifneq ($(RENESAS), 0)
gen-device: gen-device-renesas
endif
ifneq ($(STM32), 0)
gen-device: gen-device-stm32
endif
gen-device-avr:
@if [ ! -e lib/avr/README.md ]; then echo "Submodules have not been downloaded. Please download them using:\n git submodule update --init"; exit 1; fi
$(GO) build -o ./build/gen-device-avr ./tools/gen-device-avr/
./build/gen-device-avr lib/avr/packs/atmega src/device/avr/
./build/gen-device-avr lib/avr/packs/tiny src/device/avr/
@GO111MODULE=off $(GO) fmt ./src/device/avr
build/gen-device-svd: ./tools/gen-device-svd/*.go
$(GO) build -o $@ ./tools/gen-device-svd/
gen-device-esp: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif-Community -interrupts=software lib/cmsis-svd/data/Espressif-Community/ src/device/esp/
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif -interrupts=software lib/cmsis-svd/data/Espressif/ src/device/esp/
GO111MODULE=off $(GO) fmt ./src/device/esp
gen-device-nrf: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/NordicSemiconductor/nrfx/tree/master/mdk lib/nrfx/mdk/ src/device/nrf/
GO111MODULE=off $(GO) fmt ./src/device/nrf
gen-device-nxp: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/NXP lib/cmsis-svd/data/NXP/ src/device/nxp/
GO111MODULE=off $(GO) fmt ./src/device/nxp
gen-device-sam: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Atmel lib/cmsis-svd/data/Atmel/ src/device/sam/
GO111MODULE=off $(GO) fmt ./src/device/sam
gen-device-sifive: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/SiFive-Community -interrupts=software lib/cmsis-svd/data/SiFive-Community/ src/device/sifive/
GO111MODULE=off $(GO) fmt ./src/device/sifive
gen-device-kendryte: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Kendryte-Community -interrupts=software lib/cmsis-svd/data/Kendryte-Community/ src/device/kendryte/
GO111MODULE=off $(GO) fmt ./src/device/kendryte
gen-device-stm32: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/tinygo-org/stm32-svd lib/stm32-svd/svd src/device/stm32/
GO111MODULE=off $(GO) fmt ./src/device/stm32
gen-device-rp: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/RaspberryPi lib/cmsis-svd/data/RaspberryPi/ src/device/rp/
GO111MODULE=off $(GO) fmt ./src/device/rp
gen-device-renesas: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/cmsis-svd/cmsis-svd-data/tree/master/data/Renesas lib/cmsis-svd/data/Renesas/ src/device/renesas/
GO111MODULE=off $(GO) fmt ./src/device/renesas
+98
View File
@@ -0,0 +1,98 @@
# LLVM and Binaryen: component lists, link flags, source checkout, and build.
.PHONY: llvm-source $(LLVM_BUILDDIR)
LLVM_COMPONENTS = all-targets analysis asmparser asmprinter bitreader bitwriter codegen core coroutines coverage debuginfodwarf debuginfopdb dtlto executionengine frontenddriver frontendhlsl frontendopenmp instrumentation interpreter ipo irreader libdriver linker lto mc mcjit objcarcopts option profiledata scalaropts support target windowsdriver windowsmanifest
ifeq ($(OS),Windows_NT)
EXE = .exe
START_GROUP = -Wl,--start-group
END_GROUP = -Wl,--end-group
# PIC needs to be disabled for libclang to work.
LLVM_OPTION += -DLLVM_ENABLE_PIC=OFF
# Statically link the C++ and GCC runtime into LLVM tools so they don't
# depend on MinGW DLLs that may not be on PATH when executed during the build.
LLVM_OPTION += '-DCMAKE_EXE_LINKER_FLAGS=-static-libgcc -static-libstdc++'
CGO_CPPFLAGS += -DCINDEX_NO_EXPORTS
CGO_LDFLAGS += -static -static-libgcc -static-libstdc++
CGO_LDFLAGS_EXTRA += -lversion
USE_SYSTEM_BINARYEN ?= 1
else ifeq ($(uname),Darwin)
MD5SUM ?= md5
CGO_LDFLAGS += -lxar
USE_SYSTEM_BINARYEN ?= 1
else ifeq ($(uname),FreeBSD)
MD5SUM ?= md5
START_GROUP = -Wl,--start-group
END_GROUP = -Wl,--end-group
else
START_GROUP = -Wl,--start-group
END_GROUP = -Wl,--end-group
endif
# md5sum binary default, can be overridden by an environment variable
MD5SUM ?= md5sum
# Libraries that should be linked in for the statically linked Clang.
CLANG_LIB_NAMES = clangAnalysis clangAnalysisLifetimeSafety clangAPINotes clangAST clangASTMatchers clangBasic clangCodeGen clangCrossTU clangDriver clangDynamicASTMatchers clangEdit clangExtractAPI clangFormat clangFrontend clangFrontendTool clangHandleCXX clangHandleLLVM clangIndex clangInstallAPI clangLex clangOptions clangParse clangRewrite clangRewriteFrontend clangSema clangSerialization clangSupport clangTooling clangToolingASTDiff clangToolingCore clangToolingInclusions
CLANG_LIBS = $(START_GROUP) $(addprefix -l,$(CLANG_LIB_NAMES)) $(END_GROUP) -lstdc++
# Libraries that should be linked in for the statically linked LLD.
LLD_LIB_NAMES = lldCOFF lldCommon lldELF lldMachO lldMinGW lldWasm
LLD_LIBS = $(START_GROUP) $(addprefix -l,$(LLD_LIB_NAMES)) $(END_GROUP)
# Other libraries that are needed to link TinyGo.
EXTRA_LIB_NAMES = LLVMDTLTO LLVMInterpreter LLVMMCA LLVMRISCVTargetMCA LLVMX86TargetMCA
# All libraries to be built and linked with the tinygo binary (lib/lib*.a).
LIB_NAMES = clang $(CLANG_LIB_NAMES) $(LLD_LIB_NAMES) $(EXTRA_LIB_NAMES)
# These build targets appear to be the only ones necessary to build all TinyGo
# dependencies. Only building a subset significantly speeds up rebuilding LLVM.
# The Makefile rules convert a name like lldELF to lib/liblldELF.a to match the
# library path (for ninja).
# This list also includes a few tools that are necessary as part of the full
# TinyGo build.
NINJA_BUILD_TARGETS = clang llvm-config llvm-ar llvm-nm lld $(addprefix lib/lib,$(addsuffix .a,$(LIB_NAMES)))
# For static linking.
ifneq ("$(wildcard $(LLVM_BUILDDIR)/bin/llvm-config*)","")
CGO_CPPFLAGS+=$(shell $(LLVM_CONFIG_PREFIX) $(LLVM_BUILDDIR)/bin/llvm-config --cppflags) -I$(abspath $(LLVM_BUILDDIR))/tools/clang/include -I$(abspath $(CLANG_SRC))/include -I$(abspath $(LLD_SRC))/include
CGO_CXXFLAGS=-std=c++17
ifneq ($(uname),Windows_NT)
# Disable GCC DWARF compression: lld built without zlib cannot link
# object files with ELFCOMPRESS_ZLIB debug sections.
CGO_CFLAGS+=-gz=none
CGO_CXXFLAGS+=-gz=none
endif
CGO_LDFLAGS+=-L$(abspath $(LLVM_BUILDDIR)/lib) -lclang $(CLANG_LIBS) $(LLD_LIBS) $(shell $(LLVM_CONFIG_PREFIX) $(LLVM_BUILDDIR)/bin/llvm-config --ldflags --libs --system-libs $(LLVM_COMPONENTS)) -lstdc++ $(CGO_LDFLAGS_EXTRA)
endif
$(LLVM_PROJECTDIR)/llvm:
git clone -b tinygo_22.x --depth=1 https://github.com/tinygo-org/llvm-project $(LLVM_PROJECTDIR)
llvm-source: $(LLVM_PROJECTDIR)/llvm ## Get LLVM sources
# Configure LLVM.
TINYGO_SOURCE_DIR=$(shell pwd)
$(LLVM_BUILDDIR)/build.ninja:
mkdir -p $(LLVM_BUILDDIR) && cd $(LLVM_BUILDDIR) && cmake -G Ninja $(TINYGO_SOURCE_DIR)/$(LLVM_PROJECTDIR)/llvm "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64;AVR;Mips;RISCV;WebAssembly" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=Xtensa" -DCMAKE_BUILD_TYPE=Release -DLIBCLANG_BUILD_STATIC=ON -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_ZSTD=OFF -DLLVM_ENABLE_LIBEDIT=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG_ENABLE_ARCMT=OFF $(LLVM_OPTION)
$(LLVM_BUILDDIR): $(LLVM_BUILDDIR)/build.ninja ## Build LLVM
cd $(LLVM_BUILDDIR) && ninja $(NINJA_BUILD_TARGETS)
ifneq ($(USE_SYSTEM_BINARYEN),1)
# Build Binaryen
.PHONY: binaryen
binaryen: build/wasm-opt$(EXE)
build/wasm-opt$(EXE):
mkdir -p build
cd lib/binaryen && cmake -G Ninja . -DBUILD_STATIC_LIB=ON -DBUILD_TESTS=OFF -DENABLE_WERROR=OFF $(BINARYEN_OPTION) && ninja bin/wasm-opt$(EXE)
cp lib/binaryen/bin/wasm-opt$(EXE) build/wasm-opt$(EXE)
endif
+142
View File
@@ -0,0 +1,142 @@
# Build the release tarball and the Debian package.
build/release: tinygo gen-device $(if $(filter 1,$(USE_SYSTEM_BINARYEN)),,binaryen)
@mkdir -p build/release/tinygo/bin
@mkdir -p build/release/tinygo/lib/bdwgc
@mkdir -p build/release/tinygo/lib/clang/include
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
@mkdir -p build/release/tinygo/lib/macos-minimal-sdk
@mkdir -p build/release/tinygo/lib/mingw-w64/mingw-w64-crt/crt
@mkdir -p build/release/tinygo/lib/mingw-w64/mingw-w64-crt/math
@mkdir -p build/release/tinygo/lib/mingw-w64/mingw-w64-crt/lib-common
@mkdir -p build/release/tinygo/lib/mingw-w64/mingw-w64-headers/defaults
@mkdir -p build/release/tinygo/lib/musl/arch
@mkdir -p build/release/tinygo/lib/musl/crt
@mkdir -p build/release/tinygo/lib/musl/src
@mkdir -p build/release/tinygo/lib/nrfx
@mkdir -p build/release/tinygo/lib/picolibc/newlib/libc
@mkdir -p build/release/tinygo/lib/picolibc/newlib/libm
@mkdir -p build/release/tinygo/lib/wasi-libc/dlmalloc
@mkdir -p build/release/tinygo/lib/wasi-libc/libc-bottom-half
@mkdir -p build/release/tinygo/lib/wasi-libc/libc-top-half/musl/arch
@mkdir -p build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@mkdir -p build/release/tinygo/lib/wasi-cli/
@echo copying source files
@cp -p build/tinygo$(EXE) build/release/tinygo/bin
ifneq ($(USE_SYSTEM_BINARYEN),1)
@cp -p build/wasm-opt$(EXE) build/release/tinygo/bin
endif
@cp -rp lib/bdwgc/* build/release/tinygo/lib/bdwgc
@cp -p $(abspath $(CLANG_SRC))/lib/Headers/*.h build/release/tinygo/lib/clang/include
@cp -rp lib/CMSIS/CMSIS/Include build/release/tinygo/lib/CMSIS/CMSIS
@cp -rp lib/CMSIS/README.md build/release/tinygo/lib/CMSIS
@cp -rp lib/macos-minimal-sdk/* build/release/tinygo/lib/macos-minimal-sdk
@cp -rp lib/musl/arch/aarch64 build/release/tinygo/lib/musl/arch
@cp -rp lib/musl/arch/arm build/release/tinygo/lib/musl/arch
@cp -rp lib/musl/arch/generic build/release/tinygo/lib/musl/arch
@cp -rp lib/musl/arch/i386 build/release/tinygo/lib/musl/arch
@cp -rp lib/musl/arch/mips build/release/tinygo/lib/musl/arch
@cp -rp lib/musl/arch/x86_64 build/release/tinygo/lib/musl/arch
@cp -rp lib/musl/crt/crt1.c build/release/tinygo/lib/musl/crt
@cp -rp lib/musl/COPYRIGHT build/release/tinygo/lib/musl
@cp -rp lib/musl/include build/release/tinygo/lib/musl
@cp -rp lib/musl/src/conf build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/ctype build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/env build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/errno build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/exit build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/fcntl build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/include build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/internal build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/legacy build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/locale build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/linux build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/malloc build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/mman build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/math build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/misc build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/multibyte build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/sched build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/signal build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/stdio build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/stdlib build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/string build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/thread build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/time build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/unistd build/release/tinygo/lib/musl/src
@cp -rp lib/musl/src/process build/release/tinygo/lib/musl/src
@cp -rp lib/mingw-w64/mingw-w64-crt/crt/pseudo-reloc.c build/release/tinygo/lib/mingw-w64/mingw-w64-crt/crt
@cp -rp lib/mingw-w64/mingw-w64-crt/def-include build/release/tinygo/lib/mingw-w64/mingw-w64-crt
@cp -rp lib/mingw-w64/mingw-w64-crt/gdtoa build/release/tinygo/lib/mingw-w64/mingw-w64-crt
@cp -rp lib/mingw-w64/mingw-w64-crt/include build/release/tinygo/lib/mingw-w64/mingw-w64-crt
@cp -rp lib/mingw-w64/mingw-w64-crt/lib-common/api-ms-win-crt-* build/release/tinygo/lib/mingw-w64/mingw-w64-crt/lib-common
@cp -rp lib/mingw-w64/mingw-w64-crt/lib-common/advapi32.def.in build/release/tinygo/lib/mingw-w64/mingw-w64-crt/lib-common
@cp -rp lib/mingw-w64/mingw-w64-crt/lib-common/kernel32.def.in build/release/tinygo/lib/mingw-w64/mingw-w64-crt/lib-common
@cp -rp lib/mingw-w64/mingw-w64-crt/lib-common/msvcrt.def.in build/release/tinygo/lib/mingw-w64/mingw-w64-crt/lib-common
@cp -rp lib/mingw-w64/mingw-w64-crt/math/x86 build/release/tinygo/lib/mingw-w64/mingw-w64-crt/math
@cp -rp lib/mingw-w64/mingw-w64-crt/misc build/release/tinygo/lib/mingw-w64/mingw-w64-crt
@cp -rp lib/mingw-w64/mingw-w64-crt/stdio build/release/tinygo/lib/mingw-w64/mingw-w64-crt
@cp -rp lib/mingw-w64/mingw-w64-headers/crt/ build/release/tinygo/lib/mingw-w64/mingw-w64-headers
@cp -rp lib/mingw-w64/mingw-w64-headers/defaults/include build/release/tinygo/lib/mingw-w64/mingw-w64-headers/defaults
@cp -rp lib/mingw-w64/mingw-w64-headers/include build/release/tinygo/lib/mingw-w64/mingw-w64-headers
@cp -rp lib/nrfx/* build/release/tinygo/lib/nrfx
@cp -rp lib/picolibc/newlib/libc/ctype build/release/tinygo/lib/picolibc/newlib/libc
@cp -rp lib/picolibc/newlib/libc/include build/release/tinygo/lib/picolibc/newlib/libc
@cp -rp lib/picolibc/newlib/libc/locale build/release/tinygo/lib/picolibc/newlib/libc
@cp -rp lib/picolibc/newlib/libc/string build/release/tinygo/lib/picolibc/newlib/libc
@cp -rp lib/picolibc/newlib/libc/tinystdio build/release/tinygo/lib/picolibc/newlib/libc
@cp -rp lib/picolibc/newlib/libm/common build/release/tinygo/lib/picolibc/newlib/libm
@cp -rp lib/picolibc/newlib/libm/math build/release/tinygo/lib/picolibc/newlib/libm
@cp -rp lib/picolibc-stdio.c build/release/tinygo/lib
@cp -rp lib/wasi-libc/dlmalloc/src build/release/tinygo/lib/wasi-libc/dlmalloc
@cp -rp lib/wasi-libc/libc-bottom-half/cloudlibc build/release/tinygo/lib/wasi-libc/libc-bottom-half
@cp -rp lib/wasi-libc/libc-bottom-half/headers build/release/tinygo/lib/wasi-libc/libc-bottom-half
@cp -rp lib/wasi-libc/libc-bottom-half/sources build/release/tinygo/lib/wasi-libc/libc-bottom-half
@cp -rp lib/wasi-libc/libc-top-half/headers build/release/tinygo/lib/wasi-libc/libc-top-half
@cp -rp lib/wasi-libc/libc-top-half/musl/arch/generic build/release/tinygo/lib/wasi-libc/libc-top-half/musl/arch
@cp -rp lib/wasi-libc/libc-top-half/musl/arch/wasm32 build/release/tinygo/lib/wasi-libc/libc-top-half/musl/arch
@cp -rp lib/wasi-libc/libc-top-half/musl/include build/release/tinygo/lib/wasi-libc/libc-top-half/musl
@cp -rp lib/wasi-libc/libc-top-half/musl/src/conf build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/dirent build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/env build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/errno build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/exit build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/fcntl build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/fenv build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/include build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/internal build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/legacy build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/locale build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/math build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/misc build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/multibyte build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/network build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/stat build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/stdio build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/stdlib build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/string build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/thread build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/time build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/musl/src/unistd build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/sources build/release/tinygo/lib/wasi-libc/libc-top-half
@cp -rp lib/wasi-cli/wit build/release/tinygo/lib/wasi-cli/wit
@cp -rp ${LLVM_PROJECTDIR}/compiler-rt/lib/builtins build/release/tinygo/lib/compiler-rt-builtins
@cp -rp ${LLVM_PROJECTDIR}/compiler-rt/LICENSE.TXT build/release/tinygo/lib/compiler-rt-builtins
@cp -rp src build/release/tinygo/src
@cp -rp targets build/release/tinygo/targets
release:
tar -czf build/release.tar.gz -C build/release tinygo
DEB_ARCH ?= native
deb:
@mkdir -p build/release-deb/usr/local/bin
@mkdir -p build/release-deb/usr/local/lib
cp -ar build/release/tinygo build/release-deb/usr/local/lib/tinygo
ln -sf ../lib/tinygo/bin/tinygo build/release-deb/usr/local/bin/tinygo
fpm -f -s dir -t deb -n tinygo -a $(DEB_ARCH) -v $(shell grep "const version = " goenv/version.go | awk '{print $$NF}') -m '@tinygo-org' --description='TinyGo is a Go compiler for small places.' --license='BSD 3-Clause' --url=https://tinygo.org/ --deb-changelog CHANGELOG.md -p build/release.deb -C ./build/release-deb
ifneq ($(RELEASEONLY), 1)
release: build/release
deb: build/release
endif
+666
View File
@@ -0,0 +1,666 @@
# Smoke tests: check that TinyGo can build a binary for every supported board.
.PHONY: testchdir
testchdir:
# test 'build' command with{,out} -C argument
$(TINYGO) build -C tests/testing/chdir chdir.go && rm tests/testing/chdir/chdir
$(TINYGO) build ./tests/testing/chdir/chdir.go && rm chdir
# test 'run' command with{,out} -C argument
EXPECT_DIR=$(PWD)/tests/testing/chdir $(TINYGO) run -C tests/testing/chdir chdir.go
EXPECT_DIR=$(PWD) $(TINYGO) run ./tests/testing/chdir/chdir.go
SMOKETEST_SUBTARGETS = \
smoketest-selftest \
smoketest-examples \
smoketest-wasm-sim \
smoketest-nrf \
smoketest-samd \
smoketest-nxp \
smoketest-rp2xxx \
smoketest-pwm-usb \
smoketest-stm32 \
smoketest-avr \
smoketest-esp \
smoketest-riscv \
smoketest-wasm \
smoketest-flags
.PHONY: smoketest $(SMOKETEST_SUBTARGETS)
# Build a binary for every supported board. Run `make -j smoketest` to
# build the groups in parallel.
smoketest: testchdir $(SMOKETEST_SUBTARGETS)
# Each group writes to its own output name so that a parallel build does
# not let one group overwrite the output of another.
SMOKE_OUT = build/smoke/test
build/smoke:
@mkdir -p build/smoke
smoketest-selftest: | build/smoke
$(TINYGO) version
$(TINYGO) targets > /dev/null
# regression test for #2892
cd tests/testing/recurse && ($(TINYGO) test ./... > recurse.log && cat recurse.log && test $$(wc -l < recurse.log) = 2 && rm recurse.log)
# compile-only platform-independent examples
cd tests/text/template/smoke && $(TINYGO) test -c && rm -f smoke.test
# regression test for #2563
cd tests/os/smoke && $(TINYGO) test -c -target=pybadge && rm smoke.test
smoketest-examples: SMOKE_OUT = build/smoke/examples
smoketest-examples: | build/smoke
# test all examples (except pwm)
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pga2350 examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/adc
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/blinkm
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/blinky2
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/button
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/button2
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/echo2
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=circuitplay-express examples/i2s
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/mcp3008
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/memstats
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=microbit examples/microbit-blink
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/pininterrupt
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nano-rp2040 examples/rtcinterrupt
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/systick
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/test
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/time-offset
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=wioterminal examples/hid-mouse
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=wioterminal examples/hid-keyboard
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-rp2040 examples/i2c-target
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-rp2040 examples/watchdog
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-rp2040 examples/device-id
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico2-ice examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -o $(SMOKE_OUT).efi -target=uefi-amd64 examples/test
@$(MD5SUM) $(SMOKE_OUT).efi
smoketest-wasm-sim: SMOKE_OUT = build/smoke/wasm-sim
smoketest-wasm-sim: | build/smoke
# test simulated boards on play.tinygo.org
ifneq ($(WASM), 0)
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=arduino_uno examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=hifive1b examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=reelboard examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=microbit examples/microbit-blink
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=circuitplay_express examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=circuitplay_bluefruit examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=mch2022 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=gopher_badge examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=pico examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).wasm
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o $(SMOKE_OUT).wasm -tags=xiao_esp32s3 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).wasm
endif
smoketest-nrf: SMOKE_OUT = build/smoke/nrf
smoketest-nrf: | build/smoke
# test all targets/boards
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040-s132v6 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=microbit examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=microbit-s110v8 examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=microbit-v2 examples/microbit-blink
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=microbit-v2-s113v7 examples/microbit-blink
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=microbit-v2-s140v7 examples/microbit-blink
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nrf52840-mdk examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=btt-skr-pico examples/uart
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10031 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=reelboard examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=reelboard examples/blinky2
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10056 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10056 examples/blinky2
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10059 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10059 examples/blinky2
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=bluemicro840 examples/blinky2
@$(MD5SUM) $(SMOKE_OUT).hex
smoketest-samd: SMOKE_OUT = build/smoke/samd
smoketest-samd: | build/smoke
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=itsybitsy-m0 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-m0 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=trinket-m0 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=gemma-m0 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=circuitplay-express examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=circuitplay-bluefruit examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=circuitplay-express examples/i2s
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=clue-alpha examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).gba -target=gameboy-advance examples/gba-display
@$(MD5SUM) $(SMOKE_OUT).gba
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=grandcentral-m4 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=itsybitsy-m4 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-m4 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=matrixportal-m4 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pybadge examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=metro-m4-airlift examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pyportal examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=particle-argon examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=particle-boron examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=particle-xenon examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pinetime examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=x9pro examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10056-s140v7 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10059-s140v7 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=reelboard-s140v7 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=wioterminal examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pygamer examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=xiao examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=xiao-ble-plus examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=rak4631 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=circuitplay-express examples/dac
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pyportal examples/dac
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-nrf52840 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-nrf52840-sense examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=itsybitsy-nrf52840 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=qtpy examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).hex
smoketest-nxp: SMOKE_OUT = build/smoke/nxp
smoketest-nxp: | build/smoke
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=teensy41 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=teensy40 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=teensy36 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=p1am-100 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=atsame54-xpro examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=atsame54-xpro examples/can
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-m4-can examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-m4-can examples/caninterrupt
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-nano33 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-mkrwifi1010 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
smoketest-rp2xxx: SMOKE_OUT = build/smoke/rp2xxx
smoketest-rp2xxx: | build/smoke
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico -gc=leaking examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico-w examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nano-33-ble examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nano-rp2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-rp2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=qtpy-rp2040 examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=kb2040 examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=macropad-rp2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=badger2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=badger2040-w examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=tufty2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=thingplus-rp2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=xiao-rp2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=waveshare-rp2040-zero examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=challenger-rp2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=trinkey-qt2040 examples/temp
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=gopher-badge examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=gopher-arcade examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=ae-rp2040 examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=thumby examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico2 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico2-w examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=tiny2350 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=badger2350 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=blinky2350 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico-plus2 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=metro-rp2350 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=waveshare-rp2040-tiny examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=vicharak_shrike-lite examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=xiao-rp2350 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
smoketest-pwm-usb: SMOKE_OUT = build/smoke/pwm-usb
smoketest-pwm-usb: | build/smoke
# test pwm
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=itsybitsy-m0 examples/pwm
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=itsybitsy-m4 examples/pwm
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-m4 examples/pwm
@$(MD5SUM) $(SMOKE_OUT).hex
# test usb
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-nrf52840 examples/hid-keyboard
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=circuitplay-express examples/hid-keyboard
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-nrf52840 examples/usb-midi
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico examples/usb-storage
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico2 examples/usb-storage
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nrf52840-s140v6-uf2-generic examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).hex
smoketest-stm32: SMOKE_OUT = build/smoke/stm32
smoketest-stm32: | build/smoke
ifneq ($(STM32), 0)
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=bluepill examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-stm32f405 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=lgt92 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nucleo-f103rb examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nucleo-f722ze examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nucleo-h753zi examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nucleo-l031k6 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nucleo-l432kc examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nucleo-l476rg examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nucleo-l552ze examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=nucleo-wl55jc examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=stm32f4disco examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=stm32f4disco examples/blinky2
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=stm32f4disco-1 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=stm32f4disco-1 examples/pwm
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=stm32f469disco examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=lorae5 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=swan examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=mksnanov3 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=stm32l0x1 examples/serial
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=stm32u031 examples/empty
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-uno-q examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-uno-q examples/serial
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-uno-q examples/blinkm
@$(MD5SUM) $(SMOKE_OUT).hex
endif
smoketest-avr: SMOKE_OUT = build/smoke/avr
smoketest-avr: | build/smoke
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=atmega328pb examples/blinkm
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=atmega1284p examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-uno examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-leonardo examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-uno examples/pwm
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-uno -scheduler=tasks examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-mega1280 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-mega1280 examples/pwm
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-nano examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=attiny1616 examples/empty
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=digispark examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=digispark examples/pwm
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=digispark examples/mcp3008
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=digispark -gc=leaking examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
smoketest-esp: SMOKE_OUT = build/smoke/esp
smoketest-esp: | build/smoke
ifneq ($(XTENSA), 0)
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32-generic examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32-coreboard-v2 examples/adc
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-generic examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32s3-generic examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32-mini32 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-supermini examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-supermini examples/blinkm
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=nodemcu examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target m5stack-core2 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target m5stack examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target m5stamp-s3a examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target m5stick-c examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target m5paper examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target mch2022 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
# xiao-esp32c6
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=xiao-esp32c6 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=xiao-esp32c6 examples/blinkm
@$(MD5SUM) $(SMOKE_OUT).bin
# xiao-esp32s3
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=xiao-esp32s3 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=xiao-esp32s3 examples/blinkm
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=xiao-esp32s3 examples/mcp3008
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=xiao-esp32s3 examples/pwm
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=xiao-esp32s3 examples/adc
@$(MD5SUM) $(SMOKE_OUT).bin
# esp32s3-supermini
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32s3-supermini examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32s3-supermini examples/blinkm
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32s3-supermini examples/mcp3008
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32s3-supermini examples/adc
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32s3-box-3 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
endif
smoketest-riscv: SMOKE_OUT = build/smoke/riscv
smoketest-riscv: | build/smoke
# esp32c3-supermini
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-supermini examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-supermini examples/blinkm
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-supermini examples/mcp3008
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-supermini examples/pwm
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-supermini examples/adc
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp-c3-32s-kit examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=qtpy-esp32c3 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=m5stamp-c3 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=xiao-esp32c3 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32-c3-devkit-rust-1 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-12f examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=makerfabs-esp32c3spi35 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=hifive1b examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=maixbit examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=tkey examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=elecrow-rp2040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=elecrow-rp2350 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=hw-651 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=hw-651-s110v8 examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).hex
smoketest-wasm: SMOKE_OUT = build/smoke/wasm
smoketest-wasm: | build/smoke
ifneq ($(WASM), 0)
$(TINYGO) build -size short -o $(SMOKE_OUT).wasm -target=wasm examples/wasm/export
$(TINYGO) build -size short -o $(SMOKE_OUT).wasm -target=wasm examples/wasm/main
$(TINYGO) build -size short -o $(SMOKE_OUT).wasm -target=wasm-unknown examples/hello-wasm-unknown
endif
smoketest-flags: SMOKE_OUT = build/smoke/flags
smoketest-flags: | build/smoke
# test various compiler flags
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 -gc=none -scheduler=none examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 -opt=1 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 -serial=none examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 -serial=rtt examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -o $(SMOKE_OUT).nro -target=nintendoswitch examples/echo2
@$(MD5SUM) $(SMOKE_OUT).nro
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 -opt=0 ./testdata/stdlib.go
@$(MD5SUM) $(SMOKE_OUT).hex
GOOS=linux GOARCH=arm $(TINYGO) build -size short -o $(SMOKE_OUT).elf ./testdata/cgo
GOOS=linux GOARCH=mips $(TINYGO) build -size short -o $(SMOKE_OUT).elf ./testdata/cgo
GOOS=windows GOARCH=amd64 $(TINYGO) build -size short -o $(SMOKE_OUT).exe ./testdata/cgo
GOOS=windows GOARCH=arm64 $(TINYGO) build -size short -o $(SMOKE_OUT).exe ./testdata/cgo
GOOS=darwin GOARCH=amd64 $(TINYGO) build -size short -o $(SMOKE_OUT) ./testdata/cgo
GOOS=darwin GOARCH=arm64 $(TINYGO) build -size short -o $(SMOKE_OUT) ./testdata/cgo
ifneq ($(OS),Windows_NT)
# TODO: this does not yet work on Windows. Somehow, unused functions are
# not garbage collected.
$(TINYGO) build -o $(SMOKE_OUT).elf -gc=leaking -scheduler=none examples/serial
endif
# A representative board for each processor architecture. This answers the
# question "can TinyGo build a binary for each architecture" at a fraction of
# the cost of the full smoke test, which runs separately on Linux.
.PHONY: smoketest-quick
smoketest-quick: SMOKE_OUT = build/smoke/quick
smoketest-quick: testchdir | build/smoke
$(TINYGO) version
$(TINYGO) targets > /dev/null
# regression test for #2892
cd tests/testing/recurse && ($(TINYGO) test ./... > recurse.log && cat recurse.log && test $$(wc -l < recurse.log) = 2 && rm recurse.log)
# nrf51, Cortex-M0
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=microbit examples/microbit-blink
@$(MD5SUM) $(SMOKE_OUT).hex
# nrf52, Cortex-M4
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10040 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# nrf52840 with SoftDevice, which uses a different memory layout
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pca10056-s140v7 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# samd21, Cortex-M0+
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=circuitplay-express examples/i2s
@$(MD5SUM) $(SMOKE_OUT).hex
# samd51, Cortex-M4 with hardware floating point
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=feather-m4 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# same5x, which adds CAN
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=atsame54-xpro examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# rp2040, dual Cortex-M0+ with a second stage bootloader
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# rp2350, Cortex-M33
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=pico2 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# i.MX RT1062, Cortex-M7
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=teensy41 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# ARM7TDMI, the only target that is not Thumb-2
$(TINYGO) build -size short -o $(SMOKE_OUT).gba -target=gameboy-advance examples/gba-display
@$(MD5SUM) $(SMOKE_OUT).gba
# AVR, ATmega328p
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=arduino-uno examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# AVR, ATtiny85, which has a smaller instruction set than the ATmega
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=digispark examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# RISC-V 32 bit, esp32c3. Not behind the XTENSA flag, so the compatibility
# test also builds it.
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32c3-supermini examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).bin
# RISC-V 32 bit, SiFive E31
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=hifive1b examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# RISC-V 64 bit, the only 64 bit baremetal target
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=maixbit examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# x86-64 with PE/COFF output
$(TINYGO) build -size short -o $(SMOKE_OUT).efi -target=uefi-amd64 examples/test
@$(MD5SUM) $(SMOKE_OUT).efi
# aarch64
$(TINYGO) build -o $(SMOKE_OUT).nro -target=nintendoswitch examples/echo2
@$(MD5SUM) $(SMOKE_OUT).nro
# cross compilation with cgo
GOOS=linux GOARCH=arm $(TINYGO) build -size short -o $(SMOKE_OUT).elf ./testdata/cgo
ifneq ($(STM32), 0)
# STM32F1, Cortex-M3
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=bluepill examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
# STM32F4, Cortex-M4 with hardware floating point
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=stm32f4disco examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
endif
ifneq ($(XTENSA), 0)
# Xtensa LX6
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32-coreboard-v2 examples/adc
@$(MD5SUM) $(SMOKE_OUT).bin
# Xtensa LX7
$(TINYGO) build -size short -o $(SMOKE_OUT).bin -target=esp32s3-generic examples/machinetest
@$(MD5SUM) $(SMOKE_OUT).bin
endif
ifneq ($(WASM), 0)
# wasm with the JavaScript host bindings
$(TINYGO) build -size short -o $(SMOKE_OUT).wasm -target=wasm examples/wasm/main
# wasm without a host, so without any imports
$(TINYGO) build -size short -o $(SMOKE_OUT).wasm -target=wasm-unknown examples/hello-wasm-unknown
endif
ifneq ($(OS),Windows_NT)
# TODO: this does not yet work on Windows. Somehow, unused functions are
# not garbage collected.
$(TINYGO) build -o $(SMOKE_OUT).elf -gc=leaking -scheduler=none examples/serial
endif
+294
View File
@@ -0,0 +1,294 @@
# Test suites: compiler tests, standard library tests, benchmarks, and the corpus.
.PHONY: test wasmtest
test: check-nodejs-version
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags "byollvm llvm22 osusergo" $(GOTESTPKGS)
# Standard library packages that pass tests on darwin, linux, wasi, and windows, but take over a minute in wasi
TEST_PACKAGES_SLOW = \
compress/bzip2 \
crypto/dsa \
index/suffixarray \
# Standard library packages that pass tests quickly on darwin, linux, wasi, and windows
TEST_PACKAGES_FAST = \
cmp \
compress/lzw \
compress/zlib \
container/heap \
container/list \
container/ring \
crypto/ecdsa \
crypto/elliptic \
crypto/md5 \
crypto/sha1 \
crypto/sha256 \
crypto/sha512 \
database/sql/driver \
debug/macho \
embed/internal/embedtest \
encoding \
encoding/ascii85 \
errors \
encoding/asn1 \
encoding/base32 \
encoding/base64 \
encoding/csv \
encoding/hex \
expvar \
go/ast \
go/format \
go/scanner \
go/token \
go/version \
hash \
hash/adler32 \
hash/crc64 \
hash/fnv \
html \
internal/itoa \
internal/profile \
math \
math/cmplx \
net/http/internal/ascii \
net/mail \
net/url \
os \
path \
reflect \
sync \
testing \
testing/iotest \
text/scanner \
unicode \
unicode/utf16 \
unicode/utf8 \
unique \
$(nil)
# archive/zip requires os.ReadAt, which is not yet supported on windows
# bytes requires mmap
# compress/flate appears to hang on wasi
# crypto/aes needs reflect.Type.Method(), not yet implemented
# crypto/des fails on wasi, needs panic()/recover()
# crypto/hmac fails on wasi, it exits with a "slice out of range" panic
# debug/plan9obj requires os.ReadAt, which is not yet supported on windows
# encoding/xml takes a minute on linux and gives a stack overflow on wasi
# image fails on wasi, needs panic()/recover()
# io/ioutil requires os.ReadDir, which is not yet supported on windows or wasi
# mime: fails on wasi, needs panic()/recover()
# mime/multipart: needs wasip1 syscall.FDFLAG_NONBLOCK
# mime/quotedprintable requires syscall.Faccessat
# net/mail: needs wasip1 syscall.FDFLAG_NONBLOCK
# net/ntextproto: needs wasip1 syscall.FDFLAG_NONBLOCK
# regexp/syntax: fails on wasip1, needs panic()/recover()
# strconv: fails on wasi, needs panic()/recover()
# text/tabwriter: fails on wasi, needs panic()/recover()
# text/template/parse: fails on wasi, needs panic()/recover()
# testing/fstest requires os.ReadDir, which is not yet supported on windows or wasi
# Additional standard library packages that pass tests on individual platforms
TEST_PACKAGES_LINUX := \
archive/zip \
compress/flate \
context \
crypto/aes \
crypto/des \
crypto/ecdh \
crypto/hmac \
debug/dwarf \
debug/plan9obj \
encoding/xml \
image \
io/ioutil \
mime \
mime/multipart \
mime/quotedprintable \
net \
net/mail \
net/textproto \
os/user \
regexp/syntax \
strconv \
testing/fstest \
text/tabwriter \
text/template/parse
TEST_PACKAGES_DARWIN := $(TEST_PACKAGES_LINUX)
# os/user requires t.Skip() support
TEST_PACKAGES_WINDOWS := \
compress/flate \
crypto/des \
crypto/hmac \
image \
mime \
regexp/syntax \
strconv \
text/tabwriter \
text/template/parse \
$(nil)
# These packages cannot be tested on wasm, mostly because these tests assume a
# working filesystem. This could perhaps be fixed, by supporting filesystem
# access when running inside Node.js.
TEST_PACKAGES_WASM = $(filter-out $(TEST_PACKAGES_NONWASM), $(TEST_PACKAGES_FAST))
TEST_PACKAGES_NONWASM = \
compress/lzw \
compress/zlib \
crypto/ecdsa \
debug/macho \
embed/internal/embedtest \
expvar \
go/format \
os \
testing \
$(nil)
# These packages cannot be tested on baremetal.
#
# Some reasons why the tests don't pass on baremetal:
#
# * No filesystem is available, so packages like compress/zlib can't be tested
# (just like wasm).
# * picolibc math functions apparently are less precise, the math package
# fails on baremetal.
# * Since Go 1.27 the crypto tests below go through cryptotest.TestHash, which
# calls cryptotest.BoundarySlices. These targets report GOOS=linux, so they
# build boundary.go (//go:build linux || darwin) rather than
# boundary_compat.go, and that needs a working syscall.Mmap/syscall.Mprotect
# which we don't have. See #5593.
TEST_PACKAGES_BAREMETAL = $(filter-out $(TEST_PACKAGES_NONBAREMETAL), $(TEST_PACKAGES_FAST))
TEST_PACKAGES_NONBAREMETAL = \
$(TEST_PACKAGES_NONWASM) \
$(TEST_PACKAGES_NOBOUNDARYSLICES) \
math \
$(nil)
TEST_PACKAGES_FAST_WASI = $(filter-out $(TEST_PACKAGES_NOWASI), $(TEST_PACKAGES_FAST))
TEST_PACKAGES_NOWASI = \
crypto/ecdsa \
$(nil)
# wasip1 reports GOOS=wasip1 and so gets the boundary_compat.go fallback, but
# wasip2 reports GOOS=linux and hits the same BoundarySlices problem as
# baremetal. On wasip2 syscall.Mmap returns ENOSYS and t.Fatalf cannot Goexit,
# so the test falls through and panics with "slice out of range".
TEST_PACKAGES_FAST_WASIP2 = $(filter-out $(TEST_PACKAGES_NOBOUNDARYSLICES), $(TEST_PACKAGES_FAST_WASI))
TEST_PACKAGES_NOBOUNDARYSLICES = \
crypto/md5 \
crypto/sha1 \
crypto/sha256 \
crypto/sha512 \
$(nil)
# Report platforms on which each standard library package is known to pass tests
report-stdlib-tests-pass:
$(eval jointmp := $(shell echo /tmp/join.$$$$))
@for t in $(TEST_PACKAGES_DARWIN); do echo "$$t darwin"; done | sort > $(jointmp).darwin
@for t in $(TEST_PACKAGES_LINUX); do echo "$$t linux"; done | sort > $(jointmp).linux
@for t in $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW); do echo "$$t darwin linux wasi windows"; done | sort > $(jointmp).portable
@join -a1 -a2 $(jointmp).darwin $(jointmp).linux | \
join -a1 -a2 - $(jointmp).portable
@rm $(jointmp).*
# Standard library packages that pass tests quickly on the current platform
ifeq ($(uname),Darwin)
TEST_PACKAGES_HOST := $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_DARWIN)
TEST_IOFS := true
TEST_ENCODING_XML := true
endif
ifeq ($(uname),Linux)
TEST_PACKAGES_HOST := $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_LINUX)
TEST_IOFS := true
TEST_ENCODING_XML := true
endif
ifeq ($(OS),Windows_NT)
TEST_PACKAGES_HOST := $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_WINDOWS)
TEST_IOFS := false
endif
TEST_SKIP_FLAG := -skip='TestExtraMethods|TestParseAndBytesRoundTrip/P256/Generic|TestAsValidation|TestUnmarshalNestingLimitSlice|TestUnmarshalNestingLimitStruct'
TEST_ADDITIONAL_FLAGS ?=
# Test known-working standard library packages.
# TODO: parallelize, and only show failing tests (no implied -v flag).
.PHONY: tinygo-test
tinygo-test:
@# TestExtraMethods: used by many crypto packages and uses reflect.Type.Method which is not implemented.
@# 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)
ifeq ($(TEST_ENCODING_XML),true)
$(TINYGO) test $(TEST_ADDITIONAL_FLAGS) $(TEST_SKIP_FLAG) -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.
@# For more details, see the comments on issue #3143.
ifeq ($(TEST_IOFS),true)
$(TINYGO) test -stack-size=6MB io/fs
endif
tinygo-test-fast:
$(TINYGO) test $(TEST_SKIP_FLAG) $(TEST_PACKAGES_HOST)
tinygo-bench:
$(TINYGO) test -bench . $(TEST_PACKAGES_HOST) $(TEST_PACKAGES_SLOW)
tinygo-bench-fast:
$(TINYGO) test -bench . $(TEST_PACKAGES_HOST)
# Same thing, except for wasi rather than the current platform.
tinygo-test-wasm:
$(TINYGO) test -target wasm $(TEST_SKIP_FLAG) $(TEST_PACKAGES_WASM)
tinygo-test-wasi:
$(TINYGO) test -target wasip1 $(TEST_SKIP_FLAG) $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW) ./tests/runtime_wasi
tinygo-test-wasip1:
GOOS=wasip1 GOARCH=wasm $(TINYGO) test $(TEST_SKIP_FLAG) $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW) ./tests/runtime_wasi
tinygo-test-wasip1-fast:
$(TINYGO) test -target=wasip1 $(TEST_SKIP_FLAG) $(TEST_PACKAGES_FAST_WASI) ./tests/runtime_wasi
tinygo-test-wasip2-slow:
$(TINYGO) test -target=wasip2 $(TEST_SKIP_FLAG) $(TEST_PACKAGES_SLOW)
tinygo-test-wasip2-fast:
$(TINYGO) test -target=wasip2 $(TEST_SKIP_FLAG) $(TEST_PACKAGES_FAST_WASIP2) ./tests/runtime_wasi
tinygo-test-wasip2-sum-slow:
TINYGO=$(TINYGO) \
TARGET=wasip2 \
TESTOPTS="-x -work" \
PACKAGES="$(TEST_PACKAGES_SLOW)" \
gotestsum --raw-command -- ./tools/tgtestjson.sh
tinygo-test-wasip2-sum-fast:
TINYGO=$(TINYGO) \
TARGET=wasip2 \
TESTOPTS="-x -work" \
PACKAGES="$(TEST_PACKAGES_FAST)" \
gotestsum --raw-command -- ./tools/tgtestjson.sh
tinygo-bench-wasip1:
$(TINYGO) test -target wasip1 -bench . $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW)
tinygo-bench-wasip1-fast:
$(TINYGO) test -target wasip1 -bench . $(TEST_PACKAGES_FAST)
tinygo-bench-wasip2:
$(TINYGO) test -target wasip2 -bench . $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW)
tinygo-bench-wasip2-fast:
$(TINYGO) test -target wasip2 -bench . $(TEST_PACKAGES_FAST)
# Run tests on riscv-qemu since that one provides a large amount of memory.
tinygo-test-baremetal:
$(TINYGO) test -target riscv-qemu $(TEST_SKIP_FLAG) $(TEST_PACKAGES_BAREMETAL)
# Test external packages in a large corpus.
test-corpus:
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags "byollvm llvm22" -run TestCorpus . -corpus=testdata/corpus.yaml
test-corpus-fast:
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags "byollvm llvm22" -run TestCorpus -short . -corpus=testdata/corpus.yaml
test-corpus-wasi:
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags "byollvm llvm22" -run TestCorpus . -corpus=testdata/corpus.yaml -target=wasip1
test-corpus-wasip2:
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags "byollvm llvm22" -run TestCorpus . -corpus=testdata/corpus.yaml -target=wasip2
wasmtest:
cd ./tests/wasm && $(GO) test .
+36
View File
@@ -0,0 +1,36 @@
# Developer tooling: lint, spellcheck, and the help target.
.PHONY: tools
tools:
go generate -tags tools ./
LINTDIRS=src/os/ src/reflect/
.PHONY: lint
lint: tools ## Lint source tree
revive -version
# TODO: lint more directories!
# revive.toml isn't flexible enough to filter out just one kind of error from a checker, so do it with grep here.
# Can't use grep with friendly formatter. Plain output isn't too bad, though.
# Use 'grep .' to get rid of stray blank line
revive -config revive.toml compiler/... $$( find $(LINTDIRS) -type f -name '*.go' ) \
| grep -v "should have comment or be unexported" \
| grep '.' \
| awk '{print}; END {exit NR>0}'
SPELLDIRSCMD=find . -depth 1 -type d | egrep -wv '.git|lib|llvm|src'; find src -depth 1 | egrep -wv 'device|internal|net|vendor'; find src/internal -depth 1 -type d | egrep -wv src/internal/wasi
.PHONY: spell
spell: tools ## Spellcheck source tree
misspell -error --dict misspell.csv -i 'ackward,devided,extint,rela' $$( $(SPELLDIRSCMD) ) *.go *.md
.PHONY: spellfix
spellfix: tools ## Same as spell, but fixes what it finds
misspell -w --dict misspell.csv -i 'ackward,devided,extint,rela' $$( $(SPELLDIRSCMD) ) *.go *.md
# https://www.client9.com/self-documenting-makefiles/
.PHONY: help
help:
@awk -F ':|##' '/^[^\t].+?:.*?##/ {\
gsub(/\$$\(LLVM_BUILDDIR\)/, "$(LLVM_BUILDDIR)"); \
printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF \
}' $(MAKEFILE_LIST)
#.DEFAULT_GOAL=help