test_emacs_expect_t does ignore Emacs as prerequisite

David Bremner david at tethera.net
Fri Apr 24 03:29:54 PDT 2020


Milton Vandersloot <miltonrobertvandersloot1412 at protonmail.com> writes:
>
> [PATCH] Let test_emacs_expect_t respect missing external prerequisites
>
> test_emacs_expect_t did not test for missing prerequisites (even though
> it called test_emacs which does it). Fix that by testing for missing
> prerequisites.
>

I agree there's a bug here, but I'm not sure this is the best/cleanest
fix. Maybe Tomi (in Cc) can comment. The logic for prerequisite checking
is already opaque. For example test_skip is already calling
test_check_missing_external_prereqs_ as a side effect. For starters I
wonder if test_emacs should use a return value to indicate failure,
along the lines of the patch at the end of the message.

BTW, it will make our life easier if you follow
https://notmuchmail.org/contributing/#index5h2; in particular using
git-send-email and keeping the discussion/notes after ---.


diff --git a/test/test-lib.sh b/test/test-lib.sh
index 7f8a3a4d..eecc52f7 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -543,9 +543,8 @@ test_emacs_expect_t () {
 	# Run the test.
 	if ! test_skip "$test_subtest_name"
 	then
-		test_emacs "(notmuch-test-run $1)" >/dev/null
-
-		# Restore state after the test.
+		test_emacs "(notmuch-test-run $1)" || return
+                # Restore state after the test.
 		exec 1>&6 2>&7		# Restore stdout and stderr
 		inside_subtest=
 
@@ -997,7 +996,7 @@ test_emacs () {
 	test_require_external_prereq dtach || missing_dependencies=1
 	test_require_external_prereq emacs || missing_dependencies=1
 	test_require_external_prereq ${TEST_EMACSCLIENT} || missing_dependencies=1
-	test -z "$missing_dependencies" || return
+	test -z "$missing_dependencies" || return 1
 
 	if [ -z "$EMACS_SERVER" ]; then
 		emacs_tests="$NOTMUCH_SRCDIR/test/${this_test_bare}.el"
@@ -1034,6 +1033,7 @@ test_emacs () {
 	touch OUTPUT
 
 	${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $*)"
+        return 0
 }
 
 test_python() {



More information about the notmuch mailing list