bloat-buster/run_tests.sh
2024-07-24 13:55:32 +02:00

65 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
set -e
source ./compile.sh
all=$1
all=$1
build_dir="build"
base_exe_name="nest"
debug_flags="-g"
no_optimization_flags=""
test_names="first"
if [ "$all" == "1" ]
then
optimization_modes=("-O0" "-O1" "-O2" "-Os" "-Oz" "-O3")
case "$OSTYPE" in
darwin*) linking_modes=("0") ;;
linux*) linking_modes=("0" "1") ;;
*) echo "unknown: $OSTYPE"; exit 1 ;;
esac
else
optimization_modes=("-O0")
case "$OSTYPE" in
darwin*) linking_modes=("0") ;;
linux*) linking_modes=("1") ;;
*) echo "unknown: $OSTYPE"; exit 1 ;;
esac
fi
for linking_mode in "${linking_modes[@]}"
do
for optimization_mode in "${optimization_modes[@]}"
do
printf "\n===========================\n"
echo "TESTS (STATIC=$linking_mode, $optimization_mode)"
printf "===========================\n\n"
exe_name="${base_exe_name}_${optimization_mode}_$linking_mode"
compile $build_dir $exe_name $debug_flags $optimization_mode $linking_mode;
printf "\n===========================\n"
echo "COMPILER BUILD OK"
printf "===========================\n\n"
for test_name in "${test_names[@]}"
do
printf "\n===========================\n"
echo "$test_name..."
printf "===========================\n\n"
cmd="build/$exe_name tests/$test_name.nat"
echo "Run command: $cmd"
eval "$cmd"
printf "\n===========================\n"
echo "$test_name [COMPILATION] [OK]"
printf "===========================\n\n"
nest/$test_name
printf "\n===========================\n"
echo "$test_name [RUN] [OK]"
printf "===========================\n\n"
done
done
done