Skip to content

Commit cd3edbb

Browse files
authored
Merge pull request #477 from yarikoptic/enh-specificdatasets
Make possible to run on specified datasets, address some shellcheck concerns (quotes)
2 parents a86ba3e + 1b3befb commit cd3edbb

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

run_tests.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@ else
1010
VARIANT="legacy"
1111
fi
1212

13-
for i in $(ls -d */ | grep -v node_modules); do
13+
if [ "$#" -gt 0 ]; then
14+
datasets=( "$@" )
15+
else
16+
datasets=( $(ls -d */ | grep -v node_modules) )
17+
fi
18+
19+
echo "Will be validating ${#datasets[@]} dataset(s)"
20+
for i in "${datasets[@]}"; do
1421
echo -n "Validating dataset $i: "
1522

16-
if [ -f ${i%%/}/.SKIP_VALIDATION ]; then
17-
echo "skipping validation"
23+
if [ -f "${i%%/}/.SKIP_VALIDATION" ]; then
24+
echo "skipping validation due to .SKIP_VALIDATION"
1825
continue
1926
fi
2027

@@ -23,18 +30,18 @@ for i in $(ls -d */ | grep -v node_modules); do
2330
CMD="bids-validator ${i%%/} $VALIDATOR_ARGS"
2431

2532
# Use default configuration unless overridden
26-
if [[ ! ( -f ${i%%/}/.bids-validator-config.json || $CMD =~ /--config/ ) ]]; then
33+
if [[ ! ( -f "${i%%/}/.bids-validator-config.json" || $CMD =~ /--config/ ) ]]; then
2734
CMD="$CMD --config $PWD/${VARIANT}config.json"
2835
fi
2936

3037
# Ignore NIfTI headers except for synthetic dataset
31-
if [ $i != "synthetic/" ]; then
38+
if [ "$i" != "synthetic/" ]; then
3239
CMD="$CMD --ignoreNiftiHeaders"
3340
else
3441
echo "validating NIfTI headers. "
3542
fi
3643

37-
echo "Running " $CMD
44+
echo "Running $CMD"
3845

3946
$CMD || failed+=" $i"
4047
done

0 commit comments

Comments
 (0)