tests: drop test_config.h

This header provides a single define: GDTEST_TOP_DIR.  Move it to the
build CPPFLAGS instead since it's a path var and that's the recommended
way of handling these (by autotools standards), and it simplifies the
build overall.  It also harmonizes the autotool & cmake build paths.

We localize this define to the gdtest/ subdir as we don't want any of
the other tests using the path.  We have gdtest helpers instead.
master
Mike Frysinger 2016-07-21 20:25:29 +05:30
parent b0333689ef
commit 7d04b45481
10 changed files with 4 additions and 22 deletions

View File

@ -333,7 +333,6 @@ AC_MSG_RESULT([
AC_CONFIG_FILES([Makefile
src/Makefile
tests/Makefile
tests/test_config.h
config/Makefile
config/gdlib-config
config/gdlib.pc])

2
tests/.gitignore vendored
View File

@ -1,4 +1,2 @@
*.log
*.trs
/test_config.h

View File

@ -4,6 +4,7 @@ libgdtest_a_SOURCES = \
gdtest/gdtest.c \
gdtest/gdtest.h \
gdhelpers.c
libgdtest_a_CPPFLAGS = $(AM_CPPFLAGS) -DGDTEST_TOP_DIR='"$(srcdir)"'
# Setup vars that subdirs will increment.
libgd_test_programs =
@ -63,7 +64,7 @@ include xbm/Makemodule.am
include xpm/Makemodule.am
LDADD = libgdtest.a ../src/libgd.la
AM_CPPFLAGS = -I$(top_srcdir)/src -I $(top_srcdir)/tests/gdtest
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/tests/gdtest
check_PROGRAMS = $(libgd_test_programs) $(libgd_helper_programs)
TESTS += $(libgd_test_programs)

View File

@ -4,7 +4,6 @@
#include "gd.h"
#include "gdtest.h"
#include "test_config.h"
#define WIDTH 60
#define HEIGHT 50

View File

@ -1,4 +1,3 @@
SET(GDTEST_TOP_DIR "${GD_SOURCE_DIR}/tests")
CONFIGURE_FILE(test_config.h.cmake test_config.h ESCAPE_QUOTES)
add_definitions(-DGDTEST_TOP_DIR="${CMAKE_CURRENT_SOURCE_DIR}/..")
add_library (gdTest STATIC gdtest.c)
target_link_libraries(gdTest ${GD_LIB})

View File

@ -1,5 +1,4 @@
# Note: Library is declared in tests/Makefile.am as it's used by all the tests.
EXTRA_DIST += \
gdtest/CMakeLists.txt \
gdtest/test_config.h.cmake
gdtest/CMakeLists.txt

View File

@ -27,7 +27,6 @@
#include "gd.h"
#include "gdtest.h"
#include "test_config.h"
/* max is already defined in windows/msvc */
#ifndef max

View File

@ -2,7 +2,6 @@
#define GD_TEST_H
#include <stdarg.h>
#include "test_config.h"
typedef struct CuTestImageResult CuTestImageResult;
struct CuTestImageResult {

View File

@ -1,4 +0,0 @@
/* Define the full path to the top src dir, required to get the path
* of each input data */
#cmakedefine GDTEST_TOP_DIR "@GDTEST_TOP_DIR@"

View File

@ -1,7 +0,0 @@
#ifndef GD_TEST_CONFIG_H
#define GD_TEST_CONFIG_H
/* Define the full path to the top src dir, required to get the path
* of each input data */
#define GDTEST_TOP_DIR "@srcdir@"
#endif