Skip to content

Commit 54b562d

Browse files
committed
More CI tragets: Linux 32bit, Windows (MinGW/Wine) 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.
1 parent 29630bc commit 54b562d

File tree

3 files changed

+103
-17
lines changed

3 files changed

+103
-17
lines changed

.github/workflows/ci.yml

+71
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,25 @@ jobs:
3737
run: |
3838
make microbench
3939
40+
linux-32bit:
41+
name: Linux 32bit (Ubuntu)
42+
runs-on: ubuntu-latest
43+
strategy:
44+
fail-fast: false
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
submodules: true
49+
- name: Install gcc-multilib
50+
run: |
51+
sudo apt install -y gcc-multilib
52+
- name: Build
53+
run: |
54+
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_M32=y
55+
- name: Run built-in tests
56+
run: |
57+
make CONFIG_M32=y test
58+
4059
linux-asan:
4160
runs-on: ubuntu-latest
4261
steps:
@@ -142,6 +161,58 @@ jobs:
142161
./qjs -qd
143162
gmake test
144163
164+
cosmopolitan:
165+
name: Cosmopolitan
166+
runs-on: ubuntu-latest
167+
strategy:
168+
fail-fast: false
169+
steps:
170+
- uses: actions/checkout@v4
171+
with:
172+
submodules: true
173+
- name: Install Cosmopolitan
174+
run: |
175+
mkdir ~/cosmocc
176+
cd ~/cosmocc
177+
wget https://cosmo.zip/pub/cosmocc/cosmocc.zip
178+
unzip cosmocc.zip
179+
echo "$HOME/cosmocc/bin" >> "$GITHUB_PATH"
180+
- name: Build
181+
run: |
182+
make CONFIG_COSMO=y
183+
- name: Run built-in tests
184+
run: |
185+
make CONFIG_COSMO=y test
186+
187+
windows-mingw:
188+
name: MinGW cross-compile for Windows on Linux
189+
runs-on: ubuntu-latest
190+
strategy:
191+
fail-fast: false
192+
steps:
193+
- uses: actions/checkout@v4
194+
with:
195+
submodules: true
196+
- name: Install MinGW and Wine
197+
run: |
198+
sudo apt install -y wine mingw-w64
199+
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll .
200+
- name: Setup Wine
201+
run: |
202+
wine --version
203+
winecfg /v
204+
# binfmt doesn't work in GitHub Actions
205+
#sudo apt install -y binfmt-support wine-binfmt
206+
#echo ":Wine:M::MZ::/usr/bin/wine:" > /etc/binfmt.d/wine.conf
207+
#sudo systemctl restart systemd-binfmt
208+
- name: Build
209+
run: |
210+
make CONFIG_WIN32=y
211+
- name: Run built-in tests
212+
run: |
213+
# If binfmt support worked, could just run `make CONFIG_WIN32=y test`
214+
make WINE=/usr/bin/wine CONFIG_WIN32=y test
215+
145216
qemu-alpine:
146217
runs-on: ubuntu-latest
147218

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ examples/hello_module
99
hello.c
1010
microbench*.txt
1111
qjs
12+
qjs.exe
1213
qjsc
14+
qjsc.exe
15+
host-qjsc
1316
qjscalc
1417
qjscalc.c
1518
repl.c
@@ -22,3 +25,4 @@ unicode
2225
unicode_gen
2326
run_octane
2427
run_sunspider_like
28+
libwinpthread*.dll

Makefile

+28-17
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ ifeq ($(shell uname -s),FreeBSD)
2929
CONFIG_FREEBSD=y
3030
endif
3131
# Windows cross compilation from Linux
32+
# May need to have libwinpthread*.dll alongside the executable
33+
# (On Ubuntu/Debian may be installed with mingw-w64-x86-64-dev
34+
# to /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll)
3235
#CONFIG_WIN32=y
3336
# use link time optimization (smaller and faster executables but slower build)
3437
#CONFIG_LTO=y
@@ -189,11 +192,17 @@ endif
189192

190193
ifndef CONFIG_COSMO
191194
ifndef CONFIG_DARWIN
195+
ifndef CONFIG_WIN32
192196
CONFIG_SHARED_LIBS=y # building shared libraries is supported
193197
endif
194198
endif
199+
endif
200+
201+
PROGS=qjs$(EXE) qjsc$(EXE)
202+
ifndef CONFIG_WIN32
203+
PROGS+=run-test262
204+
endif
195205

196-
PROGS=qjs$(EXE) qjsc$(EXE) run-test262
197206
ifneq ($(CROSS_PREFIX),)
198207
QJSC_CC=gcc
199208
QJSC=./host-qjsc
@@ -232,9 +241,9 @@ QJS_LIB_OBJS=$(OBJDIR)/quickjs.o $(OBJDIR)/dtoa.o $(OBJDIR)/libregexp.o $(OBJDIR
232241
QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OBJS)
233242

234243
HOST_LIBS=-lm -ldl -lpthread
235-
LIBS=-lm
244+
LIBS=-lm -lpthread
236245
ifndef CONFIG_WIN32
237-
LIBS+=-ldl -lpthread
246+
LIBS+=-ldl
238247
endif
239248
LIBS+=$(EXTRA_LIBS)
240249

@@ -427,24 +436,26 @@ ifdef CONFIG_SHARED_LIBS
427436
test: tests/bjson.so examples/point.so
428437
endif
429438

430-
test: qjs
431-
./qjs tests/test_closure.js
432-
./qjs tests/test_language.js
433-
./qjs --std tests/test_builtin.js
434-
./qjs tests/test_loop.js
435-
./qjs tests/test_bigint.js
436-
./qjs tests/test_std.js
437-
./qjs tests/test_worker.js
439+
test: qjs$(EXE)
440+
$(WINE) ./qjs$(EXE) tests/test_closure.js
441+
$(WINE) ./qjs$(EXE) tests/test_language.js
442+
$(WINE) ./qjs$(EXE) --std tests/test_builtin.js
443+
$(WINE) ./qjs$(EXE) tests/test_loop.js
444+
$(WINE) ./qjs$(EXE) tests/test_bigint.js
445+
ifndef CONFIG_WIN32
446+
$(WINE) ./qjs$(EXE) tests/test_std.js
447+
$(WINE) ./qjs$(EXE) tests/test_worker.js
448+
endif
438449
ifdef CONFIG_SHARED_LIBS
439-
./qjs tests/test_bjson.js
440-
./qjs examples/test_point.js
450+
$(WINE) ./qjs$(EXE) tests/test_bjson.js
451+
$(WINE) ./qjs$(EXE) examples/test_point.js
441452
endif
442453

443-
stats: qjs
444-
./qjs -qd
454+
stats: qjs$(EXE)
455+
$(WINE) ./qjs$(EXE) -qd
445456

446-
microbench: qjs
447-
./qjs --std tests/microbench.js
457+
microbench: qjs$(EXE)
458+
$(WINE) ./qjs$(EXE) --std tests/microbench.js
448459

449460
ifeq ($(wildcard test262o/tests.txt),)
450461
test2o test2o-update:

0 commit comments

Comments
 (0)