From f3f67b36318c873c59f6ea6d1ed05ed3af3389fb Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 19 Dec 2024 11:05:18 -0500 Subject: [PATCH] Make possible to run on specified datasets, address some shellcheck concerns (quotes) --- run_tests.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index b73b0f48b..482a1200b 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -10,11 +10,18 @@ else VARIANT="legacy" fi -for i in $(ls -d */ | grep -v node_modules); do +if [ "$#" -gt 0 ]; then + datasets=( "$@" ) +else + datasets=( $(ls -d */ | grep -v node_modules) ) +fi + +echo "Will be validating ${#datasets[@]} dataset(s)" +for i in "${datasets[@]}"; do echo -n "Validating dataset $i: " - if [ -f ${i%%/}/.SKIP_VALIDATION ]; then - echo "skipping validation" + if [ -f "${i%%/}/.SKIP_VALIDATION" ]; then + echo "skipping validation due to .SKIP_VALIDATION" continue fi @@ -23,18 +30,18 @@ for i in $(ls -d */ | grep -v node_modules); do CMD="bids-validator ${i%%/} $VALIDATOR_ARGS" # Use default configuration unless overridden - if [[ ! ( -f ${i%%/}/.bids-validator-config.json || $CMD =~ /--config/ ) ]]; then - CMD="$CMD --config $PWD/${VARIANT}config.json" + if [[ ! ( -f "${i%%/}/.bids-validator-config.json" || $CMD =~ /--config/ ) ]]; then + CMD="$CMD --config '$PWD/${VARIANT}config.json'" fi # Ignore NIfTI headers except for synthetic dataset - if [ $i != "synthetic/" ]; then + if [ "$i" != "synthetic/" ]; then CMD="$CMD --ignoreNiftiHeaders" else echo "validating NIfTI headers. " fi - echo "Running " $CMD + echo "Running $CMD" $CMD || failed+=" $i" done