Skip to content

Commit

Permalink
tests: mips
Browse files Browse the repository at this point in the history
resolves #27
  • Loading branch information
Nugine committed Dec 11, 2022
1 parent 42e6310 commit 7c0620a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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()}}
Expand Down
19 changes: 11 additions & 8 deletions scripts/testgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"-C target-feature=+simd128",
"",
],
"mips": [""],
}

TARGETS = {
Expand All @@ -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 = {
Expand All @@ -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):
Expand All @@ -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():
Expand Down

0 comments on commit 7c0620a

Please sign in to comment.