-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·69 lines (52 loc) · 1.58 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·69 lines (52 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -ex
set -o pipefail
# NOTE:
# 1. set UPDATE_EXPECT=1 to update snapshot tests
# 2. sqlite3 cache may influence snapshots, so remove them when manually cargo test
# Fetch latest stat JSON for asternias and rust-for-linux
rm -rf assets/stat/ && gh run download -D assets/stat/ -n "stat_asterinas" -n "stat_rfl-X64"
# Set up toolchain: works under current folder.
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
# Don't emit rlib files.
export STOP_COMPILATION=1
# ./run.sh -Fstd
FEATURES=${1:-"std"}
# Switch toolchain
./gen_rust_toolchain_toml.rs "${FEATURES}"
# Remove data.sqlite3 the cache
rm -f target/data.sqlite3 tests/demo/data.sqlite3
cargo fmt --check --all
cargo clippy -F "${FEATURES}" --workspace -- -D clippy::all
cargo build -F "${FEATURES}"
export SAFETY_TOOL=$PWD/target/debug/safety-tool
export SAFETY_TOOL=$PWD/target/debug/safety-tool
export CARGO_SAFETY_TOOL=$PWD/target/debug/cargo-safety-tool
export DATA_SQLITE3=$PWD/target/data.sqlite3
cargo test -F "${FEATURES}"
pushd safety-lib
cargo test
popd
pushd safety-macro
cargo test
popd
# enable tag definitions
rm "$DATA_SQLITE3"
export SP_DIR=$PWD/assets
pushd safety-lsp
cargo test
popd
# Test basic demo
pushd ./tests/demo
cargo clean
# Emit artifacts for build scripts.
unset STOP_COMPILATION
# Analyze the lib and bin crates.
export SP_OUT_DIR=$PWD/out
EXPAND_DIR=$SP_OUT_DIR/macro-expanded
rm -rf "$SP_OUT_DIR" # clear outputs
mkdir -p "$EXPAND_DIR"
$CARGO_SAFETY_TOOL # run safety-tool to check
cargo expand --lib >"$EXPAND_DIR"/lib.rs
cargo expand --bin demo >"$EXPAND_DIR"/main.rs
cargo doc --no-deps