From a48d8e998d9291c6e9959a84f9f91510ce95bb13 Mon Sep 17 00:00:00 2001 From: xavi Date: Tue, 23 Dec 2025 21:42:27 -0800 Subject: [PATCH] Added a firstpass of a pre-push githook This checksout every new commit and runs a testfile on it. --- c_projects/x_tfw4c/testrunner.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 c_projects/x_tfw4c/testrunner.sh diff --git a/c_projects/x_tfw4c/testrunner.sh b/c_projects/x_tfw4c/testrunner.sh new file mode 100755 index 0000000..35b5150 --- /dev/null +++ b/c_projects/x_tfw4c/testrunner.sh @@ -0,0 +1,27 @@ +#!/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