Tidy up the top-level directory by moving misc. scripts into a subdirectory.
This commit is contained in:
24
scripts/cranelift-version.sh
Executable file
24
scripts/cranelift-version.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# This is a convenience script for maintainers changing a cranelift
|
||||
# dependencies versions. To use, bump the version number below, run the
|
||||
# script.
|
||||
|
||||
topdir=$(dirname "$0")
|
||||
cd "$topdir"
|
||||
|
||||
# All the cranelift-* crates have the same version number
|
||||
version="0.49"
|
||||
|
||||
# Update all of the Cargo.toml files.
|
||||
echo "Updating crate versions to $version"
|
||||
for crate in . crates/* crates/misc/* fuzz; do
|
||||
# Update the version number of this crate to $version.
|
||||
sed -i.bk -e "/^cranelift-/s/\"[^\"]*\"/\"$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
|
||||
12
scripts/format-all.sh
Executable file
12
scripts/format-all.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Format all sources using rustfmt.
|
||||
|
||||
topdir=$(dirname "$0")
|
||||
cd "$topdir"
|
||||
|
||||
# Make sure we can find rustfmt.
|
||||
export PATH="$PATH:$HOME/.cargo/bin"
|
||||
|
||||
exec cargo +stable fmt --all -- "$@"
|
||||
61
scripts/publish-all.sh
Executable file
61
scripts/publish-all.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# This is a convenience script for maintainers publishing a new version of
|
||||
# Wasmtime 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 wasmtime-* crates have the same version number
|
||||
version="0.2.0"
|
||||
|
||||
# Update all of the Cargo.toml files.
|
||||
#
|
||||
# The main Cargo.toml in the top-level directory is the wasmtime crate which we don't publish.
|
||||
echo "Updating crate versions to $version"
|
||||
for crate in . wasmtime-*; 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 wasmtime* dependencies.
|
||||
sed -i.bk -e "/^wasmtime/s/version = \"[^\"]*\"/version = \"$version\"/" \
|
||||
"$crate/Cargo.toml"
|
||||
done
|
||||
|
||||
# Update our local Cargo.lock (not checked in).
|
||||
cargo update
|
||||
./scripts/test-all.sh
|
||||
|
||||
# Commands needed to publish.
|
||||
#
|
||||
# Note that libraries need to be published in topological order.
|
||||
|
||||
echo git commit -a -m "\"Bump version to $version"\"
|
||||
echo git tag v$version
|
||||
echo git push
|
||||
echo git push origin v$version
|
||||
for crate in \
|
||||
wasmtime-environ \
|
||||
wasmtime-debug \
|
||||
wasmtime-runtime \
|
||||
wasmtime-jit \
|
||||
wasmtime-wast \
|
||||
wasmtime-wasi \
|
||||
wasmtime-wasi-c \
|
||||
wasmtime-interface-types \
|
||||
wasmtime-obj \
|
||||
wasmtime-py \
|
||||
wasmtime-rust \
|
||||
wasmtime-cli \
|
||||
wasi-common \
|
||||
wasmtime
|
||||
do
|
||||
echo cargo publish --manifest-path "$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
|
||||
104
scripts/test-all.sh
Executable file
104
scripts/test-all.sh
Executable file
@@ -0,0 +1,104 @@
|
||||
#!/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/scripts/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"
|
||||
|
||||
# TODO: lightbeam currently requires rust nightly, so don't try to run the
|
||||
# tests here. Name all the other packages, rather than using --all. We'll
|
||||
# run the lightbeam tests below if nightly is available.
|
||||
#RUST_BACKTRACE=1 cargo test --all
|
||||
RUST_BACKTRACE=1 cargo test \
|
||||
--package wasmtime-cli \
|
||||
--package wasmtime \
|
||||
--package wasmtime-wasi \
|
||||
--package wasmtime-wast \
|
||||
--package wasmtime-debug \
|
||||
--package wasmtime-environ \
|
||||
--package wasmtime-runtime \
|
||||
--package wasmtime-jit \
|
||||
--package wasmtime-interface-types \
|
||||
--package wasmtime-obj \
|
||||
|
||||
# Test wasmtime-wasi-c, which doesn't support Windows.
|
||||
if [ "${OS:-Not}" != "Windows_NT" ]; then
|
||||
RUST_BACKTRACE=1 cargo test \
|
||||
--package wasmtime-wasi-c
|
||||
fi
|
||||
|
||||
# Make sure the documentation builds.
|
||||
banner "Rust documentation: $topdir/target/doc/wasmtime/index.html"
|
||||
cargo doc
|
||||
|
||||
# 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 rustup toolchain list | grep -q nightly; then
|
||||
if cargo install --list | grep -q cargo-fuzz; then
|
||||
echo "cargo-fuzz found"
|
||||
else
|
||||
echo "installing cargo-fuzz"
|
||||
cargo +nightly install cargo-fuzz
|
||||
fi
|
||||
|
||||
fuzz_module="1340712d77d3db3c79b4b0c1494df18615485480"
|
||||
ASAN_OPTIONS=detect_leaks=0 \
|
||||
cargo +nightly fuzz run compile \
|
||||
"$topdir/fuzz/corpus/compile/$fuzz_module"
|
||||
|
||||
# Nightly is available, so also run lightbeam's tests, which we
|
||||
# skipped earlier.
|
||||
cargo +nightly test --features lightbeam --package lightbeam
|
||||
cargo +nightly test --features lightbeam
|
||||
|
||||
# Also run wasmtime-py and wasmtime-rust's tests.
|
||||
RUST_BACKTRACE=1 cargo +nightly test \
|
||||
--package wasmtime-py \
|
||||
--package wasmtime-rust
|
||||
else
|
||||
echo "nightly toolchain not found, skipping fuzz target integration test"
|
||||
fi
|
||||
|
||||
banner "OK"
|
||||
Reference in New Issue
Block a user