Skip to content

Commit 8bebdcb

Browse files
authored
Merge pull request #61 from tinybirdco/exce-test01
update script
2 parents 838f93f + fad4df0 commit 8bebdcb

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

scripts/exec_test.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
set -e
23

34
export TB_VERSION_WARNING=0
45
export VERSION=$1
@@ -8,19 +9,27 @@ run_test() {
89
echo "** Running $t **"
910
# Check if VERSION is provided
1011
if [[ -n $VERSION ]]; then
11-
echo "VERSION found: $VERSION"
1212
sed -i "s/tb/tb --semver $VERSION/" $t
13-
else
14-
echo "VERSION not found"
1513
fi
1614
echo "** $(cat $t)"
17-
if res=$(bash $t $2 | diff -B ${t}.result -); then
18-
echo 'OK';
15+
tmpfile=$(mktemp)
16+
if bash $t $2 >$tmpfile; then
17+
if diff -B ${t}.result $tmpfile; then
18+
echo "Test $t: OK";
19+
else
20+
echo "🚨 ERROR: Test $t failed, diff:";
21+
diff -B ${t}.result $tmpfile
22+
cat $tmpfile
23+
rm $tmpfile
24+
return 1
25+
fi
1926
else
20-
echo "failed, diff:";
21-
echo "$res";
27+
echo "🚨 ERROR: Test $t failed with bash command exit code $?"
28+
cat $tmpfile
29+
rm $tmpfile
2230
return 1
2331
fi
32+
rm $tmpfile
2433
echo ""
2534
}
2635
export -f run_test

0 commit comments

Comments
 (0)