Skip to content

Commit 8d53b58

Browse files
authored
fix(script): make test.sh to work (#245)
1 parent f223a20 commit 8d53b58

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

scripts/test.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,26 @@ function main () {
5656
log $GREEN "Building..."
5757

5858
# Pre-build the filtered examples prior to running them.
59-
cargo build $(printf -- '--example %s ' $examples)
59+
cargo build $(printf -- '--example %s ' $(echo "$examples"))
6060

6161
log $GREEN "Running..."
6262

63-
# Run all the examples that are left after filtering.
64-
printf '%s\n' $examples \
65-
| xargs -P4 -I{} bash -c '
66-
bin="./target/debug/examples/{}"
63+
printf '%s\n' $examples | xargs -P4 -I{} bash -c '
64+
name="$1"
65+
bin="./target/debug/examples/$name"
66+
6767
if [[ -x "$bin" ]]; then
68-
"$bin" >/dev/null \
69-
&& echo "Successfully ran: {}" \
70-
|| { echo "Failed to run: {}" >&2; exit 1; }
68+
if "$bin" >/dev/null; then
69+
echo "Successfully ran: $name"
70+
else
71+
echo "Failed to run: $name" >&2
72+
exit 1
73+
fi
7174
else
7275
echo "Missing binary: $bin" >&2
7376
exit 1
7477
fi
75-
'
78+
' -- {}
7679

7780
log $GREEN "Done"
7881
}

0 commit comments

Comments
 (0)