Support cargo '+' flags in testing script.

This commit is contained in:
Sergio Benitez 2020-07-21 10:24:18 -07:00
parent 67efe143c5
commit 4a1a4c0e45
2 changed files with 39 additions and 24 deletions

View File

@ -76,7 +76,7 @@ ALL_PROJECT_DIRS=(
"${CONTRIB_LIB_ROOT}"
)
if [ "${1}" = "-p" ]; then
function print_environment() {
echo " ROCKET_VERSION: ${ROCKET_VERSION}"
echo " CURRENT_RELEASE: ${CURRENT_RELEASE}"
echo " PRE_RELEASE: ${PRE_RELEASE}"
@ -95,4 +95,8 @@ if [ "${1}" = "-p" ]; then
echo " DOC_DIR: ${DOC_DIR}"
echo " ALL_PROJECT_DIRS: ${ALL_PROJECT_DIRS[*]}"
echo " date(): $(future_date)"
}
if [ "${1}" = "-p" ]; then
print_environment
fi

View File

@ -7,6 +7,8 @@ source "${SCRIPT_DIR}/config.sh"
# Add Cargo to PATH.
export PATH=${HOME}/.cargo/bin:${PATH}
export CARGO_INCREMENTAL=0
CARGO="cargo"
# Checks that the versions for Cargo projects $@ all match
function check_versions_match() {
@ -49,6 +51,15 @@ function ensure_trailing_whitespace_free() {
fi
}
if [[ $1 == +* ]]; then
CARGO="$CARGO $1"
shift
fi
echo ":: Preparing. Environment is..."
print_environment
echo " CARGO: $CARGO"
echo ":: Ensuring all crate versions match..."
check_versions_match "${ALL_PROJECT_DIRS[@]}"
@ -59,7 +70,7 @@ echo ":: Checking for trailing whitespace..."
ensure_trailing_whitespace_free
echo ":: Updating dependencies..."
cargo update
$CARGO update
if [ "$1" = "--contrib" ]; then
FEATURES=(
@ -83,11 +94,11 @@ if [ "$1" = "--contrib" ]; then
pushd "${CONTRIB_LIB_ROOT}" > /dev/null 2>&1
echo ":: Building and testing contrib [default]..."
CARGO_INCREMENTAL=0 cargo test
$CARGO test
for feature in "${FEATURES[@]}"; do
echo ":: Building and testing contrib [${feature}]..."
CARGO_INCREMENTAL=0 cargo test --no-default-features --features "${feature}"
$CARGO test --no-default-features --features "${feature}"
done
popd > /dev/null 2>&1
@ -100,16 +111,16 @@ elif [ "$1" = "--core" ]; then
pushd "${CORE_LIB_ROOT}" > /dev/null 2>&1
echo ":: Building and testing core [no features]..."
CARGO_INCREMENTAL=0 cargo test --no-default-features
$CARGO test --no-default-features
for feature in "${FEATURES[@]}"; do
echo ":: Building and testing core [${feature}]..."
CARGO_INCREMENTAL=0 cargo test --no-default-features --features "${feature}"
$CARGO test --no-default-features --features "${feature}"
done
popd > /dev/null 2>&1
else
echo ":: Building and testing libraries..."
CARGO_INCREMENTAL=0 cargo test --all-features --all $@
$CARGO test --all-features --all $@
fi