4
4
# Test that verifies TASTy files can be generated deterministically
5
5
echo " Testing TASTy file generation with Scala 3..."
6
6
7
- # Clean any previous builds
8
- bazel clean
9
-
10
7
# Build the Scala 3 target, explicitly using Scala 3 toolchain
11
8
echo " Building target with Scala 3 toolchain..."
12
9
bazel build --@rules_scala_annex//rules/scala:scala-toolchain=test_zinc_3 --keep_going --remote_executor= --remote_cache= --disk_cache= :tasty_test_lib
@@ -20,9 +17,8 @@ temp_dir=$(mktemp -d)
20
17
21
18
cleanup () {
22
19
exit_code=$?
23
- # This will be updated later to handle multiple directories
24
20
for dir in " ${temp_dirs[@]} " ; do
25
- rm -rf " $dir " 2> /dev/null || true
21
+ rm -r " $dir " 2> /dev/null || true
26
22
done
27
23
finish $exit_code
28
24
}
@@ -61,8 +57,8 @@ temp_dirs=("$temp_dir")
61
57
# Perform 4 additional builds (we already have one)
62
58
for i in $( seq 2 5) ; do
63
59
echo " Build $i /5..."
64
- bazel clean --expunge
65
- bazel build --@rules_scala_annex//rules/scala:scala-toolchain=test_zinc_3 --keep_going -- remote_executor= --remote_cache= --disk_cache= :tasty_test_lib
60
+ bazel clean
61
+ bazel build --@rules_scala_annex//rules/scala:scala-toolchain=test_zinc_3 --remote_executor= --remote_cache= --disk_cache= :tasty_test_lib
66
62
67
63
# Create temp directory for this build
68
64
temp_dir_n=$( mktemp -d)
@@ -75,26 +71,18 @@ for i in $(seq 2 5); do
75
71
}
76
72
done
77
73
78
- # Cleanup function to remove temp directories
79
- cleanup () {
80
- exit_code=$?
81
- for dir in " ${temp_dirs[@]} " ; do
82
- rm -rf " $dir " 2> /dev/null || true
83
- done
84
- finish $exit_code
85
- }
86
-
87
74
# Compare all builds against the first one
88
75
echo " Comparing TASTy files across all 5 builds for determinism..."
89
76
all_identical=true
90
77
91
78
for i in $( seq 2 5) ; do
92
79
build_num=$(( i- 1 ))
93
80
echo " Comparing build 1 with build $i ..."
94
- if ! diff -r " ${temp_dirs[0]} " " ${temp_dirs[$build_num]} " > /dev/null; then
81
+ diff_output=$( diff -r " ${temp_dirs[0]} " " ${temp_dirs[$build_num]} " 2>&1 )
82
+ if [ $? -ne 0 ]; then
95
83
echo " ERROR: TASTy files differ between build 1 and build $i - not deterministic"
96
84
echo " Differences found:"
97
- diff -r " ${temp_dirs[0]} " " ${temp_dirs[$build_num]} "
85
+ echo " $diff_output "
98
86
all_identical=false
99
87
fi
100
88
done
0 commit comments