Skip to content

Commit

Permalink
Stop treating fuzz as a special case
Browse files Browse the repository at this point in the history
We would like to run the build and tests for all crates in the
workspace. In order to do so clear the env vars from the last
loop (setting to the empty string) and check against the empty string
when running specific `cargo` incantations.
  • Loading branch information
tcharding committed Aug 21, 2024
1 parent 97fba0c commit 6646692
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions ci/run_task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,23 @@ build_and_test() {
for crate in "${CRATES[@]}"; do
local test_vars_script="$REPO_DIR/$crate/contrib/test_vars.sh"

# Building the fuzz crate is more-or-less just a sanity check.
if [ "$crate" = "fuzz" ]; then
pushd "$REPO_DIR/$crate" > /dev/null
cargo --locked build
popd > /dev/null
break
fi
# Clean variables and also make sure they are defined.
FEATURES_WITH_STD=""
FEATURES_WITH_NO_STD=""
FEATURES_WITHOUT_STD=""
EXAMPLES=""

verbose_say "Sourcing $test_vars_script"
if [ -e "$test_vars_script" ]; then
# Set crate specific variables.
. "$test_vars_script"
else
err "Missing $test_vars_script"
fi
verbose_say "Got vars"
verbose_say "FEATURES_WITH_STD: ${FEATURES_WITH_STD:-}"
verbose_say "FEATURES_WITHOUT_STD: ${FEATURES_WITHOUT_STD:-}"
verbose_say "EXAMPLES: ${EXAMPLES:-}"

verbose_say "Got test vars:"
verbose_say "FEATURES_WITH_STD: ${FEATURES_WITH_STD}"
verbose_say "FEATURES_WITH_NO_STD: ${FEATURES_WITH_NO_STD}"
verbose_say "FEATURES_WITHOUT_STD: ${FEATURES_WITHOUT_STD}"
verbose_say "EXAMPLES: ${EXAMPLES:-}"
fi
pushd "$REPO_DIR/$crate" > /dev/null

do_test
Expand All @@ -146,7 +143,7 @@ do_test() {
$cargo build
$cargo test

if [ -n "${EXAMPLES+x}" ]; then
if [ -n "${EXAMPLES}" ]; then
for example in $EXAMPLES; do # EXAMPLES is set in contrib/test_vars.sh
name="$(echo "$example" | cut -d ':' -f 1)"
features="$(echo "$example" | cut -d ':' -f 2)"
Expand All @@ -164,21 +161,21 @@ do_test() {
# can be better controlled.
do_feature_matrix() {
# rust-miniscript only: https://github.com/rust-bitcoin/rust-miniscript/issues/681
if [ -n "${FEATURES_WITH_NO_STD+x}" ]; then
if [ -n "${FEATURES_WITH_NO_STD}" ]; then
$cargo build --no-default-features --features="no-std"
$cargo test --no-default-features --features="no-std"

loop_features "no-std" "${FEATURES_WITH_NO_STD:-}"
loop_features "no-std" "${FEATURES_WITH_NO_STD}"
else
$cargo build --no-default-features
$cargo test --no-default-features
fi

if [ -z "${FEATURES_WITH_STD+x}" ]; then
loop_features "std" "${FEATURES_WITH_STD:-}"
if [ -n "${FEATURES_WITH_STD}" ]; then
loop_features "std" "${FEATURES_WITH_STD}"
fi

if [ -z "${FEATURES_WITHOUT_STD+x}" ]; then
if [ -n "${FEATURES_WITHOUT_STD}" ]; then
loop_features "" "$FEATURES_WITHOUT_STD"
fi
}
Expand Down

0 comments on commit 6646692

Please sign in to comment.