From 7c0620a780bf2c09e96ac15f9ee4596bbb8a4549 Mon Sep 17 00:00:00 2001 From: Nugine Date: Sun, 11 Dec 2022 18:03:22 +0800 Subject: [PATCH] tests: mips resolves #27 --- .github/workflows/ci.yml | 2 +- justfile | 5 +++++ scripts/testgen.py | 19 +++++++++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 276d3cb..f3194b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,10 +54,10 @@ jobs: - aarch64-unknown-linux-gnu - armv7-unknown-linux-gnueabihf - wasm32-unknown-unknown + - mips-unknown-linux-gnu steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@nightly - - uses: extractions/setup-just@v1 - uses: taiki-e/install-action@v1 with: tool: cross diff --git a/justfile b/justfile index 1025650..8b803bf 100644 --- a/justfile +++ b/justfile @@ -100,6 +100,11 @@ miri-test crate: cd {{justfile_directory()}} cargo miri test -p {{crate}} +mips-test crate: + #!/bin/bash -ex + cd {{justfile_directory()}} + ./scripts/testgen.py --crate {{crate}} --mode mips | bash -ex + test-all: #!/bin/bash -ex cd {{justfile_directory()}} diff --git a/scripts/testgen.py b/scripts/testgen.py index c715e2d..dbe4a3d 100755 --- a/scripts/testgen.py +++ b/scripts/testgen.py @@ -35,6 +35,7 @@ "-C target-feature=+simd128", "", ], + "mips": [""], } TARGETS = { @@ -46,7 +47,8 @@ "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf", ], - "wasm": [None], + "wasm": ["wasm32-unknown-unknown"], + "mips": ["mips-unknown-linux-gnu"], } TARGET_REMAP = { @@ -55,9 +57,10 @@ "aarch64-unknown-linux-gnu": "arm", "armv7-unknown-linux-gnueabihf": "arm", "wasm32-unknown-unknown": "wasm", + "mips-unknown-linux-gnu": "mips", } -TEST_MODES = ["x86", "arm", "wasm"] +TEST_MODES = ["x86", "arm", "wasm", "mips"] def gen(mode: str, target: str, rustflag: str, host: str): @@ -66,13 +69,13 @@ def gen(mode: str, target: str, rustflag: str, host: str): if len(feat) > 0: feat = "--features " + feat - if mode == "x86" or mode == "arm": - use_cross = target != host - prog = "cross" if use_cross else "cargo" - lib = "--lib --tests" if mode == "x86" else "" - print(f'RUSTFLAGS="{rustflag}" {prog} test --target {target} {lib} --no-default-features {feat} $@') - elif mode == "wasm": + if mode == "wasm": print(f'RUSTFLAGS="{rustflag}" wasm-pack test --node -- --no-default-features {feat} $@') + continue + + prog = "cross" if target != host else "cargo" + skip_others = "--lib --tests" if mode == "x86" else "" + print(f'RUSTFLAGS="{rustflag}" {prog} test --target {target} {skip_others} --no-default-features {feat} $@') def get_rustc_host():