summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Jones <nathanael.jones@gmail.com>2014-09-05 13:13:08 -0400
committerNathanael Jones <nathanael.jones@gmail.com>2014-09-05 13:13:08 -0400
commit42e5fa7622b1d376996155439d5d806458514cc1 (patch)
treef6f0bae749b7edcb0e31581e5d6857aaf6976a9f
parente30293d9be37dc85ef4ea345d3669282505bbc89 (diff)
parent235c5b09c8ab6de29764d82f69440b1facae6fa6 (diff)
downloadlibgd-42e5fa7622b1d376996155439d5d806458514cc1.tar.gz
Merge remote-tracking branch 'origin/master'
-rw-r--r--.gitignore4
-rw-r--r--tests/gdtest/gdtest.c8
-rw-r--r--windows/Makefile.vc96
-rw-r--r--windows/run_tests.bat20
4 files changed, 101 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index f93ba77..914db25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -217,3 +217,7 @@ Makefile.in
# Doc artifacts
/docs/naturaldocs/html/
/docs/naturaldocs/project/Data/
+
+gd-win-dependencies
+build_x86
+build_x64
diff --git a/tests/gdtest/gdtest.c b/tests/gdtest/gdtest.c
index 0f8fa11..606e691 100644
--- a/tests/gdtest/gdtest.c
+++ b/tests/gdtest/gdtest.c
@@ -262,11 +262,11 @@ int _gdTestAssert(const char* file, unsigned int line, const char* message, int
int _gdTestAssertMsg(const char* file, unsigned int line, int condition, const char* message, ...)
{
- if (condition) return 1;
-
- va_list args;
+ va_list args;
char output_buf[GDTEST_STRING_MAX];
-
+
+ if (condition) return 1;
+
va_start(args, message);
vsnprintf(output_buf, sizeof(output_buf), message, args);
va_end(args);
diff --git a/windows/Makefile.vc b/windows/Makefile.vc
index 5107065..d1398ea 100644
--- a/windows/Makefile.vc
+++ b/windows/Makefile.vc
@@ -17,8 +17,11 @@ GD_DLL=libgd.dll
GD_LIB=libgd_a.lib
SDR=$(BUILD_DIR)\obj^\
-OBJECTS=$(SDR)gd.obj $(SDR)gd_color.obj $(SDR)gd_color_map.obj $(SDR)gd_transform.obj $(SDR)gdfx.obj $(SDR)gd_security.obj $(SDR)gd_gd.obj $(SDR)gd_gd2.obj $(SDR)gd_io.obj $(SDR)gd_io_dp.obj $(SDR)gd_gif_in.obj $(SDR)gd_gif_out.obj $(SDR)gd_io_file.obj $(SDR)gd_io_ss.obj $(SDR)gd_jpeg.obj $(SDR)gd_png.obj $(SDR)gd_ss.obj $(SDR)gd_topal.obj $(SDR)gd_wbmp.obj $(SDR)gdcache.obj $(SDR)gdfontg.obj $(SDR)gdfontl.obj $(SDR)gdfontmb.obj $(SDR)gdfonts.obj $(SDR)gdfontt.obj $(SDR)gdft.obj $(SDR)gdhelpers.obj $(SDR)gdkanji.obj $(SDR)gdtables.obj $(SDR)gdxpm.obj $(SDR)wbmp.obj $(SDR)gd_filter.obj $(SDR)gd_nnquant.obj $(SDR)gd_rotate.obj $(SDR)gd_matrix.obj $(SDR)gd_interpolation.obj $(SDR)gd_crop.obj $(SDR)webpimg.obj $(SDR)gd_webp.obj $(SDR)gd_tiff.obj $(SDR)gd_tga.obj $(SDR)gd_bmp.obj $(SDR)gd_xbm.obj $(SDR)gd_color_match.obj $(SDR)gd_version.obj $(SDR)gd_filename.obj
+TDR=$(BUILD_DIR)\tests^\
+TARGETDLL=$(BUILD_DIR)\$(GD_DLL)
+TARGETLIB=$(BUILD_DIR)\$(GD_LIB)
+OBJECTS=$(SDR)gd.obj $(SDR)gd_color.obj $(SDR)gd_color_map.obj $(SDR)gd_transform.obj $(SDR)gdfx.obj $(SDR)gd_security.obj $(SDR)gd_gd.obj $(SDR)gd_gd2.obj $(SDR)gd_io.obj $(SDR)gd_io_dp.obj $(SDR)gd_gif_in.obj $(SDR)gd_gif_out.obj $(SDR)gd_io_file.obj $(SDR)gd_io_ss.obj $(SDR)gd_jpeg.obj $(SDR)gd_png.obj $(SDR)gd_ss.obj $(SDR)gd_topal.obj $(SDR)gd_wbmp.obj $(SDR)gdcache.obj $(SDR)gdfontg.obj $(SDR)gdfontl.obj $(SDR)gdfontmb.obj $(SDR)gdfonts.obj $(SDR)gdfontt.obj $(SDR)gdft.obj $(SDR)gdhelpers.obj $(SDR)gdkanji.obj $(SDR)gdtables.obj $(SDR)gdxpm.obj $(SDR)wbmp.obj $(SDR)gd_filter.obj $(SDR)gd_nnquant.obj $(SDR)gd_rotate.obj $(SDR)gd_matrix.obj $(SDR)gd_interpolation.obj $(SDR)gd_crop.obj $(SDR)webpimg.obj $(SDR)gd_webp.obj $(SDR)gd_tiff.obj $(SDR)gd_tga.obj $(SDR)gd_bmp.obj $(SDR)gd_xbm.obj $(SDR)gd_color_match.obj $(SDR)gd_version.obj $(SDR)gd_filename.obj
TESTS=bmp\bmp_im2im bmp\bmp_null freetype\bug00132 gd\gd_im2im gd\gd_null gd\gd_num_colors gd\gd_versiontest gd2\gd2_empty_file gd2\gd2_im2im gd2\gd2_null gd2\gd2_read gdimagearc\bug00079 gdimagecolorclosest\gdimagecolorclosest gdimagecolordeallocate\gdimagecolordeallocate gdimagecolorexact\gdimagecolorexact gdimagecolorreplace\gdimagecolorreplace gdimagecolorresolve\gdimagecolorresolve gdimagecolortransparent\gdimagecolortransparent gdimagecopy\bug00007 gdimagecopy\bug00081 gdimagecopyrotated\bug00020 gdimagefile\gdnametest gdimagefill\bug00002_1 gdimagefill\bug00002_2 gdimagefill\bug00002_3 gdimagefill\bug00002_4 gdimagefilledellipse\bug00010 gdimagefilledellipse\bug00191 gdimagefilledpolygon\bug00100 gdimagefilledpolygon\gdimagefilledpolygon0 gdimagefilledpolygon\gdimagefilledpolygon1 gdimagefilledpolygon\gdimagefilledpolygon2 gdimagefilledpolygon\gdimagefilledpolygon3 gdimagefilledrectangle\bug00004 gdimagefilledrectangle\bug00078 gdimagefilledrectangle\bug00106_gdimagefilledrectangle gdimagefilltoborder\bug00037 gdimagefilter\gdCopyBlurred gdimageline\bug00072 gdimageline\bug00077 gdimageline\bug00111 gdimageline\gdImageAALine_thickness gdimageline\gdimageline_aa gdimageline\gdimageline_aa_outofrange gdimageline\gdimageline_bug5 gdimageopenpolygon\gdimageopenpolygon0 gdimageopenpolygon\gdimageopenpolygon1 gdimageopenpolygon\gdimageopenpolygon2 gdimageopenpolygon\gdimageopenpolygon3 gdimagepixelate\gdimagepixelate gdimagepolygon\gdimagepolygon0 gdimagepolygon\gdimagepolygon1 gdimagepolygon\gdimagepolygon2 gdimagepolygon\gdimagepolygon3 gdimagerectangle\bug00003 gdimagerectangle\bug00106_gdimagerectangle gdimagerotate\bug00067 gdimagerotate\php_bug_64898 gdimagescatterex\bug00208_1 gdimagescatterex\bug00208_2 gdimagesetpixel\bug00186 gdimagesetpixel\gdeffectmultiply gdimagesetpixel\gdeffectoverlay gdimagestringft\gdimagestringft_bbox gdimagestringftex\gdimagestringftex_returnfontpathname gdinterpolatedscale\gdModesAndPalettes gdinterpolatedscale\gdTrivialResize gdnewfilectx\gdnewfilectx_null gdtiled\bug00032 gif\bug00005 gif\bug00005_2 gif\bug00006 gif\bug00060 gif\bug00066 gif\bug00181 gif\bug00227 gif\gif_im2im gif\gif_null jpeg\jpeg_empty_file jpeg\jpeg_im2im jpeg\jpeg_null jpeg\jpeg_read jpeg\jpeg_resolution png\bug00011 png\bug00033 png\bug00086 png\bug00088 png\bug00193 png\png_im2im png\png_null png\png_resolution tga\tga_null
#tiff\tiff_im2im tiff\tiff_null wbmp\wbmp_im2im wbmp\wbmp_null xpm\bug00166 xpm\bug00185 xpm\color_name
@@ -79,39 +82,96 @@ CFLAGS=/nologo /O2 /Qvec-report:1 /MD /TC\
# HAVE_GD_BUNDLED
# NDEBUG
+
+
+
+
TEST_CFLAGS=$(CFLAGS) /FItest_config.h
TEST_LDFLAGS=$(LDFLAGS) $(SDR)gdtest.obj $(BUILD_DIR)\libgd.lib
+TEST_CONFIG=tests\test_config.h
+TEST_LIST=$(TDR)testlist.txt
+TEST_MK=$(TDR)Maketests.vc
+# generate test makefile from TESTS macro
-build_libs: $(GD_DLL) $(GD_LIB)
+!IF [mkdir $(BUILD_DIR)]
+!ENDIF
+!IF [mkdir $(TDR)]
+!ENDIF
+!IF [@copy NUL $(TEST_MK)]
+!ENDIF
+!IF [@for %F in ($(TESTS)) do @echo TEST_EXES=$(TDR)%~nF.exe ^$(TEST_EXES) >> $(TEST_MK)]
+!ENDIF
+!IF [@for %F in ($(TESTS)) do @echo $(SDR)%~nF.obj: tests\%F.c; @^$(CC) ^$(TEST_CFLAGS) /c ^$** /Fo:^$@ >> $(TEST_MK)]
+!ENDIF
+!IF [@for %F in ($(TESTS)) do @echo $(TDR)%~nF.exe: $(SDR)%~nF.obj; @$(LD) $(TEST_LDFLAGS) ^$** /out:^$@ >> $(TEST_MK)]
+!ENDIF
+TEST_OBJS=$(TEST_EXES:tests=obj)
+TEST_OBJS=$(TEST_OBJS:exe=obj)
+
+
+
+
+
+
+# pseudotargets
+
+build_libs: make_dirs $(TARGETDLL) $(TARGETLIB)
all: build_libs build_tests
check: all run_tests
+clean:
+ @if exist $(SDR) rd $(SDR) /s /q
+ @if exist $(TDR) rd $(TDR) /s /q
+ @if exist $(BUILD_DIR)\*.exe del $(BUILD_DIR)\*.exe /q
+ @if exist tests\test_config.h del tests\test_config.h /q
+
+
+
+
+# helpers
+
make_dirs:
@if not exist $(BUILD_DIR) mkdir $(BUILD_DIR)
@if not exist $(SDR) mkdir $(SDR)
-configure_tests:
- @echo #define GDTEST_TOP_DIR "$(MAKEDIR:\=\\)\\tests" > tests\test_config.h
- @echo #define snprintf _snprintf >> tests\test_config.h
- @copy NUL test\testlist.txt
- @for %%F in ($(TESTS)) do @echo %%F >> test\testlist.txt
-
run_tests:
@windows\run_tests
-$(GD_DLL): build_obj
- @$(LD) /DLL /OUT:$(BUILD_DIR)\$@ $(OBJECTS) $(LIBS_GD) $(LIBS) $(LDFLAGS)
-$(GD_LIB): build_obj
- @$(LB) /OUT:$(BUILD_DIR)\$@ $(OBJECTS) $(LDFLAGS)
-build_obj: make_dirs
- @for %%F in ($(OBJECTS)) do @$(CC) $(CFLAGS) /c src\%%~nF.c /Fo%%F
-build_tests: $(GD_DLL) configure_tests
- @$(CC) $(CFLAGS) $(BASE_INCLUDES) /c tests\gdtest\gdtest.c /Fo$(SDR)gdtest.obj
- @for %%F in ($(TESTS)) do @$(CC) $(TEST_CFLAGS) /c tests\%%F.c /Fo$(SDR)%%~nF.obj
- @for %%F in ($(TESTS)) do @$(LD) $(TEST_LDFLAGS) $(SDR)%%~nF.obj /out:$(BUILD_DIR)\%%~nF.exe \ No newline at end of file
+# libgd
+
+$(TARGETDLL): $(OBJECTS)
+ @$(LD) /DLL /OUT:$@ $(OBJECTS) $(LIBS_GD) $(LIBS) $(LDFLAGS)
+
+$(TARGETLIB): $(OBJECTS)
+ @$(LB) /OUT:$@ $(OBJECTS) $(LDFLAGS)
+
+{src\}.c{$(SDR)}.obj::
+ @$(CC) $(CFLAGS) /c $< /Fo$(SDR)
+
+
+
+
+# tests
+
+!INCLUDE $(TEST_MK)
+
+build_tests: $(TEST_LIST) $(SDR)gdtest.obj $(TEST_EXES)
+
+$(SDR)gdtest.obj: $(TARGETDLL) $(TEST_CONFIG)
+ @$(CC) $(CFLAGS) /c tests\gdtest\gdtest.c /Fo$(SDR)gdtest.obj
+
+$(TEST_CONFIG):
+ @echo #define GDTEST_TOP_DIR "$(MAKEDIR:\=\\)\\tests" > tests\test_config.h
+ @echo #define snprintf _snprintf >> tests\test_config.h
+
+$(TEST_LIST): $(TARGETDLL)
+ @if not exist $(TDR) mkdir $(TDR)
+ @copy $(TARGETDLL) $(TDR)$(GD_DLL)
+ @copy NUL $(TDR)testlist.txt
+ @for %%F in ($(TESTS)) do @echo %%F >> $(TDR)testlist.txt \ No newline at end of file
diff --git a/windows/run_tests.bat b/windows/run_tests.bat
index ce81222..52600bb 100644
--- a/windows/run_tests.bat
+++ b/windows/run_tests.bat
@@ -1,23 +1,33 @@
@echo off
setlocal EnableDelayedExpansion
+if [%PLATFORM%]==[] set PLATFORM=86
-if exist test (cd test) else (
- if exist ..\test (cd ..\test) else (
+if exist build_x%PLATFORM%\tests (cd build_x%PLATFORM%\tests) else (
+ if exist ..\build_x%PLATFORM%\tests (cd ..\build_x%PLATFORM%\tests) else (
echo unable to find test dir
exit /b 1
)
)
-if "%PLATFORM%"=="" set PLATFORM=86
+
for /f %%T in (testlist.txt) do (
set test=%%T
set output=test: !test!....................................................................
- set target=..\build_x%PLATFORM%\%%~nT.exe
+ set target=%%~nT.exe
+ if not exist !target! SET result=NotFound
call !target! && (SET result=Passed) || (SET result=Failed)
- echo !output:~0,73!!result!
+ rem > last_test.out 2> last_test.err
+ rem set /p testerr=<last_test.err
+ rem set /p testout=<last_test.out
+
+ echo !output:~0,70!!result!
+
+ rem if defined testerr echo error: !testerr!
+ rem if defined testout echo msg: !testout!
+
if defined APPVEYOR (
appveyor AddTest "!test! x%PLATFORM%" -Outcome !result! -Framework Custom -Filename %%~nT.exe -Duration 0
)