aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Neil <suky0001@free.fr>2009-04-07 21:59:15 +0000
committerBenoit Neil <suky0001@free.fr>2009-04-07 21:59:15 +0000
commite9dd0998706a0ce099826b982bbb1671909fe026 (patch)
tree89947e0e7475380f446f0387a9b74d86d4ff9977
parent070d89a5610070e5af7178481bcaacce24bd9af2 (diff)
Added missing tests in CMake, added Makefile.inc for tests (+ use in CMake scripts), and fixed a missing define under windows in a test source file.
-rw-r--r--CMakeLists.txt8
-rw-r--r--tests/libtest/CMakeLists.txt128
-rw-r--r--tests/libtest/Makefile.am127
-rw-r--r--tests/libtest/Makefile.inc125
-rw-r--r--tests/libtest/lib556.c12
-rw-r--r--tests/server/CMakeLists.txt37
-rw-r--r--tests/server/Makefile.am25
-rw-r--r--tests/server/Makefile.inc22
8 files changed, 275 insertions, 209 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 781f27dfd..09f7325b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -786,11 +786,15 @@ ENDFUNCTION()
# Ugly (but functional) way to include "Makefile.inc" by transforming it (= regenerate it).
FUNCTION(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE)
FILE(READ ${INPUT_FILE} MAKEFILE_INC_TEXT)
- STRING(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
+ STRING(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
+ STRING(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
+
STRING(REGEX REPLACE "\\\\\n" "§!§" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
STRING(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*\n)" "SET(\\1 \\2)\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
STRING(REPLACE "§!§" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
- STRING(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
+
+ STRING(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace $() with ${}
+ STRING(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace @@ with ${}, even if that may not be read by CMake scripts.
FILE(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT})
### BUGGY METHOD 1
diff --git a/tests/libtest/CMakeLists.txt b/tests/libtest/CMakeLists.txt
index b0bf77187..247d63c3b 100644
--- a/tests/libtest/CMakeLists.txt
+++ b/tests/libtest/CMakeLists.txt
@@ -27,50 +27,92 @@ MACRO(SETUP_TEST TEST_NAME) # ARGN are the files in the test
ENDMACRO()
-
-# files used only in some libcurl test programs
-SET(TESTUTIL testutil.c testutil.h)
-
-# these files are used in every single test program below
-SET(SUPPORTFILES first.c test.h)
-
-# These are all libcurl test programs
-SET(noinst_PROGRAMS
- lib500 lib501 lib502 lib503 lib504 lib505 lib506
- lib507 lib508 lib510 lib511 lib512 lib513 lib514 lib515 lib516
- lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 #lib527
- #lib529
- lib530
- #lib532
- lib533 lib536 lib537 lib540 lib541 lib542 lib543
- lib544
- #lib545
- lib547
- #lib548
- lib549 lib552 lib553 lib554 lib555 lib556
- lib539 lib557 lib558
- #lib559
- lib560
-)
-
-SET(noinst_PROGRAMS_USE_TESTUTIL
- lib502 lib503 lib504
- lib507
- lib525 lib526 #lib527
- #lib529
- lib530
- #lib532
- lib533 lib536
- lib555
-)
-
+TRANSFORM_MAKEFILE_INC("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
+INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
FOREACH(TEST_NAME ${noinst_PROGRAMS})
- SET(SOURCE "${TEST_NAME}.c" ${SUPPORTFILES})
- LIST(FIND noinst_PROGRAMS_USE_TESTUTIL ${TEST_NAME} USES_TESTUTIL)
- IF(NOT ${USES_TESTUTIL} EQUAL -1)
- LIST(APPEND SOURCE ${TESTUTIL}) # Need TestUtil
- ENDIF()
- SETUP_TEST(${TEST_NAME} ${SOURCE})
+ SETUP_TEST(${TEST_NAME} ${${TEST_NAME}_SOURCES})
ENDFOREACH()
+
+# # files used only in some libcurl test programs
+# SET(TESTUTIL testutil.c testutil.h)
+
+# # these files are used in every single test program below
+# SET(SUPPORTFILES first.c test.h)
+
+# # These are all libcurl test programs
+# SET(noinst_PROGRAMS
+ # lib500 lib501 lib502 lib503 lib504 lib505 lib506
+ # lib507 lib508 lib510 lib511 lib512 lib513 lib514 lib515 lib516
+ # lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526
+ # #lib527
+ # #lib529
+ # lib530
+ # #lib532
+ # lib533 lib536 lib537 lib540 lib541 lib542 lib543
+ # lib544
+ # #lib545
+ # lib547
+ # #lib548
+ # lib549 lib552 lib553 lib554 lib555 lib556
+ # lib539 lib557 lib558
+ # #lib559
+ # lib560
+# )
+
+# SET(noinst_PROGRAMS_USE_TESTUTIL
+ # lib502 lib503 lib504
+ # lib507
+ # lib525 lib526 lib527
+ # lib529
+ # lib530
+ # lib532
+ # lib533 lib536
+ # lib555
+# )
+
+# MACRO(ADD_TESTUTIL_IF_NECESSARY TEST_NAME)
+ # LIST(FIND noinst_PROGRAMS_USE_TESTUTIL ${TEST_NAME} USES_TESTUTIL)
+ # IF(NOT ${USES_TESTUTIL} EQUAL -1)
+ # LIST(APPEND SOURCE ${TESTUTIL}) # Need TestUtil
+ # ENDIF()
+# ENDMACRO()
+
+# # General case
+# FOREACH(TEST_NAME ${noinst_PROGRAMS})
+ # SET(SOURCE "${TEST_NAME}.c" ${SUPPORTFILES})
+ # ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
+ # SETUP_TEST(${TEST_NAME} ${SOURCE})
+# ENDFOREACH()
+
+# # Special cases
+# SET(TEST_NAME lib527)
+# SET(SOURCE "lib526.c" ${SUPPORTFILES})
+# ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
+# SETUP_TEST(${TEST_NAME} ${SOURCE})
+
+# SET(TEST_NAME lib529)
+# SET(SOURCE "lib525.c" ${SUPPORTFILES})
+# ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
+# SETUP_TEST(${TEST_NAME} ${SOURCE})
+
+# SET(TEST_NAME lib532)
+# SET(SOURCE "lib526.c" ${SUPPORTFILES})
+# ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
+# SETUP_TEST(${TEST_NAME} ${SOURCE})
+
+# SET(TEST_NAME lib545)
+# SET(SOURCE "lib544.c" ${SUPPORTFILES})
+# ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
+# SETUP_TEST(${TEST_NAME} ${SOURCE})
+
+# SET(TEST_NAME lib548)
+# SET(SOURCE "lib547.c" ${SUPPORTFILES})
+# ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
+# SETUP_TEST(${TEST_NAME} ${SOURCE})
+
+# SET(TEST_NAME lib559)
+# SET(SOURCE "lib558.c" ${SUPPORTFILES})
+# ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
+# SETUP_TEST(${TEST_NAME} ${SOURCE})
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index ed2c18dbf..21d89808f 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -41,132 +41,9 @@ LIBDIR = $(top_builddir)/lib
EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl test1022.pl
-# files used only in some libcurl test programs
-TESTUTIL = testutil.c testutil.h
-
-# these files are used in every single test program below
-SUPPORTFILES = first.c test.h
-
-# These are all libcurl test programs
-noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \
- lib507 lib508 lib510 lib511 lib512 lib513 lib514 lib515 lib516 \
- lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 lib527 \
- lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 lib543 \
- lib544 lib545 lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 \
- lib539 lib557 lib558 lib559 lib560
-
# Dependencies (may need to be overriden)
LDADD = $(LIBDIR)/libcurl.la
DEPENDENCIES = $(LIBDIR)/libcurl.la
-
-lib500_SOURCES = lib500.c $(SUPPORTFILES)
-
-lib501_SOURCES = lib501.c $(SUPPORTFILES)
-
-lib502_SOURCES = lib502.c $(SUPPORTFILES) $(TESTUTIL)
-
-lib503_SOURCES = lib503.c $(SUPPORTFILES) $(TESTUTIL)
-
-lib504_SOURCES = lib504.c $(SUPPORTFILES) $(TESTUTIL)
-
-lib505_SOURCES = lib505.c $(SUPPORTFILES)
-
-lib506_SOURCES = lib506.c $(SUPPORTFILES)
-
-lib507_SOURCES = lib507.c $(SUPPORTFILES) $(TESTUTIL)
-
-lib508_SOURCES = lib508.c $(SUPPORTFILES)
-
-lib510_SOURCES = lib510.c $(SUPPORTFILES)
-
-lib511_SOURCES = lib511.c $(SUPPORTFILES)
-
-lib512_SOURCES = lib512.c $(SUPPORTFILES)
-
-lib513_SOURCES = lib513.c $(SUPPORTFILES)
-
-lib514_SOURCES = lib514.c $(SUPPORTFILES)
-
-lib515_SOURCES = lib515.c $(SUPPORTFILES)
-
-lib516_SOURCES = lib516.c $(SUPPORTFILES)
-
-lib517_SOURCES = lib517.c $(SUPPORTFILES)
-
-lib518_SOURCES = lib518.c $(SUPPORTFILES)
-
-lib519_SOURCES = lib519.c $(SUPPORTFILES)
-
-lib520_SOURCES = lib520.c $(SUPPORTFILES)
-
-lib521_SOURCES = lib521.c $(SUPPORTFILES)
-
-lib523_SOURCES = lib523.c $(SUPPORTFILES)
-
-lib524_SOURCES = lib524.c $(SUPPORTFILES)
-
-lib525_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL)
-
-lib526_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL)
-lib526_CFLAGS = -DLIB526
-
-lib527_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL)
-lib527_CFLAGS = -DLIB527
-
-lib529_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL)
-lib529_CFLAGS = -DLIB529
-
-lib530_SOURCES = lib530.c $(SUPPORTFILES) $(TESTUTIL)
-lib530_CFLAGS = -DLIB530
-
-lib532_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL)
-lib532_CFLAGS = -DLIB532
-
-lib533_SOURCES = lib533.c $(SUPPORTFILES) $(TESTUTIL)
-
-lib536_SOURCES = lib536.c $(SUPPORTFILES) $(TESTUTIL)
-
-lib537_SOURCES = lib537.c $(SUPPORTFILES)
-
-lib539_SOURCES = lib539.c $(SUPPORTFILES)
-
-lib540_SOURCES = lib540.c $(SUPPORTFILES)
-
-lib541_SOURCES = lib541.c $(SUPPORTFILES)
-
-lib542_SOURCES = lib542.c $(SUPPORTFILES)
-
-lib543_SOURCES = lib543.c $(SUPPORTFILES)
-
-lib544_SOURCES = lib544.c $(SUPPORTFILES)
-
-lib545_SOURCES = lib544.c $(SUPPORTFILES)
-lib545_CFLAGS = -DLIB545
-
-lib547_SOURCES = lib547.c $(SUPPORTFILES)
-
-lib548_SOURCES = lib547.c $(SUPPORTFILES)
-lib548_CFLAGS = -DLIB548
-
-lib549_SOURCES = lib549.c $(SUPPORTFILES)
-
-lib555_SOURCES = lib555.c $(SUPPORTFILES) $(TESTUTIL)
-
-lib552_SOURCES = lib552.c $(SUPPORTFILES)
-
-lib553_SOURCES = lib553.c $(SUPPORTFILES)
-
-lib554_SOURCES = lib554.c $(SUPPORTFILES)
-
-lib556_SOURCES = lib556.c $(SUPPORTFILES)
-
-lib557_SOURCES = lib557.c $(SUPPORTFILES)
-
-lib558_SOURCES = lib558.c $(SUPPORTFILES)
-lib558_CFLAGS = -DLIB558
-
-lib559_SOURCES = lib558.c $(SUPPORTFILES)
-lib559_CFLAGS = -DLIB559
-
-lib560_SOURCES = lib560.c $(SUPPORTFILES)
+# Makefile.inc provides the source defines (TESTUTIL, SUPPORTFILES, noinst_PROGRAMS, lib*_SOURCES, and lib*_CFLAGS)
+include Makefile.inc
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
new file mode 100644
index 000000000..6b1965f80
--- /dev/null
+++ b/tests/libtest/Makefile.inc
@@ -0,0 +1,125 @@
+# files used only in some libcurl test programs
+TESTUTIL = testutil.c testutil.h
+
+# these files are used in every single test program below
+SUPPORTFILES = first.c test.h
+
+# These are all libcurl test programs
+noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \
+ lib507 lib508 lib510 lib511 lib512 lib513 lib514 lib515 lib516 \
+ lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 lib527 \
+ lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 lib543 \
+ lib544 lib545 lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 \
+ lib539 lib557 lib558 lib559 lib560
+
+
+lib500_SOURCES = lib500.c $(SUPPORTFILES)
+
+lib501_SOURCES = lib501.c $(SUPPORTFILES)
+
+lib502_SOURCES = lib502.c $(SUPPORTFILES) $(TESTUTIL)
+
+lib503_SOURCES = lib503.c $(SUPPORTFILES) $(TESTUTIL)
+
+lib504_SOURCES = lib504.c $(SUPPORTFILES) $(TESTUTIL)
+
+lib505_SOURCES = lib505.c $(SUPPORTFILES)
+
+lib506_SOURCES = lib506.c $(SUPPORTFILES)
+
+lib507_SOURCES = lib507.c $(SUPPORTFILES) $(TESTUTIL)
+
+lib508_SOURCES = lib508.c $(SUPPORTFILES)
+
+lib510_SOURCES = lib510.c $(SUPPORTFILES)
+
+lib511_SOURCES = lib511.c $(SUPPORTFILES)
+
+lib512_SOURCES = lib512.c $(SUPPORTFILES)
+
+lib513_SOURCES = lib513.c $(SUPPORTFILES)
+
+lib514_SOURCES = lib514.c $(SUPPORTFILES)
+
+lib515_SOURCES = lib515.c $(SUPPORTFILES)
+
+lib516_SOURCES = lib516.c $(SUPPORTFILES)
+
+lib517_SOURCES = lib517.c $(SUPPORTFILES)
+
+lib518_SOURCES = lib518.c $(SUPPORTFILES)
+
+lib519_SOURCES = lib519.c $(SUPPORTFILES)
+
+lib520_SOURCES = lib520.c $(SUPPORTFILES)
+
+lib521_SOURCES = lib521.c $(SUPPORTFILES)
+
+lib523_SOURCES = lib523.c $(SUPPORTFILES)
+
+lib524_SOURCES = lib524.c $(SUPPORTFILES)
+
+lib525_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL)
+
+lib526_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL)
+lib526_CFLAGS = -DLIB526
+
+lib527_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL)
+lib527_CFLAGS = -DLIB527
+
+lib529_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL)
+lib529_CFLAGS = -DLIB529
+
+lib530_SOURCES = lib530.c $(SUPPORTFILES) $(TESTUTIL)
+lib530_CFLAGS = -DLIB530
+
+lib532_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL)
+lib532_CFLAGS = -DLIB532
+
+lib533_SOURCES = lib533.c $(SUPPORTFILES) $(TESTUTIL)
+
+lib536_SOURCES = lib536.c $(SUPPORTFILES) $(TESTUTIL)
+
+lib537_SOURCES = lib537.c $(SUPPORTFILES)
+
+lib539_SOURCES = lib539.c $(SUPPORTFILES)
+
+lib540_SOURCES = lib540.c $(SUPPORTFILES)
+
+lib541_SOURCES = lib541.c $(SUPPORTFILES)
+
+lib542_SOURCES = lib542.c $(SUPPORTFILES)
+
+lib543_SOURCES = lib543.c $(SUPPORTFILES)
+
+lib544_SOURCES = lib544.c $(SUPPORTFILES)
+
+lib545_SOURCES = lib544.c $(SUPPORTFILES)
+lib545_CFLAGS = -DLIB545
+
+lib547_SOURCES = lib547.c $(SUPPORTFILES)
+
+lib548_SOURCES = lib547.c $(SUPPORTFILES)
+lib548_CFLAGS = -DLIB548
+
+lib549_SOURCES = lib549.c $(SUPPORTFILES)
+
+lib555_SOURCES = lib555.c $(SUPPORTFILES) $(TESTUTIL)
+
+lib552_SOURCES = lib552.c $(SUPPORTFILES)
+
+lib553_SOURCES = lib553.c $(SUPPORTFILES)
+
+lib554_SOURCES = lib554.c $(SUPPORTFILES)
+
+lib556_SOURCES = lib556.c $(SUPPORTFILES)
+
+lib557_SOURCES = lib557.c $(SUPPORTFILES)
+
+lib558_SOURCES = lib558.c $(SUPPORTFILES)
+lib558_CFLAGS = -DLIB558
+
+lib559_SOURCES = lib558.c $(SUPPORTFILES)
+lib559_CFLAGS = -DLIB559
+
+lib560_SOURCES = lib560.c $(SUPPORTFILES)
diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c
index 0e3949da3..579321ed9 100644
--- a/tests/libtest/lib556.c
+++ b/tests/libtest/lib556.c
@@ -12,6 +12,17 @@
#include "memdebug.h"
+/* For Windows, mainly (may be moved in a config file?) */
+#ifndef STDIN_FILENO
+ #define STDIN_FILENO 0
+#endif
+#ifndef STDOUT_FILENO
+ #define STDOUT_FILENO 1
+#endif
+#ifndef STDERR_FILENO
+ #define STDERR_FILENO 2
+#endif
+
int test(char *URL)
{
CURLcode res;
@@ -53,7 +64,6 @@ int test(char *URL)
if(iolen)
/* send received stuff to stdout */
write(STDOUT_FILENO, buf, iolen);
-
total += iolen;
} while(((res == CURLE_OK) || (res == CURLE_AGAIN)) && (total < 129));
diff --git a/tests/server/CMakeLists.txt b/tests/server/CMakeLists.txt
index 0df7e16db..2968a218b 100644
--- a/tests/server/CMakeLists.txt
+++ b/tests/server/CMakeLists.txt
@@ -27,19 +27,26 @@ MACRO(SETUP_EXECUTABLE TEST_NAME) # ARGN are the files in the test
ENDMACRO()
-
-SET(useful
- getpart.c getpart.h
- ${CURL_SOURCE_DIR}/lib/strequal.c
- ${CURL_SOURCE_DIR}/lib/base64.c
- ${CURL_SOURCE_DIR}/lib/mprintf.c
- ${CURL_SOURCE_DIR}/lib/memdebug.c
- ${CURL_SOURCE_DIR}/lib/timeval.c
-)
-
-SETUP_EXECUTABLE(sws sws.c util.c util.h ${useful})
-SETUP_EXECUTABLE(resolve resolve.c util.c util.h ${useful})
-SETUP_EXECUTABLE(sockfilt sockfilt.c util.c util.h ${useful} ${CURL_SOURCE_DIR}/lib/inet_pton.c)
-SETUP_EXECUTABLE(getpart testpart.c ${useful})
-SETUP_EXECUTABLE(tftpd tftpd.c util.c util.h ${useful} tftp.h)
+TRANSFORM_MAKEFILE_INC("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
+INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
+
+FOREACH(EXECUTABLE_NAME ${noinst_PROGRAMS})
+ SETUP_EXECUTABLE(${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES})
+ENDFOREACH()
+
+
+# SET(useful
+ # getpart.c getpart.h
+ # ${CURL_SOURCE_DIR}/lib/strequal.c
+ # ${CURL_SOURCE_DIR}/lib/base64.c
+ # ${CURL_SOURCE_DIR}/lib/mprintf.c
+ # ${CURL_SOURCE_DIR}/lib/memdebug.c
+ # ${CURL_SOURCE_DIR}/lib/timeval.c
+# )
+
+# SETUP_EXECUTABLE(sws sws.c util.c util.h ${useful})
+# SETUP_EXECUTABLE(resolve resolve.c util.c util.h ${useful})
+# SETUP_EXECUTABLE(sockfilt sockfilt.c util.c util.h ${useful} ${CURL_SOURCE_DIR}/lib/inet_pton.c)
+# SETUP_EXECUTABLE(getpart testpart.c ${useful})
+# SETUP_EXECUTABLE(tftpd tftpd.c util.c util.h ${useful} tftp.h)
diff --git a/tests/server/Makefile.am b/tests/server/Makefile.am
index 74f0ec2f3..4b8055f09 100644
--- a/tests/server/Makefile.am
+++ b/tests/server/Makefile.am
@@ -37,28 +37,7 @@ INCLUDES = -I$(top_builddir)/include \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib
-noinst_PROGRAMS = sws getpart sockfilt resolve tftpd
-
-useful = getpart.c getpart.h $(top_srcdir)/lib/strequal.c \
- $(top_srcdir)/lib/base64.c $(top_srcdir)/lib/mprintf.c \
- $(top_srcdir)/lib/memdebug.c $(top_srcdir)/lib/timeval.c
-
-resolve_SOURCES= resolve.c util.c util.h $(useful)
-resolve_LDADD = @TEST_SERVER_LIBS@
-
-sws_SOURCES= sws.c util.c util.h $(useful)
-sws_LDADD = @TEST_SERVER_LIBS@
-
-sockfilt_SOURCES = sockfilt.c util.c util.h $(useful) \
- $(top_srcdir)/lib/inet_pton.c
-sockfilt_LDADD = @TEST_SERVER_LIBS@
-
-getpart_SOURCES= testpart.c $(useful)
-# This is needed because of (unused) network debugging functions in memdebug.c
-getpart_LDADD = @TEST_SERVER_LIBS@
-
-tftpd_SOURCES = tftpd.c util.c util.h $(useful) tftp.h
-tftpd_LDADD = @TEST_SERVER_LIBS@
+# Makefile.inc provides the source defines (noinst_PROGRAMS, useful, *_SOURCES, and *_LDADD)
+include Makefile.inc
extra_DIST = base64.pl
-
diff --git a/tests/server/Makefile.inc b/tests/server/Makefile.inc
new file mode 100644
index 000000000..b4394f9e8
--- /dev/null
+++ b/tests/server/Makefile.inc
@@ -0,0 +1,22 @@
+noinst_PROGRAMS = sws getpart sockfilt resolve tftpd
+
+useful = getpart.c getpart.h $(top_srcdir)/lib/strequal.c \
+ $(top_srcdir)/lib/base64.c $(top_srcdir)/lib/mprintf.c \
+ $(top_srcdir)/lib/memdebug.c $(top_srcdir)/lib/timeval.c
+
+resolve_SOURCES= resolve.c util.c util.h $(useful)
+resolve_LDADD = @TEST_SERVER_LIBS@
+
+sws_SOURCES= sws.c util.c util.h $(useful)
+sws_LDADD = @TEST_SERVER_LIBS@
+
+sockfilt_SOURCES = sockfilt.c util.c util.h $(useful) \
+ $(top_srcdir)/lib/inet_pton.c
+sockfilt_LDADD = @TEST_SERVER_LIBS@
+
+getpart_SOURCES= testpart.c $(useful)
+# This is needed because of (unused) network debugging functions in memdebug.c
+getpart_LDADD = @TEST_SERVER_LIBS@
+
+tftpd_SOURCES = tftpd.c util.c util.h $(useful) tftp.h
+tftpd_LDADD = @TEST_SERVER_LIBS@