Add CI targets, fix test_std.js (#247)

This switches the exec test to `SIGTERM` rather than `SIGQUIT` since the
latter didn’t seem to work in QEMU, and the distinction doesn’t really
matter for this test.

This also makes the `isatty()` check smarter by checking whether `STDIN`
is, in fact, a terminal.

Added qemu-alpine targets i386, arm32v6, arm32v7, arm64v8, s390x

Co-authored-by: Felipe Gasper <felipe@felipegasper.com>
This commit is contained in:
Charlie Gordon 2024-03-03 21:57:38 +01:00 committed by GitHub
parent ebe7496d14
commit 6a89d7c270
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 58 additions and 31 deletions

View file

@ -12,40 +12,41 @@ on:
- '.github/workflows/ci.yml' - '.github/workflows/ci.yml'
push: push:
branches: branches:
- master - '*'
jobs: jobs:
linux: linux:
name: Linux (Ubuntu)
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: build - name: Build
run: | run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y
- name: stats - name: Stats
run: | run: |
./qjs -qd ./qjs -qd
- name: test - name: Run built-in tests
run: | run: |
make test make test
- name: microbench - name: Run microbench
run: | run: |
make microbench make microbench
linux-asan: linux-asan:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: build - name: Build
run: | run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_ASAN=y make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_ASAN=y
- name: test - name: Run built-in tests
env: env:
ASAN_OPTIONS: halt_on_error=1 ASAN_OPTIONS: halt_on_error=1
run: | run: |
@ -54,15 +55,15 @@ jobs:
linux-msan: linux-msan:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: build - name: Build
env: env:
CC: clang CC: clang
run: | run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_MSAN=y CONFIG_CLANG=y make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_MSAN=y CONFIG_CLANG=y
- name: test - name: Run built-in tests
env: env:
MSAN_OPTIONS: halt_on_error=1 MSAN_OPTIONS: halt_on_error=1
run: | run: |
@ -71,42 +72,43 @@ jobs:
linux-ubsan: linux-ubsan:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: build - name: Build
run: | run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_UBSAN=y make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_UBSAN=y
- name: test - name: Run built-in tests
env: env:
UBSAN_OPTIONS: halt_on_error=1 UBSAN_OPTIONS: halt_on_error=1
run: | run: |
make CONFIG_UBSAN=y test make CONFIG_UBSAN=y test
macos: macos:
name: macOS
runs-on: macos-latest runs-on: macos-latest
strategy: strategy:
fail-fast: false fail-fast: false
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: build - name: Build
run: | run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y
- name: stats - name: Stats
run: | run: |
./qjs -qd ./qjs -qd
- name: test - name: Run built-in tests
run: | run: |
make test make test
macos-asan: macos-asan:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: build - name: Build
run: | run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_ASAN=y make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_ASAN=y
- name: test - name: Run built-in tests
env: env:
ASAN_OPTIONS: halt_on_error=1 ASAN_OPTIONS: halt_on_error=1
run: | run: |
@ -115,11 +117,11 @@ jobs:
macos-ubsan: macos-ubsan:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: build - name: Build
run: | run: |
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_UBSAN=y make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_UBSAN=y
- name: test - name: Run built-in tests
env: env:
UBSAN_OPTIONS: halt_on_error=1 UBSAN_OPTIONS: halt_on_error=1
run: | run: |
@ -128,8 +130,8 @@ jobs:
freebsd: freebsd:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: build + test - name: Build + test
uses: vmactions/freebsd-vm@v1 uses: vmactions/freebsd-vm@v1
with: with:
usesh: true usesh: true
@ -139,3 +141,26 @@ jobs:
gmake gmake
./qjs -qd ./qjs -qd
gmake test gmake test
qemu-alpine:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- i386
- arm32v6
- arm32v7
- arm64v8
- s390x
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get qemu
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Run tests on ${{ matrix.platform }}
run: docker run --rm --interactive --mount type=bind,source=$(pwd),target=/host ${{ matrix.platform }}/alpine sh -c "apk add git patch make gcc libc-dev && cd /host && make test"

View file

@ -144,8 +144,9 @@ function test_os()
{ {
var fd, fpath, fname, fdir, buf, buf2, i, files, err, fdate, st, link_path; var fd, fpath, fname, fdir, buf, buf2, i, files, err, fdate, st, link_path;
// XXX(bnoordhuis) disabled because stdio is not a tty on CI const stdinIsTTY = !os.exec(["/bin/sh", "-c", "test -t 0"], { usePath: false });
//assert(os.isatty(0));
assert(os.isatty(0), stdinIsTTY, `isatty(STDIN)`);
fdir = "test_tmp_dir"; fdir = "test_tmp_dir";
fname = "tmp_file.txt"; fname = "tmp_file.txt";
@ -254,10 +255,11 @@ function test_os_exec()
pid = os.exec(["cat"], { block: false } ); pid = os.exec(["cat"], { block: false } );
assert(pid >= 0); assert(pid >= 0);
os.kill(pid, os.SIGQUIT); os.kill(pid, os.SIGTERM);
[ret, status] = os.waitpid(pid, 0); [ret, status] = os.waitpid(pid, 0);
assert(ret, pid); assert(ret, pid);
assert(status & 0x7f, os.SIGQUIT); assert(status !== 0, true, `expect nonzero exit code (got ${status})`);
assert(status & 0x7f, os.SIGTERM);
} }
function test_timer() function test_timer()