From ec4ccd760a6731c7210311b9c1eb8f0830a6c7a7 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 21 Aug 2024 16:23:12 +1000 Subject: [PATCH] Enable usage of machine set CRATES var Repos using the `run_task` script would like to set the `CRATES` env var by using CRATES="$(cargo metadata --no-deps --format-version 1 | jq -j -r '.packages | map(.manifest_path | rtrimstr("/Cargo.toml") | ltrimstr("'"$PWD"'/")) | join(" ")')" I don't know exactly why but this results in some sort of square braces data type that seems to only work in a loop using `for crate in $CRATES` instead of the `for crate in ${CRATES[@]}` like we currently have. --- ci/run_task.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/run_task.sh b/ci/run_task.sh index 5f9e3dd..40ea44a 100755 --- a/ci/run_task.sh +++ b/ci/run_task.sh @@ -59,7 +59,7 @@ main() { if [ -e "$crates_script" ]; then verbose_say "Sourcing $crates_script" . "$crates_script" - for crate in "${CRATES[@]}"; do + for crate in $CRATES; do verbose_say "Found crate: $crate" done else @@ -106,7 +106,7 @@ main() { # Build and test for each crate, done with each toolchain. build_and_test() { - for crate in "${CRATES[@]}"; do + 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. @@ -282,7 +282,7 @@ build_docs_with_stable_toolchain() { do_bench() { verbose_say "Running bench tests for: $CRATES" - for crate in "${CRATES[@]}"; do + for crate in $CRATES; do pushd "$REPO_DIR/$crate" > /dev/null # Unit tests are ignored so if there are no bench test then this will just succeed. RUSTFLAGS='--cfg=bench' cargo bench