Skip to content

regression-tests: run tests using bash #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions regression-tests/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
rm -rf ./test-results/*
cp ./*.cpp2 ./test-results

stats() {
echo "$1 SUCCESS"
echo "$2 FAILED"
}

declare -a transpile_success
declare -a transpile_failure
transpile() {
for filename in `find ./test-results -name "$1"`; do
cppfront $2 $filename &> ./$filename-output 2>&1 && transpile_success+=($filename) || transpile_failure+=($filename)
done
}

declare -a compile_success
declare -a compile_failure
compile() {
for filename in `find ./test-results -regex '.*\(cpp\)$' -type f`; do
g++-$1 -I$2 -o $filename.out $filename -std=c++20 >> ./$filename-output 2>&1 \
&& compile_success+=($filename) \
|| compile_failure+=($filename)
done
}

declare -a run_success
declare -a run_failure
run() {
for filename in `find ./test-results -regex '.*\(out\)$' -type f`; do
./$filename >> ./$filename-output 2>&1 \
&& run_success+=($filename) \
|| run_failure+=($filename)
done
}

#### TRANSPILE ####
echo "TRANSPILE:"
transpile "mixed*.cpp2"
transpile "pure*.cpp2" "-p"

stats ${#transpile_success[@]} ${#transpile_failure[@]}
printf '%s\n' "${transpile_failure[@]}"

#### COMPILE ####
echo "COMPILE:"
compile 11 ../include
stats ${#compile_success[@]} ${#compile_failure[@]}
printf '%s\n' "${compile_failure[@]}"

#### EXECUTE ####
echo "RUN"
run
stats ${#run_success[@]} ${#run_failure[@]}
printf '%s\n' "${run_failure[@]}"