test: move system includes to notmuch-test.h

This removes some redudant includes, and will also make it easier to
introduce "#define _GNU_SOURCE", which must come before all system
includes.
This commit is contained in:
David Bremner 2021-10-28 09:32:34 -03:00
parent 18cdd21b8b
commit 1643c0459a
11 changed files with 12 additions and 30 deletions

View file

@ -9,10 +9,8 @@ test_begin_subtest "building database"
test_expect_success "NOTMUCH_NEW" test_expect_success "NOTMUCH_NEW"
cat <<EOF > c_head cat <<EOF > c_head
#include <stdio.h>
#include <notmuch.h>
#include <notmuch-test.h> #include <notmuch-test.h>
#include <talloc.h>
int main (int argc, char** argv) int main (int argc, char** argv)
{ {
notmuch_database_t *db; notmuch_database_t *db;

View file

@ -9,10 +9,8 @@ test_begin_subtest "building database"
test_expect_success "NOTMUCH_NEW" test_expect_success "NOTMUCH_NEW"
cat <<EOF > c_head cat <<EOF > c_head
#include <stdio.h>
#include <notmuch.h>
#include <notmuch-test.h> #include <notmuch-test.h>
#include <talloc.h>
int main (int argc, char** argv) int main (int argc, char** argv)
{ {
notmuch_database_t *db; notmuch_database_t *db;

View file

@ -9,10 +9,8 @@ test_begin_subtest "building database"
test_expect_success "NOTMUCH_NEW" test_expect_success "NOTMUCH_NEW"
cat <<EOF > c_head cat <<EOF > c_head
#include <stdio.h>
#include <notmuch.h>
#include <notmuch-test.h> #include <notmuch-test.h>
#include <talloc.h>
int main (int argc, char** argv) int main (int argc, char** argv)
{ {
notmuch_database_t *db; notmuch_database_t *db;

View file

@ -19,9 +19,8 @@ cat <<'EOF' > c_tail
EOF EOF
cat <<EOF > c_head0 cat <<EOF > c_head0
#include <stdio.h>
#include <notmuch.h>
#include <notmuch-test.h> #include <notmuch-test.h>
int main (int argc, char** argv) int main (int argc, char** argv)
{ {
notmuch_database_t *db; notmuch_database_t *db;

View file

@ -24,9 +24,8 @@ cat <<'EOF' > c_tail
EOF EOF
cat <<EOF > c_head cat <<EOF > c_head
#include <stdio.h>
#include <notmuch.h>
#include <notmuch-test.h> #include <notmuch-test.h>
int main (int argc, char** argv) int main (int argc, char** argv)
{ {
notmuch_database_t *db; notmuch_database_t *db;

View file

@ -23,8 +23,6 @@ EOF
} }
cat <<EOF > c_head cat <<EOF > c_head
#include <string.h>
#include <stdlib.h>
#include <notmuch-test.h> #include <notmuch-test.h>
int main (int argc, char** argv) int main (int argc, char** argv)
@ -639,8 +637,6 @@ cp notmuch-config.bak notmuch-config
test_expect_equal_file EXPECTED OUTPUT test_expect_equal_file EXPECTED OUTPUT
cat <<EOF > c_head2 cat <<EOF > c_head2
#include <string.h>
#include <stdlib.h>
#include <notmuch-test.h> #include <notmuch-test.h>
int main (int argc, char** argv) int main (int argc, char** argv)

View file

@ -6,8 +6,6 @@ test_description="library reopen API"
add_email_corpus add_email_corpus
cat <<EOF > c_head cat <<EOF > c_head
#include <string.h>
#include <stdlib.h>
#include <notmuch-test.h> #include <notmuch-test.h>
int main (int argc, char** argv) int main (int argc, char** argv)

View file

@ -6,10 +6,6 @@ test_description="message property API"
add_email_corpus add_email_corpus
cat <<EOF > c_head cat <<EOF > c_head
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <talloc.h>
#include <notmuch-test.h> #include <notmuch-test.h>
void print_properties (notmuch_message_t *message, const char *prefix, notmuch_bool_t exact) { void print_properties (notmuch_message_t *message, const char *prefix, notmuch_bool_t exact) {

View file

@ -9,9 +9,6 @@ if [ $NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK -ne 1 ]; then
test_subtest_known_broken test_subtest_known_broken
fi fi
test_C ${MAIL_DIR} <<'EOF' test_C ${MAIL_DIR} <<'EOF'
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <notmuch-test.h> #include <notmuch-test.h>
void void

View file

@ -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://) first_id=$(notmuch search --output=messages '*'| head -1 | sed s/^id://)
test_C ${MAIL_DIR} <<EOF test_C ${MAIL_DIR} <<EOF
#include <unistd.h>
#include <stdlib.h>
#include <notmuch-test.h> #include <notmuch-test.h>
#include <talloc.h>
#include <assert.h>
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {

View file

@ -1,7 +1,13 @@
#ifndef _NOTMUCH_TEST_H #ifndef _NOTMUCH_TEST_H
#define _NOTMUCH_TEST_H #define _NOTMUCH_TEST_H
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <talloc.h>
#include <unistd.h>
#include <notmuch.h> #include <notmuch.h>
inline static void inline static void