code_snippets/c_projects/x_tfw4c/testrunner.sh
xavi a48d8e998d Added a firstpass of a pre-push githook
This checksout every new commit and runs a testfile on it.
2025-12-23 21:46:32 -08:00

28 lines
480 B
Bash
Executable File

#!/bin/bash
while read -r local_ref local_sha remote_ref remote_sha; do
echo $local_ref
echo $local_sha
echo $remote_ref
echo $remote_sha
done
for commit in $(git log main..test_framework --pretty=format:%h)
do
git checkout $commit
make clean
make
./x_tfw4c
rc=$?
if [ $rc -eq 1 ]; then
git checkout $current_branch
echo -e "\n"
echo -e "Tests completed with \e[31mFAILURES\e[0m"
echo "ABORTING git push"
exit 1
fi
done
git checkout $current_branch
exit 0