lama_byterun/byterun/stdlib_regression_check.sh
2025-06-09 17:00:19 +03:00

50 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
xmake build
cp "build/linux/x86_64/release/byterun" byterun.exe
# dune build > /dev/null
prefix="../stdlib/regression/"
suffix=".lama"
compiler=../_build/default/src/Driver.exe
echo "Used compiler path:"
echo $compiler
echo "Build modules:"
for mod in ../stdlib/*.lama; do
mod_path="${mod%.*}"
mod_file="${mod_path##*/}"
echo $mod_path: $mod_file
if [ ! -f $mod_file.bc ]; then
$compiler -b $mod -I ../stdlib/
fi
done
echo "Run tests:"
for test in ../stdlib/regression/*.lama; do
echo $test
$compiler -b $test -I ../stdlib/ > /dev/null
test_path="${test%.*}"
test_file="${test_path##*/}"
echo $test_path: $test_file
echo "" | ./byterun.exe -p $test_file.bc > test.bc.code
# echo "" | ./byterun.exe -p $test_file.bc
# echo "" | ./byterun.exe -vi $test_file.bc
echo "" | ./byterun.exe -vi $test_file.bc > test.log
sed '1d;2d;3d;s/^..//' $test_path.t > test_orig.log
# echo "Result:"
# cat test.log
# echo "Original:"
# cat test_orig.log
echo "Diff:"
diff test.log test_orig.log
rm $test_file.bc
rm test.log test_orig.log
echo "done"
done
rm *.o