44# Test that verifies TASTy files can be generated deterministically
55echo " Testing TASTy file generation with Scala 3..."
66
7- # Clean any previous builds
8- bazel clean
9-
107# Build the Scala 3 target, explicitly using Scala 3 toolchain
118echo " Building target with Scala 3 toolchain..."
129bazel 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)
2017
2118cleanup () {
2219 exit_code=$?
23- # This will be updated later to handle multiple directories
2420 for dir in " ${temp_dirs[@]} " ; do
25- rm -rf " $dir " 2> /dev/null || true
21+ rm -r " $dir " 2> /dev/null || true
2622 done
2723 finish $exit_code
2824}
@@ -61,8 +57,8 @@ temp_dirs=("$temp_dir")
6157# Perform 4 additional builds (we already have one)
6258for i in $( seq 2 5) ; do
6359 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
6662
6763 # Create temp directory for this build
6864 temp_dir_n=$( mktemp -d)
@@ -75,26 +71,18 @@ for i in $(seq 2 5); do
7571 }
7672done
7773
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-
8774# Compare all builds against the first one
8875echo " Comparing TASTy files across all 5 builds for determinism..."
8976all_identical=true
9077
9178for i in $( seq 2 5) ; do
9279 build_num=$(( i- 1 ))
9380 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
9583 echo " ERROR: TASTy files differ between build 1 and build $i - not deterministic"
9684 echo " Differences found:"
97- diff -r " ${temp_dirs[0]} " " ${temp_dirs[$build_num]} "
85+ echo " $diff_output "
9886 all_identical=false
9987 fi
10088done
0 commit comments