Skip to content

Commit

Permalink
Merge pull request #477 from yarikoptic/enh-specificdatasets
Browse files Browse the repository at this point in the history
Make possible to run on specified datasets, address some shellcheck concerns (quotes)
  • Loading branch information
effigies authored Dec 19, 2024
2 parents a86ba3e + 1b3befb commit cd3edbb
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 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
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 cd3edbb

Please sign in to comment.