X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=486d1c430adbd714f1d08297612c390b4853e3f3;hb=1e69afe8af3512c45061cfde99c9f98e1f94e20c;hp=133fbe4025143ffebf68ddaab47ff582a275dafe;hpb=baf93369f6a204bc16740358a56af95cbaa1f9b5;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 133fbe40..486d1c43 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -73,6 +73,8 @@ if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \ fi TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}} TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient} +TEST_CC=${TEST_CC:-cc} +TEST_CFLAGS=${TEST_CFLAGS:-"-g -O0"} # Protect ourselves from common misconfiguration to export # CDPATH into the environment @@ -1161,6 +1163,19 @@ test_python() { | $cmd - } +test_C () { + exec_file="test${test_count}" + test_file="${exec_file}.c" + cat > ${test_file} + export LD_LIBRARY_PATH=${TEST_DIRECTORY}/../lib + ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc + echo "== stdout ==" > OUTPUT.stdout + echo "== stderr ==" > OUTPUT.stderr + ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr + sed "s,${PWD},CWD,g" OUTPUT.stdout OUTPUT.stderr > OUTPUT +} + + # Creates a script that counts how much time it is executed and calls # notmuch. $notmuch_counter_command is set to the path to the # generated script. Use notmuch_counter_value() function to get the