Skip to content

Commit

Permalink
Make possible to run on specified datasets, address some shellcheck c…
Browse files Browse the repository at this point in the history
…oncerns (quotes)
  • Loading branch information
yarikoptic committed Dec 19, 2024
1 parent 507df66 commit f3f67b3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit f3f67b3

Please sign in to comment.