[PATCH v2 1/3] test: move system includes to notmuch-test.h

Subject: [PATCH v2 1/3] test: move system includes to notmuch-test.h

Date: Thu, 28 Oct 2021 10:46:23 -0300

To: Tomi Ollila, David Bremner, notmuch@notmuchmail.org

Cc:

From: David Bremner


This removes some redudant includes, and will also make it easier to
introduce "#define _GNU_SOURCE", which must come before all system
includes.
---
 test/T562-lib-database.sh      | 4 +---
 test/T563-lib-directory.sh     | 4 +---
 test/T564-lib-query.sh         | 4 +---
 test/T566-lib-message.sh       | 3 +--
 test/T568-lib-thread.sh        | 3 +--
 test/T590-libconfig.sh         | 4 ----
 test/T595-reopen.sh            | 2 --
 test/T610-message-property.sh  | 4 ----
 test/T620-lock.sh              | 3 ---
 test/T640-database-modified.sh | 5 +----
 test/notmuch-test.h            | 6 ++++++
 11 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/test/T562-lib-database.sh b/test/T562-lib-database.sh
index 769fe86e..d9f5d18e 100755
--- a/test/T562-lib-database.sh
+++ b/test/T562-lib-database.sh
@@ -9,10 +9,8 @@ test_begin_subtest "building database"
 test_expect_success "NOTMUCH_NEW"
 
 cat <<EOF > c_head
-#include <stdio.h>
-#include <notmuch.h>
 #include <notmuch-test.h>
-#include <talloc.h>
+
 int main (int argc, char** argv)
 {
    notmuch_database_t *db;
diff --git a/test/T563-lib-directory.sh b/test/T563-lib-directory.sh
index 28325ff2..ad390c1c 100755
--- a/test/T563-lib-directory.sh
+++ b/test/T563-lib-directory.sh
@@ -9,10 +9,8 @@ test_begin_subtest "building database"
 test_expect_success "NOTMUCH_NEW"
 
 cat <<EOF > c_head
-#include <stdio.h>
-#include <notmuch.h>
 #include <notmuch-test.h>
-#include <talloc.h>
+
 int main (int argc, char** argv)
 {
    notmuch_database_t *db;
diff --git a/test/T564-lib-query.sh b/test/T564-lib-query.sh
index 50b0a88e..ff1d4984 100755
--- a/test/T564-lib-query.sh
+++ b/test/T564-lib-query.sh
@@ -9,10 +9,8 @@ test_begin_subtest "building database"
 test_expect_success "NOTMUCH_NEW"
 
 cat <<EOF > c_head
-#include <stdio.h>
-#include <notmuch.h>
 #include <notmuch-test.h>
-#include <talloc.h>
+
 int main (int argc, char** argv)
 {
    notmuch_database_t *db;
diff --git a/test/T566-lib-message.sh b/test/T566-lib-message.sh
index ee55ef29..8b61d182 100755
--- a/test/T566-lib-message.sh
+++ b/test/T566-lib-message.sh
@@ -19,9 +19,8 @@ cat <<'EOF' > c_tail
 EOF
 
 cat <<EOF > c_head0
-#include <stdio.h>
-#include <notmuch.h>
 #include <notmuch-test.h>
+
 int main (int argc, char** argv)
 {
    notmuch_database_t *db;
diff --git a/test/T568-lib-thread.sh b/test/T568-lib-thread.sh
index 088e66dd..b45836cd 100755
--- a/test/T568-lib-thread.sh
+++ b/test/T568-lib-thread.sh
@@ -24,9 +24,8 @@ cat <<'EOF' > c_tail
 EOF
 
 cat <<EOF > c_head
-#include <stdio.h>
-#include <notmuch.h>
 #include <notmuch-test.h>
+
 int main (int argc, char** argv)
 {
    notmuch_database_t *db;
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index a9566c13..0d890ca0 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -23,8 +23,6 @@ EOF
 }
 
 cat <<EOF > c_head
-#include <string.h>
-#include <stdlib.h>
 #include <notmuch-test.h>
 
 int main (int argc, char** argv)
@@ -616,8 +614,6 @@ cp notmuch-config.bak notmuch-config
 test_expect_equal_file EXPECTED OUTPUT
 
 cat <<EOF > c_head2
-#include <string.h>
-#include <stdlib.h>
 #include <notmuch-test.h>
 
 int main (int argc, char** argv)
diff --git a/test/T595-reopen.sh b/test/T595-reopen.sh
index 7375e2ac..1a517423 100755
--- a/test/T595-reopen.sh
+++ b/test/T595-reopen.sh
@@ -6,8 +6,6 @@ test_description="library reopen API"
 add_email_corpus
 
 cat <<EOF > c_head
-#include <string.h>
-#include <stdlib.h>
 #include <notmuch-test.h>
 
 int main (int argc, char** argv)
diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
index d0e52f4a..4ec85474 100755
--- a/test/T610-message-property.sh
+++ b/test/T610-message-property.sh
@@ -6,10 +6,6 @@ test_description="message property API"
 add_email_corpus
 
 cat <<EOF > c_head
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <talloc.h>
 #include <notmuch-test.h>
 
 void print_properties (notmuch_message_t *message, const char *prefix, notmuch_bool_t exact) {
diff --git a/test/T620-lock.sh b/test/T620-lock.sh
index 7aaaff2a..8f4c380f 100755
--- a/test/T620-lock.sh
+++ b/test/T620-lock.sh
@@ -9,9 +9,6 @@ if [ $NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK -ne 1 ]; then
     test_subtest_known_broken
 fi
 test_C ${MAIL_DIR} <<'EOF'
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/wait.h>
 #include <notmuch-test.h>
 
 void
diff --git a/test/T640-database-modified.sh b/test/T640-database-modified.sh
index 274105c7..636b20c7 100755
--- a/test/T640-database-modified.sh
+++ b/test/T640-database-modified.sh
@@ -10,11 +10,8 @@ test_begin_subtest "catching DatabaseModifiedError in _notmuch_message_ensure_me
 first_id=$(notmuch search --output=messages '*'| head -1 | sed s/^id://)
 
 test_C ${MAIL_DIR} <<EOF
-#include <unistd.h>
-#include <stdlib.h>
 #include <notmuch-test.h>
-#include <talloc.h>
-#include <assert.h>
+
 int
 main (int argc, char **argv)
 {
diff --git a/test/notmuch-test.h b/test/notmuch-test.h
index 34dbb8e0..3a0e90a3 100644
--- a/test/notmuch-test.h
+++ b/test/notmuch-test.h
@@ -1,7 +1,13 @@
 #ifndef _NOTMUCH_TEST_H
 #define _NOTMUCH_TEST_H
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <talloc.h>
+#include <unistd.h>
+
 #include <notmuch.h>
 
 inline static void
-- 
2.33.0

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: