diff --git a/clippy-all.sh b/clippy-all.sh index 6ec2fd1411..f82f6a07db 100755 --- a/clippy-all.sh +++ b/clippy-all.sh @@ -4,4 +4,4 @@ set -euo pipefail # Check all sources with clippy. # In the cton-util crate (root dir) clippy will only work with nightly cargo - # there is a bug where it will reject the commands passed to it by cargo 0.25.0 -cargo +nightly clippy --all +exec cargo +nightly clippy --all diff --git a/cranelift/format-all.sh b/cranelift/format-all.sh index 1e27718801..64c967ad24 100755 --- a/cranelift/format-all.sh +++ b/cranelift/format-all.sh @@ -3,7 +3,8 @@ set -euo pipefail # Format all sources using rustfmt. -cd $(dirname "$0") +topdir=$(dirname "$0") +cd "$topdir" # Make sure we can find rustfmt. export PATH="$PATH:$HOME/.cargo/bin" diff --git a/cranelift/publish-all.sh b/cranelift/publish-all.sh index aa99a28872..543f9bbeca 100755 --- a/cranelift/publish-all.sh +++ b/cranelift/publish-all.sh @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -cd $(dirname "$0") -topdir="$(pwd)" +topdir=$(dirname "$0") +cd "$topdir" # All the cretonne-* crates have the same version number version="0.9.0" @@ -28,12 +28,6 @@ cargo update echo git commit -a -m "\"Bump version to $version"\" echo git push for crate in entity codegen frontend native reader wasm module simplejit faerie umbrella ; do - if [ "$crate" == "umbrella" ]; then - dir="cretonne" - else - dir="$crate" - fi - echo cargo publish --manifest-path "lib/$crate/Cargo.toml" done echo diff --git a/cranelift/test-all.sh b/cranelift/test-all.sh index fcdf7e57c4..5c280523d3 100755 --- a/cranelift/test-all.sh +++ b/cranelift/test-all.sh @@ -15,18 +15,18 @@ set -euo pipefail export PYTHONDONTWRITEBYTECODE=1 # Repository top-level directory. -cd $(dirname "$0") -topdir=$(pwd) +topdir=$(dirname "$0") +cd "$topdir" function banner { - echo "====== $@ ======" + echo "====== $* ======" } # Run rustfmt if we have it. banner "Rust formatting" -if command -v rustfmt > /dev/null; then +if type rustfmt > /dev/null; then # In newer versions of rustfmt, replace --write-mode=diff with --check. - if ! $topdir/format-all.sh --write-mode=diff ; then + if ! "$topdir/format-all.sh" --write-mode=diff ; then echo "Formatting diffs detected! Run \"cargo fmt --all\" to correct." exit 1 fi @@ -39,16 +39,16 @@ else fi # Check if any Python files have changed since we last checked them. -tsfile=$topdir/target/meta-checked -if [ -f $tsfile ]; then - needcheck=$(find $topdir/lib/codegen/meta -name '*.py' -newer $tsfile) +tsfile="$topdir/target/meta-checked" +if [ -f "$tsfile" ]; then + needcheck=$(find "$topdir/lib/codegen/meta" -name '*.py' -newer "$tsfile") else needcheck=yes fi if [ -n "$needcheck" ]; then banner "$(python --version 2>&1), $(python3 --version 2>&1)" - $topdir/lib/codegen/meta/check.sh - touch $tsfile || echo no target directory + "$topdir/lib/codegen/meta/check.sh" + touch "$tsfile" || echo no target directory fi # Make sure the code builds in release mode. @@ -69,8 +69,8 @@ cargo doc # Run clippy if we have it. banner "Rust linter" -if $topdir/check-clippy.sh; then - $topdir/clippy-all.sh --write-mode=diff +if "$topdir/check-clippy.sh"; then + "$topdir/clippy-all.sh" --write-mode=diff else echo "\`cargo +nightly install clippy\` for optional rust linting" fi @@ -85,7 +85,7 @@ if rustup toolchain list | grep -q nightly; then echo "installing cargo-fuzz" cargo +nightly install cargo-fuzz fi - ASAN_OPTIONS=detect_leaks=0 cargo +nightly fuzz run fuzz_translate_module $topdir/fuzz/corpus/fuzz_translate_module/ffaefab69523eb11935a9b420d58826c8ea65c4c + ASAN_OPTIONS=detect_leaks=0 cargo +nightly fuzz run fuzz_translate_module "$topdir/fuzz/corpus/fuzz_translate_module/ffaefab69523eb11935a9b420d58826c8ea65c4c" else echo "nightly toolchain not found, skipping fuzz target integration test" fi diff --git a/cranelift/test-no_std.sh b/cranelift/test-no_std.sh index 8ca93f5d04..26678c856e 100755 --- a/cranelift/test-no_std.sh +++ b/cranelift/test-no_std.sh @@ -5,11 +5,11 @@ set -euo pipefail # packages which support it. # Repository top-level directory. -cd $(dirname "$0") -topdir=$(pwd) +topdir=$(dirname "$0") +cd "$topdir" function banner { - echo "====== $@ ======" + echo "====== $* ======" } # Test those packages which have no_std support. diff --git a/lib/codegen/meta/check.sh b/lib/codegen/meta/check.sh index d8f2178f43..ce34f78f4b 100755 --- a/lib/codegen/meta/check.sh +++ b/lib/codegen/meta/check.sh @@ -1,9 +1,10 @@ #!/bin/bash set -euo pipefail -cd $(dirname "$0") +topdir=$(dirname "$0") +cd "$topdir" function runif { - if command -v "$1" > /dev/null; then + if type "$1" > /dev/null; then echo " === $1 ===" "$@" else