Browse Source

Remove cranelift scripts, we'll merge them into `scripts` eventually

pull/1019/head
Alex Crichton 5 years ago
parent
commit
0c33696731
  1. 57
      cranelift/publish-all.sh
  2. 98
      cranelift/test-all.sh
  3. 32
      cranelift/test-no_std.sh

57
cranelift/publish-all.sh

@ -1,57 +0,0 @@
#!/bin/bash
set -euo pipefail
# This is a convenience script for maintainers publishing a new version of
# Cranelift to crates.io. To use, bump the version number below, run the
# script, and then run the commands that the script prints.
topdir=$(dirname "$0")
cd "$topdir"
# All the cranelift-* crates have the same version number
version="0.59.0"
# Update all of the Cargo.toml files.
#
# The main Cargo.toml in the top-level directory is the cranelift-tools crate which we don't publish.
echo "Updating crate versions to $version"
for crate in . cranelift-* cranelift-codegen/shared cranelift-codegen/meta; do
# Update the version number of this crate to $version.
sed -i.bk -e "s/^version = .*/version = \"$version\"/" \
"$crate/Cargo.toml"
# Update the required version number of any cranelift* dependencies.
sed -i.bk -e "/^cranelift/s/version = \"[^\"]*\"/version = \"$version\"/" \
"$crate/Cargo.toml"
done
# Update our local Cargo.lock (not checked in).
cargo update
./test-all.sh
# Commands needed to publish.
#
# Note that libraries need to be published in topological order.
echo git checkout -b bump-version-to-$version
echo git commit -a -m "\"Bump version to $version"\"
echo git tag v$version
echo git push origin bump-version-to-$version
echo "# Don't forget to click the above link to open a pull-request!"
echo git push origin v$version
for crate in \
entity bforest codegen/shared codegen/meta codegen frontend native \
preopt \
reader wasm module \
faerie umbrella simplejit object
do
echo cargo publish --manifest-path "cranelift-$crate/Cargo.toml"
# Sleep for a few seconds to allow the server to update the index.
# https://internals.rust-lang.org/t/changes-to-how-crates-io-handles-index-updates/9608
echo sleep 10
done
echo
echo "echo \"#\""
echo "echo \"# Don't forget to click the above link to open a pull-request!\""
echo "echo \"#\""

98
cranelift/test-all.sh

@ -1,98 +0,0 @@
#!/bin/bash
set -euo pipefail
# This is the top-level test script:
#
# - Check code formatting.
# - Make a debug build.
# - Make a release build.
# - Run unit tests for all Rust crates (including the filetests)
# - Build API documentation.
# - Optionally, run fuzzing.
#
# All tests run by this script should be passing at all times.
# Repository top-level directory.
topdir=$(dirname "$0")
cd "$topdir"
function banner {
echo "====== $* ======"
}
# Run rustfmt if we have it.
banner "Rust formatting"
if cargo +stable fmt -- --version > /dev/null ; then
if ! "$topdir/format-all.sh" --check ; then
echo "Formatting diffs detected! Run \"cargo fmt --all\" to correct."
exit 1
fi
else
echo "cargo-fmt not available; formatting not checked!"
echo
echo "If you are using rustup, rustfmt can be installed via"
echo "\"rustup component add --toolchain=stable rustfmt-preview\", or see"
echo "https://github.com/rust-lang-nursery/rustfmt for more information."
fi
# Make sure the code builds in release mode.
banner "Rust release build"
cargo build --release
# Make sure the code builds in debug mode.
banner "Rust debug build"
cargo build
# Run the tests. We run these in debug mode so that assertions are enabled.
banner "Rust unit tests"
RUST_BACKTRACE=1 cargo test --all
has_toolchain() {
rustup toolchain list | grep -q $1
}
ensure_installed() {
program="$1"
toolchain="${2:-stable}"
if has_toolchain $toolchain; then
if grep -q $program <(cargo +$toolchain install --list); then
echo "$program found"
else
echo "installing $program"
cargo +$toolchain install $program
fi
else
return 1
fi
}
# Make sure the documentation builds.
banner "Rust documentation: $topdir/target/doc/cranelift/index.html"
if has_toolchain nightly; then
cargo +nightly doc --all --exclude cranelift-codegen-meta
cargo +nightly doc --package cranelift-codegen-meta --document-private-items
# Make sure the documentation doesn't have broken links.
banner "Rust documentation link test"
ensure_installed cargo-deadlinks
find ./target/doc -maxdepth 1 -type d -name "cranelift*" | xargs -I{} cargo deadlinks --dir {}
else
cargo doc --all --exclude cranelift-codegen-meta
cargo doc --package cranelift-codegen-meta --document-private-items
echo "nightly toolchain not found, some documentation links will not work"
fi
# Ensure fuzzer works by running it with a single input.
# Note LSAN is disabled due to https://github.com/google/sanitizers/issues/764.
banner "cargo fuzz check"
if ensure_installed cargo-fuzz nightly; then
fuzz_module="ffaefab69523eb11935a9b420d58826c8ea65c4c"
ASAN_OPTIONS=detect_leaks=0 \
cargo +nightly fuzz run fuzz_translate_module \
"$topdir/fuzz/corpus/fuzz_translate_module/$fuzz_module"
else
echo "nightly toolchain not found, skipping fuzz target integration test"
fi
banner "OK"

32
cranelift/test-no_std.sh

@ -1,32 +0,0 @@
#!/bin/bash
set -euo pipefail
# This is the test script for testing the no_std configuration of
# packages which support it.
# Repository top-level directory.
topdir=$(dirname "$0")
cd "$topdir"
function banner {
echo "====== $* ======"
}
# Test those packages which have no_std support.
LIBS="cranelift-codegen cranelift-frontend cranelift-wasm \
cranelift-native cranelift-preopt cranelift-module \
cranelift-entity cranelift-bforest cranelift-umbrella"
for LIB in $LIBS; do
banner "Rust unit tests in $LIB"
pushd "$LIB" >/dev/null
# Test with just "core" enabled.
cargo +nightly test --no-default-features --features "core all-arch"
# Test with "core" and "std" enabled at the same time.
cargo +nightly test --features "core all-arch"
popd >/dev/null
done
banner "OK"
Loading…
Cancel
Save