From 76943f911134863596eb5ca150f7b9c8051eac72 Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Thu, 16 Apr 2020 18:02:43 +0200 Subject: chore: Add shell script to automate the tests * Inspired by https://github.com/pfitaxel/learn-ocaml.el/blob/master/test.sh (under license MIT) --- ci/test.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 ci/test.sh (limited to 'ci') diff --git a/ci/test.sh b/ci/test.sh new file mode 100755 index 00000000..e9e0b472 --- /dev/null +++ b/ci/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Print $1 in green +green () { + echo -e "\e[32m$1\e[0m" +} + +# Print $1 in red +red () { + echo -e "\e[31m$1\e[0m" +} + +assert () { + if [ $# -lt 1 ]; then + red "ERROR, assert expects some args (the code to run)" + exit 1 + fi + /bin/bash -exc '"$@"' bash "$@" + ret=$? + if [ "$ret" -ne 0 ]; then + red "FAILURE, this shell command returned exit status $ret: +\$ $(printf "'%s' " "$@")\n" + exit $ret + fi + echo +} + +############################################################################### + +assert emacs --version + +srcdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && cd .. && pwd ) +rootdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd ) + +# form="(message \"OK\")" +form="(progn (add-to-list 'load-path \"$rootdir\") (add-to-list 'load-path \"$srcdir\"))" + +assert emacs --batch -l ert -l init-tests.el --eval "$form" -l proof-general.el -f ert-run-tests-batch-and-exit -- cgit v1.2.3