tutorial check test, test scripts refactoring

This commit is contained in:
ProgramSnail 2025-04-07 01:11:26 +03:00
parent 3834897b78
commit 467eeb0eef
4 changed files with 63 additions and 22 deletions

View file

@ -20,10 +20,11 @@ $compiler -b ../stdlib/Fun.lama
for test in regression/dep_test*.lama; do for test in regression/dep_test*.lama; do
echo $test echo $test
$compiler -b $test -I regression/ $compiler -b $test -I regression/
test_file="${test%.*}" test_path="${test%.*}"
echo $test_file test_file="${test_path##*/}"
cat $test_file.input | ./byterun.exe -vi dep_test*.bc echo $test_path: $test_file
rm dep_test*.bc cat $test_path.input | ./byterun.exe -vi $test_file.bc
rm $test_file.bc
echo "done" echo "done"
done done

View file

@ -13,16 +13,17 @@ echo $compiler
for test in ../regression/*.lama; do for test in ../regression/*.lama; do
echo $test echo $test
$compiler -b $test > /dev/null $compiler -b $test > /dev/null
test_file="${test%.*}" test_path="${test%.*}"
echo $test_file test_file="${test_path##*/}"
# cat $test_file.input | ./byterun.exe -p test*.bc > test.bc.code echo $test_path: $test_file
# cat $test_file.input | ./byterun.exe -p test*.bc # cat $test_file.input | ./byterun.exe -p $test_file.bc > test.bc.code
# cat $test_file.input | ./byterun.exe -vi test*.bc # cat $test_file.input | ./byterun.exe -p $test_file.bc
cat $test_file.input | ./byterun.exe -vi test*.bc > test.log # cat $test_file.input | ./byterun.exe -vi $test_file.bc
sed '1d;s/^..//' $test_file.t > test_orig.log cat $test_path.input | ./byterun.exe -vi $test_file.bc > test.log
sed '1d;s/^..//' $test_path.t > test_orig.log
diff test.log test_orig.log diff test.log test_orig.log
rm test*.bc rm $test_file.bc
rm test.log test_orig.log rm test.log test_orig.log
echo "done" echo "done"
done done

View file

@ -12,27 +12,31 @@ echo $compiler
echo "Build modules:" echo "Build modules:"
for mod in ../stdlib/*.lama; do for mod in ../stdlib/*.lama; do
echo $mod mod_path="${mod%.*}"
$compiler -b $mod -I ../stdlib/ mod_file="${mod_path##*/}"
echo $mod_path: $mod_file
if [ ! -f $mod_file.bc ]; then
$compiler -b $mod -I ../stdlib/
fi
done done
echo "Run tests:" echo "Run tests:"
for test in ../stdlib/regression/*.lama; do for test in ../stdlib/regression/*.lama; do
echo $test echo $test
$compiler -b $test -I ../stdlib/ > /dev/null $compiler -b $test -I ../stdlib/ > /dev/null
test_file="${test%.*}" test_path="${test%.*}"
echo $test_file test_file="${test_path##*/}"
# cat $test_file.input | ./byterun.exe -p test*.bc > test.bc.code echo $test_path: $test_file
# cat $test_file.input | ./byterun.exe -p test*.bc # cat $test_file.input | ./byterun.exe -p $test_file.bc > test.bc.code
echo "" | ./byterun.exe -vi test*.bc # cat $test_file.input | ./byterun.exe -p $test_file.bc
# echo "" | ./byterun.exe -vi test*.bc > test.log echo "" | ./byterun.exe -vi $test_file.bc
# echo "" | ./byterun.exe -vi $test_file.bc > test.log
# sed '1d;s/^..//' $test_file.t > test_orig.log # sed '1d;s/^..//' $test_file.t > test_orig.log
# diff test.log test_orig.log # diff test.log test_orig.log
rm test*.bc rm $test_file.bc
# rm test.log test_orig.log # rm test.log test_orig.log
echo "done" echo "done"
done done
rm *.bc
rm *.o rm *.o

35
byterun/tutorial_check.sh Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env bash
dune build > /dev/null
prefix="../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
for test in ../tutorial/*.lama; do
echo $test
$compiler -b $test -I ../stdlib/
test_path="${test%.*}"
test_file="${test_path##*/}"
echo $test_path: $test_file
echo " " | ./byterun.exe -vi $test_file.bc
rm $test_file.bc
echo "done"
done
rm *.o