More CI tragets: Linux 32bit, LTO, Windows and Cosmopolitan

Atomics support in Windows requires libwinpthread*.dll at runtime. One
way to get it is to install it with MinGW package, and copy alongside
the executable.

Update test Makefile targets for windows executables.

Allow running tests with Wine: `make WINE=wine CONFIG_WIN3=y
...`. That's useful when Wine binfmt support cannot be installed such
as on the CI hosts.

Add PPC64LE architecture and try to fix flaky multi-arch CI in gcc:
https://github.com/tonistiigi/binfmt/issues/215
This commit is contained in:
Nick Vatamaniuc 2025-03-25 17:36:09 -04:00 committed by Nick Vatamaniuc
parent e5e724829a
commit c0958ee2d0
No known key found for this signature in database
GPG Key ID: FC04DFBC9657A78E
3 changed files with 162 additions and 22 deletions

View File

@ -37,6 +37,44 @@ jobs:
run: | run: |
make microbench make microbench
linux-lto:
name: Linux LTO
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build
run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_LTO=y
- name: Run built-in tests
run: |
make test
- name: Run microbench
run: |
make microbench
linux-32bit:
name: Linux 32bit
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install gcc-multilib
run: |
sudo apt install -y gcc-multilib
- name: Build
run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_M32=y
- name: Run built-in tests
run: |
make CONFIG_M32=y test
linux-asan: linux-asan:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -142,6 +180,85 @@ jobs:
./qjs -qd ./qjs -qd
gmake test gmake test
cosmopolitan:
name: Cosmopolitan
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Cosmopolitan
run: |
mkdir ~/cosmocc
cd ~/cosmocc
wget https://cosmo.zip/pub/cosmocc/cosmocc.zip
unzip cosmocc.zip
echo "$HOME/cosmocc/bin" >> "$GITHUB_PATH"
- name: Build
run: |
make CONFIG_COSMO=y
- name: Run built-in tests
run: |
make CONFIG_COSMO=y test
mingw-windows:
name: MinGW Windows target
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install MinGW and Wine
run: |
sudo apt install -y wine mingw-w64
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll .
- name: Setup Wine
run: |
wine --version
winecfg /v
# binfmt doesn't work in GitHub Actions
#sudo apt install -y binfmt-support wine-binfmt
#echo ":Wine:M::MZ::/usr/bin/wine:" > /etc/binfmt.d/wine.conf
#sudo systemctl restart systemd-binfmt
- name: Build
run: |
make CONFIG_WIN32=y
- name: Run built-in tests
run: |
# If binfmt support worked, could just run `make CONFIG_WIN32=y test`
make WINE=/usr/bin/wine CONFIG_WIN32=y test
windows-msys:
name: Windows MSYS2
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: git make mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-dlfcn
- name: Build
run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y
- name: Stats
run: |
./qjs -qd
- name: Run built-in tests
run: |
make test
- name: Run microbench
run: |
make microbench
qemu-alpine: qemu-alpine:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -155,12 +272,14 @@ jobs:
- linux/arm/v6 - linux/arm/v6
- linux/arm/v7 - linux/arm/v7
- linux/s390x - linux/s390x
- linux/ppc64le
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Get qemu - name: Get qemu
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes # See https://github.com/tonistiigi/binfmt/issues/215#issuecomment-2613004741
run: docker run --privileged --rm tonistiigi/binfmt:master --install all
- name: Run tests on ${{ matrix.platform }} - name: Run tests on ${{ matrix.platform }}
run: docker run --rm --interactive --mount type=bind,source=$(pwd),target=/host --platform ${{ matrix.platform }} alpine sh -c "apk add git patch make gcc libc-dev && cd /host && make test" run: docker run --rm --interactive --mount type=bind,source=$(pwd),target=/host --platform ${{ matrix.platform }} alpine sh -c "apk add git patch make gcc libc-dev && cd /host && make test"

7
.gitignore vendored
View File

@ -6,14 +6,20 @@ test_fib.c
examples/*.so examples/*.so
examples/hello examples/hello
examples/hello_module examples/hello_module
examples/hello.exe
examples/test_fib.exe
hello.c hello.c
microbench*.txt microbench*.txt
qjs qjs
qjs.exe
qjsc qjsc
qjsc.exe
host-qjsc
qjscalc qjscalc
qjscalc.c qjscalc.c
repl.c repl.c
run-test262 run-test262
run-test262.exe
test262 test262
test262_*.txt test262_*.txt
test262o test262o
@ -22,3 +28,4 @@ unicode
unicode_gen unicode_gen
run_octane run_octane
run_sunspider_like run_sunspider_like
libwinpthread*.dll

View File

@ -29,6 +29,9 @@ ifeq ($(shell uname -s),FreeBSD)
CONFIG_FREEBSD=y CONFIG_FREEBSD=y
endif endif
# Windows cross compilation from Linux # Windows cross compilation from Linux
# May need to have libwinpthread*.dll alongside the executable
# (On Ubuntu/Debian may be installed with mingw-w64-x86-64-dev
# to /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll)
#CONFIG_WIN32=y #CONFIG_WIN32=y
# use link time optimization (smaller and faster executables but slower build) # use link time optimization (smaller and faster executables but slower build)
#CONFIG_LTO=y #CONFIG_LTO=y
@ -82,6 +85,10 @@ ifdef CONFIG_WIN32
CROSS_PREFIX?=x86_64-w64-mingw32- CROSS_PREFIX?=x86_64-w64-mingw32-
endif endif
EXE=.exe EXE=.exe
else ifdef MSYSTEM
CONFIG_WIN32=y
CROSS_PREFIX?=
EXE=.exe
else else
CROSS_PREFIX?= CROSS_PREFIX?=
EXE= EXE=
@ -189,11 +196,14 @@ endif
ifndef CONFIG_COSMO ifndef CONFIG_COSMO
ifndef CONFIG_DARWIN ifndef CONFIG_DARWIN
ifndef CONFIG_WIN32
CONFIG_SHARED_LIBS=y # building shared libraries is supported CONFIG_SHARED_LIBS=y # building shared libraries is supported
endif endif
endif endif
endif
PROGS=qjs$(EXE) qjsc$(EXE) run-test262$(EXE)
PROGS=qjs$(EXE) qjsc$(EXE) run-test262
ifneq ($(CROSS_PREFIX),) ifneq ($(CROSS_PREFIX),)
QJSC_CC=gcc QJSC_CC=gcc
QJSC=./host-qjsc QJSC=./host-qjsc
@ -215,8 +225,10 @@ ifndef CONFIG_UBSAN
PROGS+=examples/hello examples/test_fib PROGS+=examples/hello examples/test_fib
# no -m32 option in qjsc # no -m32 option in qjsc
ifndef CONFIG_M32 ifndef CONFIG_M32
ifndef CONFIG_WIN32
PROGS+=examples/hello_module PROGS+=examples/hello_module
endif endif
endif
ifdef CONFIG_SHARED_LIBS ifdef CONFIG_SHARED_LIBS
PROGS+=examples/fib.so examples/point.so PROGS+=examples/fib.so examples/point.so
endif endif
@ -232,9 +244,9 @@ QJS_LIB_OBJS=$(OBJDIR)/quickjs.o $(OBJDIR)/dtoa.o $(OBJDIR)/libregexp.o $(OBJDIR
QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OBJS) QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OBJS)
HOST_LIBS=-lm -ldl -lpthread HOST_LIBS=-lm -ldl -lpthread
LIBS=-lm LIBS=-lm -lpthread
ifndef CONFIG_WIN32 ifndef CONFIG_WIN32
LIBS+=-ldl -lpthread LIBS+=-ldl
endif endif
LIBS+=$(EXTRA_LIBS) LIBS+=$(EXTRA_LIBS)
@ -305,7 +317,7 @@ libunicode-table.h: unicode_gen
./unicode_gen unicode $@ ./unicode_gen unicode $@
endif endif
run-test262: $(OBJDIR)/run-test262.o $(QJS_LIB_OBJS) run-test262$(EXE): $(OBJDIR)/run-test262.o $(QJS_LIB_OBJS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
run-test262-debug: $(patsubst %.o, %.debug.o, $(OBJDIR)/run-test262.o $(QJS_LIB_OBJS)) run-test262-debug: $(patsubst %.o, %.debug.o, $(OBJDIR)/run-test262.o $(QJS_LIB_OBJS))
@ -348,8 +360,8 @@ clean:
rm -f *.a *.o *.d *~ unicode_gen regexp_test fuzz_eval fuzz_compile fuzz_regexp $(PROGS) rm -f *.a *.o *.d *~ unicode_gen regexp_test fuzz_eval fuzz_compile fuzz_regexp $(PROGS)
rm -f hello.c test_fib.c rm -f hello.c test_fib.c
rm -f examples/*.so tests/*.so rm -f examples/*.so tests/*.so
rm -rf $(OBJDIR)/ *.dSYM/ qjs-debug rm -rf $(OBJDIR)/ *.dSYM/ qjs-debug$(EXE)
rm -rf run-test262-debug rm -rf run-test262-debug$(EXE)
rm -f run_octane run_sunspider_like rm -f run_octane run_sunspider_like
install: all install: all
@ -427,25 +439,27 @@ ifdef CONFIG_SHARED_LIBS
test: tests/bjson.so examples/point.so test: tests/bjson.so examples/point.so
endif endif
test: qjs test: qjs$(EXE)
./qjs tests/test_closure.js $(WINE) ./qjs$(EXE) tests/test_closure.js
./qjs tests/test_language.js $(WINE) ./qjs$(EXE) tests/test_language.js
./qjs --std tests/test_builtin.js $(WINE) ./qjs$(EXE) --std tests/test_builtin.js
./qjs tests/test_loop.js $(WINE) ./qjs$(EXE) tests/test_loop.js
./qjs tests/test_bigint.js $(WINE) ./qjs$(EXE) tests/test_bigint.js
./qjs tests/test_std.js $(WINE) ./qjs$(EXE) tests/test_cyclic_import.js
./qjs tests/test_worker.js $(WINE) ./qjs$(EXE) tests/test_worker.js
./qjs tests/test_cyclic_import.js ifndef CONFIG_WIN32
$(WINE) ./qjs$(EXE) tests/test_std.js
endif
ifdef CONFIG_SHARED_LIBS ifdef CONFIG_SHARED_LIBS
./qjs tests/test_bjson.js $(WINE) ./qjs$(EXE) tests/test_bjson.js
./qjs examples/test_point.js $(WINE) ./qjs$(EXE) examples/test_point.js
endif endif
stats: qjs stats: qjs$(EXE)
./qjs -qd $(WINE) ./qjs$(EXE) -qd
microbench: qjs microbench: qjs$(EXE)
./qjs --std tests/microbench.js $(WINE) ./qjs$(EXE) --std tests/microbench.js
ifeq ($(wildcard test262o/tests.txt),) ifeq ($(wildcard test262o/tests.txt),)
test2o test2o-update: test2o test2o-update: