diff options
| author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-13 20:35:26 -0700 | 
|---|---|---|
| committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-13 20:35:26 -0700 | 
| commit | ed2c8226434a0b98562dbec16a3c6a1f2d282faa (patch) | |
| tree | 2f4ddfce3c27e5c5b58be550d9db35742fe864c6 | |
| parent | 054b0b447eff82327c37a617849c3e20fbbb9789 (diff) | |
| parent | 1c4098a7d9a5eb067ff63b5602d60d91a218b4a0 (diff) | |
Merge branch 'master' into compact
| -rw-r--r-- | Jamfile.jam | 169 | ||||
| -rw-r--r-- | Jamrules.jam | 1032 | ||||
| -rw-r--r-- | appveyor.yml | 4 | ||||
| -rw-r--r-- | scripts/CMakeLists.txt | 19 | ||||
| -rw-r--r-- | tests/autotest-appveyor.ps1 | 71 | ||||
| -rw-r--r-- | tests/autotest-freebsd.sh | 10 | ||||
| -rw-r--r-- | tests/autotest-linux.sh | 14 | ||||
| -rw-r--r-- | tests/autotest-local.pl | 150 | ||||
| -rw-r--r-- | tests/autotest-macos.sh | 12 | ||||
| -rw-r--r-- | tests/autotest-remote-host.pl | 37 | ||||
| -rw-r--r-- | tests/autotest-remote-server.pl | 33 | ||||
| -rw-r--r-- | tests/autotest-report.pl | 229 | ||||
| -rw-r--r-- | tests/autotest-solaris.sh | 10 | ||||
| -rw-r--r-- | tests/gcov-filter.pl | 36 | 
14 files changed, 91 insertions, 1735 deletions
| diff --git a/Jamfile.jam b/Jamfile.jam deleted file mode 100644 index e140f35..0000000 --- a/Jamfile.jam +++ /dev/null @@ -1,169 +0,0 @@ -# Latest jamplus is needed to use this - -# Targets: -# pugixml - build pugixml library -# tests - build pugixml test suite -# run_tests - run pugixml test suite -# coverage - get test suite coverage - -# Options: -# toolset=name - select toolset -# 	supported toolsets: mingw*, msvc* - -# default toolset/configuration -if ( ! $(toolset) ) -{ -	if ( $(OS) = SOLARIS ) -	{ -		toolset = suncc ; -	} -	else if ( $(UNIX) ) -	{ -		local GCCVERSION = [ Subst [ Shell "gcc -dumpversion" ] : $(NEWLINE) ] ; -		toolset = "gcc"$(GCCVERSION) ; -	} -	else -	{ -		toolset = msvc ; -	} -} - -if ( ! $(configuration) ) -{ -	configuration = "debug" ; -} - -if ( ! $(defines) ) -{ -	defines = "PUGIXML_STANDARD" ; -} - -# coverage options -if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) ) -{ -	CCFLAGS = -fprofile-arcs -ftest-coverage ; -	LDFLAGS = -fprofile-arcs ; - -	if $(fullcoverage) -	{ -		GCOVFLAGS = --branch-probabilities --function-summaries ; -	} -	else -	{ -		GCOVFLAGS = --no-output ; -	} -} - -# build folder -BUILD = build ; - -# enable dependency cache -DEPCACHE.standard = $(BUILD)/.depcache ; - -# rules -include "Jamrules.jam" ; - -# split define sets into list -local DEFINESETS = [ Split $(defines) : ':' ] ; - -# split configurations into list -local CONFIGURATIONS = [ Split $(configuration) : ',' ] ; - -for CONFIG in $(CONFIGURATIONS) -{ -	for DEFINESET in $(DEFINESETS) -	{ -		local DEFINES = [ Split $(DEFINESET) : ',' ] ; - -		# build folder -		local CFGBUILD = $(BUILD)/$(toolset)/$(DEFINES:J=_)/$(CONFIG) ; - -		# compilation options -		local CFGFLAGS = $(CCFLAGS) [ GetCFlags $(CONFIG) : $(DEFINES) ] ; - -		# build library -		local PUGIXML = $(CFGBUILD)/pugixml.lib ; -		Library $(PUGIXML) : src/pugixml.cpp : $(CFGFLAGS) ; -		Alias pugixml : $(PUGIXML) ; - -		# build tests -		local TESTS = $(CFGBUILD)/tests.exe ; -		local TEST_SOURCES = [ Glob tests : *.cpp ] ; -		TEST_SOURCES -= [ Glob tests : fuzz_*.cpp ] ; -		Application $(TESTS) : $(TEST_SOURCES) : $(CFGFLAGS) : $(PUGIXML) ; -		Alias tests : $(TESTS) ; - -		# run tests -		Test $(TESTS)_run : $(TESTS) ; -		Alias run_tests : $(TESTS)_run ; - -		# gather coverage -		Coverage $(TESTS)_coverage : $(PUGIXML) ; -		Alias coverage : $(TESTS)_coverage ; - -		GCOVFLAGS on $(TESTS)_coverage = $(GCOVFLAGS) -o $(CFGBUILD)/src ; # because stupid gcov can't find files via relative paths - -		# add special autotest markers to build log -		if $(autotest) -		{ -			COVPREFIX on $(TESTS)_coverage = "... autotest $(CONFIG) [$(DEFINESET)]" ; -		} - -		# gather coverage after tests run -		Depends $(TESTS)_coverage : $(TESTS)_run ; -	} -} - -# documentation -Documentation docs/manual.html : docs/manual.qbk : docs/manual.xsl ; -Documentation docs/quickstart.html : docs/quickstart.qbk : docs/quickstart.xsl ; - -Alias docs : docs/manual.html docs/quickstart.html ; - -# samples -for SAMPLE in [ Glob docs/samples : *.cpp ] -{ -	local CONFIG = "debug" ; -	local DEFINES = "PUGIXML_STANDARD" ; - -	# build folder -	local CFGBUILD = $(BUILD)/$(toolset)/$(DEFINES:J=_)/$(CONFIG) ; - -	# compilation options -	local CFGFLAGS = $(CCFLAGS) [ GetCFlags $(CONFIG) : $(DEFINES) ] ; -	CFGFLAGS += -I src ; - -	# build and run sample -	local EXECUTABLE = $(CFGBUILD)/samples/$(SAMPLE:B).exe ; -	local PUGIXML = $(CFGBUILD)/pugixml.lib ; - -	Application $(EXECUTABLE) : $(SAMPLE) : $(CFGFLAGS) : $(PUGIXML) ; - -	RunSampleAction $(EXECUTABLE)_run : $(EXECUTABLE) ; -	Depends $(EXECUTABLE)_run : $(EXECUTABLE) ; - -	Depends samples : $(EXECUTABLE)_run ; -} - -# release -VERSION = 1.6 ; -RELEASE_FILES =  -	[ Glob contrib : *.cpp *.hpp ]  -	[ Glob src : *.cpp *.hpp ]  -	[ Glob docs : *.html *.css ] -	[ Glob docs/samples : *.cpp *.hpp *.xml ]  -	[ Glob docs/images : *.png ] -	[ Glob docs/manual : *.html ] -	@("scripts/**":W=:X=svn) -	readme.txt -	; - -actions ArchiveAction -{ -	perl tests/archive.pl $(<) $(>) -} - -ArchiveAction pugixml-$(VERSION).zip : $(RELEASE_FILES) ; -ArchiveAction pugixml-$(VERSION).tar.gz : $(RELEASE_FILES) ; -Depends release : pugixml-$(VERSION).zip pugixml-$(VERSION).tar.gz : $(RELEASE_FILES) ; -NotFile release ; diff --git a/Jamrules.jam b/Jamrules.jam deleted file mode 100644 index c1647cb..0000000 --- a/Jamrules.jam +++ /dev/null @@ -1,1032 +0,0 @@ -# Rules for Jamfile.jam - -if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) || $(toolset:I=^bada) || $(toolset:I=^android) || $(toolset:I=^blackberry) ) -{ -	if ( $(toolset:I=^gcc) ) -	{ -		GCCPATH = "" ; -	} -    else if ( $(toolset:I=^android) ) -    { -		GCCPATH = "%$(toolset)_PATH%\\toolchains\\arm-linux-androideabi-4.4.3\\prebuilt\\windows\\bin\\arm-linux-androideabi-" ; -    } -    else if ( $(toolset:I=^bada) ) -    { -		GCCPATH = "%$(toolset)_PATH%\\Tools\\Toolchains\\ARM\\bin\\arm-bada-eabi-" ; -    } -    else if ( $(toolset:I=^blackberry) ) -    { -		GCCPATH = "%$(toolset)_PATH%\\host\\win32\\x86\\usr\\bin\\ntoarmv7-" ; -    } -	else -	{ -		GCCPATH = "%$(toolset)_PATH%\\bin\\" ; -    } - -	if ( $(OS) != MACOSX ) -	{ -		ARCH = "" ; - -        if ( $(toolset:I=^bada) ) -        { -            LDFLAGS += -lstdc++ -lsupc++-xnew -lc ; -        } -        else if ( $(toolset:I=^android) ) -        { -            LDFLAGS += -nostdlib ; -            LDFLAGS += -L"%$(toolset)_PATH%\\platforms\\android-5\\arch-arm\\usr\\lib" ; - -            if ( $(toolset:I=stlport) ) -            { -                LDFLAGS += -L"%$(toolset)_PATH%\\sources\\cxx-stl\\stlport\\libs\\armeabi-v7a" ; -                LDFLAGS += -lstlport_static ; -            } -            else -            { -                LDFLAGS += -L"%$(toolset)_PATH%\\sources\\cxx-stl\\gnu-libstdc++\\libs\\armeabi-v7a" ; -                LDFLAGS += -lgnustl_static -lsupc++ ; -            } - -            LDFLAGS += "%$(toolset)_PATH%\\platforms\\android-5\\arch-arm\\usr\\lib\\crtbegin_dynamic.o" ; -            LDFLAGS += -lstdc++ -lc -lm -lgcc ; -        } -        else if ( $(OS) = NT || $(OS) = FREEBSD ) -        { -            LDFLAGS += -static-libgcc -static ; -        } -	} -	else -	{ -		if ( $(toolset:I=_x64) ) -		{ -			ARCH = -arch x86_64 ; -		} -		else if ( $(toolset:I=_ppc) ) -		{ -			ARCH = -arch ppc ; -		} - -		LDFLAGS += $(ARCH) ; -	} - -    GCCVERSION = [ Shell "$(GCCPATH)gcc -dumpversion" ] ; - -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = -D$(DEFINES) ; - -		RESULT += -W -Wall -Wextra -pedantic -Werror ; -        RESULT += -Wabi -Wno-non-template-friend -Wcast-qual -Wcast-align ; -        RESULT += -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo -Wformat=2 -Winit-self ; -        RESULT += -Wunused -Wstrict-aliasing=2 -Wundef -Wshadow -Wredundant-decls ; - -        # gcc 4.0 has some warning regressions -        if ( ! $(GCCVERSION:I=4\.0) ) -        { -            RESULT += -Wold-style-cast ; # gives warnings for fpclassify() on gcc 4.0.1 -            RESULT += -Wswitch-default ; # gives false-positives for couple of switches on template argument on gcc 4.0.1 -            RESULT += -Wctor-dtor-privacy ; # gives false-positives for structs on gcc 4.0.1 -        } - -        # these warnings are supported on newer GCC versions only -        if ( $(GCCVERSION) >= "4.4.0" ) -        { -            RESULT += -Wstrict-null-sentinel -Wlogical-op -Wmissing-declarations ; -        } - -		if ( $(toolset:I=_0x) ) -		{ -			RESULT += -std=c++0x ; -		} - -		if ( $(fulldebug) ) -		{ -			RESULT += -g ; -		} - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += -D_DEBUG ; -		} -		else -		{ -			RESULT += -DNDEBUG -O3 ; -		} - -		if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) -		{ -			RESULT += -fno-exceptions ; -		} - -        if ( $(toolset:I=^android) ) -        { -            RESULT += -DANDROID ; -            RESULT += -mfloat-abi=softfp ; - -            if ( $(toolset:I=stlport) ) -            { -                RESULT += -isystem"%$(toolset)_path%/sources/cxx-stl/stlport/stlport" ; -                RESULT += -isystem"%$(toolset)_path%/sources/cxx-stl/system/include" ; -            } -            else -            { -                RESULT += -isystem"%$(toolset)_path%/sources/cxx-stl/gnu-libstdc++/include" ; -                RESULT += -isystem"%$(toolset)_path%/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include" ; -            } - -            RESULT += -isystem"%$(toolset)_path%/platforms/android-5/arch-arm/usr/include" ; -        } - -		RESULT += $(ARCH) ; - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		"$(GCCPATH)gcc" -c $(>) -o $(<) $(CCFLAGS) -	} -	 -	actions LibraryAction -	{ -		"$(GCCPATH)ar" rcs $(<) $(>) -	} -	 -	actions LinkAction -	{ -		"$(GCCPATH)g++" $(>) -o $(<) $(LDFLAGS)  -	} -} -else if ( $(toolset:I=^msvc) ) -{ -	if ( $(fulldebug) ) -	{ -		LDFLAGS += /DEBUG ; -	} - -    if ( $(toolset:I=_wince) ) -    { -        postfix = "\\x86_arm" ; -         -        LDFLAGS += /SUBSYSTEM:WINDOWSCE ; -        LDFLAGS += coredll.lib corelibc.lib ccrtrtti.lib ; -        LDFLAGS += "/LIBPATH:\"%$(toolset)_PATH%\\lib\\armv4\"" ; -        LDFLAGS += "/LIBPATH:\"%WINCESDK_PATH%\\lib\\armv4\"" ; -    } -    else -    { -        local sdk_postfix ; - -        if ( $(toolset:I=x64$) ) -        { -            postfix = "\\amd64" ; -            lib_postfix = "\\amd64" ; -            sdk_postfix = "\\x64" ; -            kits_postfix = "\\x64" ; -            LDFLAGS += /MACHINE:X64 ; -        } -        else if ( $(toolset:I=arm$) ) -        { -            postfix = "\\x86_arm" ; -            lib_postfix = "\\arm" ; -            sdk_postfix = "\\arm" ; -            kits_postfix = "\\arm" ; -            LDFLAGS += /MACHINE:ARM ; -        } -        else -        { -            postfix = "" ; -            lib_postfix = "" ; -            sdk_postfix = "" ; -            kits_postfix = "\\x86" ; -        } -         -        LDFLAGS += "/LIBPATH:\"%$(toolset)_PATH%\\lib$(lib_postfix)\"" ; - -        if ( $(toolset:I=msvc(6|7)) ) -        { -            LDFLAGS += "/LIBPATH:\"%$(toolset)_PATH%\\PlatformSDK\\lib$(lib_postfix)\"" ; -        } -        else if ( $(toolset:I=msvc(8|9|10)) ) -        { -            LDFLAGS += "/LIBPATH:\"%WINSDK_PATH%\\lib$(sdk_postfix)\"" ; -        } -        else -        { -            LDFLAGS += "/LIBPATH:\"%WINKITS_PATH%\\lib\\win8\\um$(kits_postfix)\"" ; -            LDFLAGS += "/LIBPATH:\"%WINKITS_PATH%\\lib\\winv6.3\\um$(kits_postfix)\"" ; -        } -    } - -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = /D$(DEFINES) ; - -		if ( $(fulldebug) ) -		{ -			RESULT += /Z7 ; -		} - -        local RUNTIME = "MT" ; - -        if ( $(toolset:I=_clr) ) -        { -            RUNTIME = "MD" ; -        } - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += /D_DEBUG /$(RUNTIME)d ; -		} -		else -		{ -			RESULT += /DNDEBUG /Ox /$(RUNTIME) ; -		} - -		if ( $(toolset) = msvc7 || $(toolset) = msvc71 || $(toolset) = msvc8 ) -		{ -			RESULT += /Wp64 ; # Wp64 is deprecated from msvc9 -		} - -		if ( $(toolset) != msvc6 ) -		{ -			RESULT += /W4 ; -		} -		else -		{ -			RESULT += /W3 ; # lots of warnings at W4 in standard library -		} - -        if ( $(toolset:I=_clr) ) -        { -            RESULT += /clr ; -        } -        else if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) ) -		{ -			RESULT += /EHsc ; -		} -		else if ( $(toolset) = "msvc6" || $(toolset) = "msvc71" || $(toolset:I=_wince) ) -		{ -			# No no-exception STL in MSVC6, buggy no-exception STL in MSVC71 -            # No proper runtime library variant for no-exception in WinCE (ccrtrtti.lib contains what() & dtor) -			RESULT += /EHsc ; -		} -		else -		{ -			RESULT += /D_HAS_EXCEPTIONS=0 ; -		} - -        if ( $(toolset:I=_wince) ) -        { -            RESULT += /D_WIN32_WCE /DARM ; -            RESULT += "/I\"%$(toolset)_PATH%\\include\"" ; -            RESULT += "/I\"%WINCESDK_PATH%\\Include\"" ; -        } -        else -        { -            RESULT += "/I\"%$(toolset)_PATH%\\include\"" ; - -            if ( $(toolset:I=msvc(6|7)) ) -            { -                RESULT += "/I\"%$(toolset)_PATH%\\PlatformSDK\\include\"" ; -            } -            else if ( $(toolset:I=msvc(8|9|10)) ) -            { -                RESULT += "/I\"%WINSDK_PATH%\\Include\"" ; -            } -            else -            { -                RESULT += "/I\"%WINKITS_PATH%\\include\\shared\"" ; -                RESULT += "/I\"%WINKITS_PATH%\\include\\um\"" ; - -                if ( $(toolset:I=arm$) ) -                { -                    RESULT += /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE ; -                } -            } -        } - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		"%$(toolset)_PATH%\bin$(postfix)\cl.exe" /WX /c $(>) /Fo$(<) /nologo $(CCFLAGS) -	} -	 -	actions LibraryAction -	{ -		"%$(toolset)_PATH%\bin$(postfix)\lib.exe" /NOLOGO /OUT:$(<) $(>) -	} -	 -	actions LinkAction -	{ -		"%$(toolset)_PATH%\bin$(postfix)\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) /PDB:$(<:S=.pdb) $(>) $(LDFLAGS) -	} -} -else if ( $(toolset:I=^ic) ) -{ -    if ( $(OS) = NT ) -    { -        if ( $(toolset) = ic8 || $(toolset) = ic9 ) -        { -            msvc = "msvc71" ; -        } -        else -        { -            msvc = "msvc8" ; -        } - -        if ( $(toolset) = ic11 ) -        { -            postfix = "\\ia32" ; -        } -        else if ( $(toolset) = ic11_x64 ) -        { -            postfix = "\\intel64" ; -        } -        else -        { -            postfix = "" ; -        } - -        if ( $(toolset:I=_x64$) ) -        { -            msvc_postfix = "\\amd64" ; -            LDFLAGS += /MACHINE:X64 ; -        } -        else -        { -            msvc_postfix = "" ; -        } - -        rule GetCFlags CONFIG : DEFINES -        { -            local RESULT = /D$(DEFINES) ; - -            RESULT += /W3 /WX /Qvec_report0 ; - -            if ( $(toolset) != ic8 ) -            { -                RESULT += /fp:precise ; -            } - -            if ( $(CONFIG) = "debug" ) -            { -                RESULT += /D_DEBUG /Od /MTd ; -            } -            else -            { -                RESULT += /DNDEBUG /Ox /MT ; -            } - -            if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) ) -            { -                RESULT += /EHsc ; -            } - -            return $(RESULT) ; -        } - -        actions ObjectAction -        { -            set PATH=%$(msvc)_PATH%\bin -            "%$(toolset)_PATH%\bin$(postfix)\icl.exe" /I"%$(msvc)_PATH%\include" /I"%$(msvc)_PATH%\PlatformSDK\Include" /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS) -        } -         -        actions LibraryAction -        { -            "%$(msvc)_PATH%\bin\lib.exe" /NOLOGO /OUT:$(<) $(>) -        } -         -        actions LinkAction -        { -            "%$(msvc)_PATH%\bin\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(msvc)_PATH%\lib$(msvc_postfix)" /LIBPATH:"%$(msvc)_PATH%\PlatformSDK\lib$(msvc_postfix)" $(LDFLAGS) -        } -    } -    else -    { -        rule GetCFlags CONFIG : DEFINES -        { -            local RESULT = -D$(DEFINES) ; - -            RESULT += -fp-model strict ; - -            RESULT += -Wall -Werror -Wcheck ; -            RESULT += -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-aliasing ; -            RESULT += -Wstrict-prototypes -Wpointer-arith -Wuninitialized -Wdeprecated -Wabi ; -            RESULT += -Wcast-qual -Wunused-function -Wunknown-pragmas -Wmain -Wcomment -Wconversion ; -            RESULT += -Wreturn-type -Wextra-tokens -Wpragma-once -Wshadow -Woverloaded-virtual -Wtrigraphs ; -            RESULT += -Wmultichar -Woverflow -Wwrite-strings -Wsign-compare -Wp64 -Wshorten-64-to-32 ; - -            if ( $(fulldebug) ) -            { -                RESULT += -g ; -            } - -            if ( $(CONFIG) = "debug" ) -            { -                RESULT += -D_DEBUG ; -            } -            else -            { -                RESULT += -DNDEBUG -O3 ; -            } - -            if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) -            { -                RESULT += -fno-exceptions ; -            } - -            return $(RESULT) ; -        } - -        actions ObjectAction -        { -            icc -c $(>) -o $(<) $(CCFLAGS) -        } -         -        actions LibraryAction -        { -            ar rcs $(<) $(>) -        } -         -        actions LinkAction -        { -            icc $(>) -o $(<) $(LDFLAGS) -        } -    } -} -else if ( $(toolset:I=^dmc) ) -{ -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = -D$(DEFINES) ; - -		RESULT += -wx -f ; - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += -D_DEBUG ; -		} -		else -		{ -			RESULT += -DNDEBUG -o ; -		} - -		if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) ) -		{ -			RESULT += -Ae ; -		} - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		"%$(toolset)_PATH%\bin\dmc.exe" -c -I%$(toolset)_PATH%\stlport\stlport $(>) -o$(<) $(CCFLAGS) -	} -	 -	actions LibraryAction -	{ -		"%$(toolset)_PATH%\bin\lib.exe" -c $(<) $(>) -	} -	 -	actions LinkAction -	{ -		"%$(toolset)_PATH%\bin\link.exe" $(>:\\) , $(<:\\) , nul , $(LDFLAGS:\\) -L/co/ma -	} -} -else if ( $(toolset:I=^cw) ) -{ -	cw_bin = "%$(toolset)_PATH%\\Other Metrowerks Tools\\Command Line Tools" ; - -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = -D$(DEFINES) ; - -		RESULT += -cwd include -ansi strict -iso_templates on -msext off -w all,cmdline,iserror,nonotused,nonotinlined,noimplicitconv,nounwanted ; - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += -D_DEBUG ; -		} -		else -		{ -			RESULT += -DNDEBUG -O4 ; -		} - -		if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) -		{ -			RESULT += -Cpp_exceptions off ; -		} - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		"$(cw_bin)\mwcc.exe" -c $(>) -o $(<) $(CCFLAGS) -	} -	 -	actions LibraryAction -	{ -		"$(cw_bin)\mwld.exe" -library -o $(<) $(>) -	} -	 -	actions LinkAction -	{ -		"$(cw_bin)\mwld.exe" -subsystem console -o $(<) $(>) $(LDFLAGS) -	} -} -else if ( $(toolset:I=^bcc) ) -{ -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = -D$(DEFINES) ; - -		RESULT += -fp -w -w! -w-8026 -w-8027 -w-8091 -w-8004 ; - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += -D_DEBUG ; -		} -		else -		{ -			RESULT += -DNDEBUG -Ox ; -		} - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		"%$(toolset)_PATH%\bin\bcc32.exe" $(CCFLAGS) -c -q -Q -o $(<) $(>) -	} -	 -	actions LibraryAction -	{ -		"%$(toolset)_PATH%\bin\tlib.exe" /C $(<:\\) -+$(>:\\) -	} -	 -	actions LinkAction -	{ -		"%$(toolset)_PATH%\bin\ilink32.exe" -L"%$(toolset)_PATH%\lib" -Tpe -ap -Gn -x -c "%$(toolset)_PATH%\lib\c0x32.obj" $(>:\\) , $(<:\\) , , $(LDFLAGS:\\) cw32 import32 -	} -} -else if ( $(toolset:I=^suncc) ) -{ -	if ( $(toolset:I=_x64) ) -	{ -		ARCH = -m64 ; -	} -	else -	{ -		ARCH = -m32 ; -	} - -	LDFLAGS += $(ARCH) ; - -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = -D$(DEFINES) ; - -		RESULT += +w -xwe ; - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += -D_DEBUG ; -		} -		else -		{ -			RESULT += -DNDEBUG -O ; -		} - -		if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) -		{ -			RESULT += -noex ; -		} - -		RESULT += $(ARCH) ; - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		sunCC $(CCFLAGS) -c -o $(<) $(>) -	} - -	actions LibraryAction -	{ -		ar rcs $(<) $(>) -	} - -	actions LinkAction -	{ -		sunCC $(>) -o $(<) $(LDFLAGS)  -	} -} -else if ( $(toolset:I=^xbox360) ) -{ -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = /D$(DEFINES) ; - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += /D_DEBUG /MTd ; -		} -		else -		{ -			RESULT += /DNDEBUG /Ox /MT ; -		} - -		RESULT += /W4 ; - -		if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) ) -		{ -			RESULT += /EHsc ; -		} -		else -		{ -			RESULT += /D_HAS_EXCEPTIONS=0 ; -		} - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		"%XEDK%\bin\win32\cl.exe" /WX /I"%XEDK%\include\xbox" /c $(>) /Fo$(<) /nologo $(CCFLAGS) -	} -	 -	actions LibraryAction -	{ -		"%XEDK%\bin\win32\lib.exe" /NOLOGO /OUT:$(<) $(>) -	} -	 -	actions LinkAction -	{ -		"%XEDK%\bin\win32\link.exe" /NOLOGO /OUT:$(<) /PDB:$(<:S=.pdb) $(>) /LIBPATH:"%XEDK%\lib\xbox" $(LDFLAGS) -	} -} -else if ( $(toolset:I=^ps3_gcc) ) -{ -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = -D$(DEFINES) ; - -		RESULT += -W -Wall -Wextra -Werror ; - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += -D_DEBUG ; -		} -		else -		{ -			RESULT += -DNDEBUG -O3 ; -		} - -		if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) -		{ -			RESULT += -fno-exceptions ; -		} - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		"%SCE_PS3_ROOT%\host-win32\ppu\bin\ppu-lv2-gcc" -c $(>) -o $(<) $(CCFLAGS) -	} -	 -	actions LibraryAction -	{ -		"%SCE_PS3_ROOT%\host-win32\ppu\bin\ppu-lv2-ar" rcs $(<) $(>) -	} -	 -	actions LinkAction -	{ -		"%SCE_PS3_ROOT%\host-win32\ppu\bin\ppu-lv2-g++" $(>) -o $(<) $(LDFLAGS)  -	} -} -else if ( $(toolset:I=^ps3_snc) ) -{ -	rule GetCFlags CONFIG : DEFINES -	{ -		local RESULT = -D$(DEFINES) ; - -		RESULT += -Werror -Xuninitwarn=0 ; - -		if ( $(CONFIG) = "debug" ) -		{ -			RESULT += -D_DEBUG ; -		} -		else -		{ -			RESULT += -DNDEBUG -O3 ; -		} - -		if ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) -		{ -			RESULT += -Xc+=exceptions ; -		} - -		return $(RESULT) ; -	} - -	actions ObjectAction -	{ -		"%SCE_PS3_ROOT%\host-win32\sn\bin\ps3ppusnc" -c $(>) -o $(<) $(CCFLAGS) -	} -	 -	actions LibraryAction -	{ -		"%SCE_PS3_ROOT%\host-win32\sn\bin\ps3snarl" rcs $(<) $(>) -	} -	 -	actions LinkAction -	{ -		"%SCE_PS3_ROOT%\host-win32\sn\bin\ps3ppuld" $(>) -o $(<) $(LDFLAGS)  -	} -} -else -{ -	exit "Unknown toolset $(toolset)!" ; -} - -RUNRESULT = "success" ; -COVSUCCESS = "echo $" "(COVPREFIX) $" "(RUNRESULT)" ; - -if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) ) -{ -	actions maxtargets 1 CoverageAction -	{ -		@($(COVSUCCESS:J=):A) -		"$(GCCPATH)gcov" $(>) $(GCOVFLAGS) | perl tests/gcov-filter.pl $(COVPREFIX)$(SPACE)gcov -	} -} -else -{ -	actions CoverageAction -	{ -		@($(COVSUCCESS:J=):A) -	} -} - -if ( $(UNIX) ) -{ -	actions screenoutput RunAction -	{ -		$(>) -	} - -	actions RunSampleAction -	{ -		cd docs/samples -		../../$(>) -	} - -	actions quietly ignore MakeDirAction -	{ -		mkdir -p $(<) -	} - -	actions quietly ignore DeleteAction -	{ -		rm -f $(>) -	} -} -else -{ -	if ( $(toolset:I=(^xbox360|^ps3|wince$|arm$|^android|^bada|^blackberry)) ) -	{ -        RUNRESULT = "skiprun" ; - -		actions RunAction -		{ -		} - -		actions RunSampleAction -		{ -		} -	} -	else -	{ -		actions screenoutput RunAction -		{ -			$(>:\\) -		} - -		actions RunSampleAction -		{ -			cd docs\samples -			..\..\$(>:\\) -		} -	} - -	actions quietly ignore MakeDirAction -	{ -		mkdir $(<:\\) >nul 2>&1 -	} - -	actions quietly ignore DeleteAction -	{ -		del /F $(>:\\) >nul 2>&1 -	} -} - -if ( $(OS) = NT ) -{ -    QUICKBOOK = %QUICKBOOK_PATH%bin\\quickbook.exe ; -    XSLTPROC = %QUICKBOOK_PATH%bin\\xsltproc.exe ; -} -else -{ -    QUICKBOOK = quickbook ; -    XSLTPROC = xsltproc ; -    QUICKBOOK_PATH = /usr/share ; -} - -actions QuickbookAction -{ -    $(QUICKBOOK) --output-file $(<) --input-file $(>) -} - -actions response XSLTProcAction -{ -	$(XSLTPROC) --nonet --novalid --path$(SPACE)$(XSLPATH:C) --stringparam$(SPACE)$(XSLPARAM) --output $(<) @(<?xml version="1.0"?> -	<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> -	<xsl:import$(SPACE)href="file:///$(XSL:/)"$(SPACE)/> -	</xsl:stylesheet>) $(>) -} - -rule MakeFileDir TARGET -{ -	local DIR = $(TARGET:D) ; - -	MakeDirAction $(DIR) ; -	Needs $(TARGET) : $(DIR) ; -} - -rule Alias TARGET : SOURCE -{ -	NotFile $(TARGET) ; -	Always $(TARGET) ; -	Depends $(TARGET) : $(SOURCE) ; -} - -rule Object TARGET : SOURCE : CCFLAGS -{ -	HDRRULE on $(SOURCE) = C.HdrRule ; -	HDRSCAN on $(SOURCE) = $(C.HDRPATTERN) ; - -	MakeFileDir $(TARGET) ; - -	ObjectAction $(TARGET) : $(SOURCE) ; -	Depends $(TARGET) : $(SOURCE) ; - -	CCFLAGS on $(TARGET) = $(CCFLAGS) ; -	UseCommandLine $(TARGET) : $(CCFLAGS) ; -} - -rule Objects BUILD : SOURCES : CCFLAGS -{ -	local OBJECTS ; - -	for SOURCE in $(SOURCES) -	{ -		local OBJECT = $(BUILD)/$(SOURCE:S=.o) ; - -		Object $(OBJECT) : $(SOURCE) : $(CCFLAGS) ; -		OBJECTS += $(OBJECT) ; -	} - -	return $(OBJECTS) ; -} - -rule Library TARGET : SOURCES : CCFLAGS -{ -	# build object files -	local OBJECTS = [ Objects $(TARGET:D) : $(SOURCES) : $(CCFLAGS) ] ; - -	# build library -	MakeFileDir $(TARGET) ; -	LibraryAction $(TARGET) : $(OBJECTS) ; -	Depends $(TARGET) : $(OBJECTS) ; - -	# remember library objects for coverage -	$(TARGET)_objects = $(OBJECTS) ; -} - -rule Application TARGET : SOURCES : CCFLAGS : LIBRARIES -{ -	# build object files -	local OBJECTS = [ Objects $(TARGET:D) : $(SOURCES) : $(CCFLAGS) ] ; - -	# set libraries -	LDFLAGS on $(TARGET) = $(LDFLAGS) $(LIBRARIES) ; - -	# build application -	MakeFileDir $(TARGET) ; - -	LinkAction $(TARGET) : $(OBJECTS) ; -	Depends $(TARGET) : $(OBJECTS) $(LIBRARIES) ; -	 -	# remember executable objects for coverage -	$(TARGET)_objects = $(OBJECTS) $($(LIBRARIES)_objects) ; -} - -rule CleanCoverage TARGET  -{ -	# make target -	local CLEAN_TARGET = $(TARGET)_clean_coverage ; - -	NotFile $(CLEAN_TARGET) ; -	Always $(CLEAN_TARGET) ; -	Depends $(TARGET) : $(CLEAN_TARGET) ; -	 -	# clean object files -	local FILES = $($(SOURCE)_objects:S=.gcda) ; - -	# disable "independent target" warnings -	NotFile $(FILES) ; - -	DeleteAction $(CLEAN_TARGET) : $(FILES) ; -} - -rule Test TARGET : SOURCE -{ -	# make alias -	Alias $(TARGET) : $(SOURCE) ; - -	# run tests -	RunAction $(TARGET) : $(SOURCE) ; - -	# remember executable objects for coverage -	$(TARGET)_objects = $($(SOURCE)_objects) ; - -	# clean coverage files before run -	CleanCoverage $(TARGET) ; -} - -rule Coverage TARGET : SOURCE -{ -	local FILES = $($(SOURCE)_objects:S=.gcda) ; - -	# disable "independent target" warnings -	NotFile $(FILES) ; - -	CoverageAction $(TARGET) : $(FILES) ; -	Depends $(TARGET) : $(SOURCE) ; -} - -rule QuickbookImport SOURCE : IMPORT -{ -	Includes $(SOURCE) : $(SOURCE:D)/$(IMPORT) ; -} - -rule Documentation TARGET : SOURCE : STYLESHEET -{ -	# escape colon with %3A because colon is a path list separator -	local XSLDIR = [ Subst $(QUICKBOOK_PATH) : ":" : "%%%%3A" ] ; - -	# quickbook import scan -	HDRRULE on $(SOURCE) = QuickbookImport ; -	HDRSCAN on $(SOURCE) = "\\[import[ 	]+([^]]*)\\]" ; - -	# quickbook -> boostbook -	local BOOSTBOOK = $(BUILD)/$(SOURCE:S=.bb.xml) ; - -	MakeFileDir $(BOOSTBOOK) ; -	QuickbookAction $(BOOSTBOOK) : $(SOURCE) ; -	Depends $(BOOSTBOOK) : $(SOURCE) ; - -	# boostbook -> docbook -	local DOCBOOK = $(BUILD)/$(SOURCE:S=.db.xml) ; - -	XSL on $(DOCBOOK) = $(QUICKBOOK_PATH)/boostbook/xsl/docbook.xsl ; -	XSLPATH on $(DOCBOOK) = $(XSLDIR)/boostbook/dtd $(XSLDIR)/docbook-xml ; -	XSLTProcAction $(DOCBOOK) : $(BOOSTBOOK) ; -	Depends $(DOCBOOK) : $(BOOSTBOOK) ; - -	# docbook -> html -	local HTML = $(TARGET) ; - -	XSL on $(HTML) = $(QUICKBOOK_PATH)/boostbook/xsl/html.xsl $(CWD)/$(STYLESHEET) ; -	XSLPATH on $(HTML) = $(XSLDIR)/docbook-xml $(XSLDIR)/docbook-xsl/html $(XSLDIR)/docbook-xsl/lib ; - -	XSLPARAM on $(HTML) =  -		"generate.manifest 0" -		"html.stylesheet pugixml.css" -		"root.filename $(TARGET:B)" -		"generate.section.toc.level 1" -		"toc.section.depth 3" -		"admon.graphics.path images/" -		"navig.graphics.path images/" -		; - -	XSLTProcAction $(HTML) : $(DOCBOOK) ; -	Depends $(HTML) : $(DOCBOOK) $(STYLESHEET) ; -} diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..33ed76b --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,4 @@ +version: "{build}" + +build_script: +  - ps: .\tests\autotest-appveyor.ps1
\ No newline at end of file diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 6270ae5..0f72001 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -3,6 +3,7 @@ project(pugixml)  cmake_minimum_required(VERSION 2.6)  option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF) +option(BUILD_TESTS "Build tests" OFF)  set(BUILD_DEFINES "" CACHE STRING "Build defines")  # Pre-defines standard install locations on *nix systems. @@ -13,13 +14,15 @@ set(HEADERS ../src/pugixml.hpp ../src/pugiconfig.hpp)  set(SOURCES ${HEADERS} ../src/pugixml.cpp)  if(DEFINED BUILD_DEFINES) -	add_definitions(${BUILD_DEFINES}) +	foreach(DEFINE ${BUILD_DEFINES}) +		add_definitions("-D" ${DEFINE}) +	endforeach()  endif()  if(BUILD_SHARED_LIBS) -    add_library(pugixml SHARED ${SOURCES}) +	add_library(pugixml SHARED ${SOURCES})  else() -    add_library(pugixml STATIC ${SOURCES}) +	add_library(pugixml STATIC ${SOURCES})  endif()  set_target_properties(pugixml PROPERTIES VERSION 1.6 SOVERSION 1) @@ -32,3 +35,13 @@ install(TARGETS pugixml EXPORT pugixml-config  install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})  install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml) + +if(BUILD_TESTS) +	file(GLOB TEST_SOURCES ../tests/*.cpp) +	file(GLOB FUZZ_SOURCES ../tests/fuzz_*.cpp) +	list(REMOVE_ITEM TEST_SOURCES ${FUZZ_SOURCES}) + +	add_executable(check ${TEST_SOURCES}) +	target_link_libraries(check pugixml) +	add_custom_command(TARGET check POST_BUILD COMMAND check WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) +endif()
\ No newline at end of file diff --git a/tests/autotest-appveyor.ps1 b/tests/autotest-appveyor.ps1 new file mode 100644 index 0000000..8b7a24c --- /dev/null +++ b/tests/autotest-appveyor.ps1 @@ -0,0 +1,71 @@ +function Invoke-CmdScript($scriptName) +{ +	$cmdLine = """$scriptName"" $args & set" +	& $Env:SystemRoot\system32\cmd.exe /c $cmdLine | +	select-string '^([^=]*)=(.*)$' | foreach-object { +		$varName = $_.Matches[0].Groups[1].Value +		$varValue = $_.Matches[0].Groups[2].Value +		set-item Env:$varName $varValue +	} +} + +$sources = @("src/pugixml.cpp") + (Get-ChildItem -Path "tests/*.cpp" -Exclude "fuzz_*.cpp") +$failed = $FALSE + +foreach ($vs in 9,10,11,12) +{ +	foreach ($arch in "x86","x64") +	{ +		Write-Output "# Setting up VS$vs $arch" + +		Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio $vs.0\VC\vcvarsall.bat" $arch +		if (! $?) { throw "Error setting up VS$vs $arch" } + +		foreach ($defines in "standard", "PUGIXML_WCHAR_MODE") +		{ +			$target = "tests_vs${vs}_${arch}_${defines}" +			$deflist = if ($defines -eq "standard") { "" } else { "/D$defines" } + +			Add-AppveyorTest $target -Outcome Running + +			Write-Output "# Building $target.exe" +			& cmd /c "cl.exe /Fe$target.exe /EHsc /W4 /WX $deflist $sources 2>&1" | Tee-Object -Variable buildOutput + +			if ($?) +			{ +				Write-Output "# Running $target.exe" + +				$sw = [Diagnostics.Stopwatch]::StartNew() + +				& .\$target | Tee-Object -Variable testOutput + +				if ($?) +				{ +					Write-Output "# Passed" + +					Update-AppveyorTest $target -Outcome Passed -StdOut ($testOutput | out-string) -Duration $sw.ElapsedMilliseconds +				} +				else +				{ +					Write-Output "# Failed" + +					Update-AppveyorTest $target -Outcome Failed -StdOut ($testOutput | out-string) -ErrorMessage "Running failed" + +					$failed = $TRUE +				} +			} +			else +			{ +				Write-Output "# Failed to build" + +				Update-AppveyorTest $target -Outcome Failed -StdOut ($buildOutput | out-string) -ErrorMessage "Compilation failed" + +				$failed = $TRUE +			} +		} +	} +} + +if ($failed) { throw "One or more build steps failed" } + +Write-Output "# End" diff --git a/tests/autotest-freebsd.sh b/tests/autotest-freebsd.sh deleted file mode 100644 index ccb5c6c..0000000 --- a/tests/autotest-freebsd.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# put this to /etc/rc.d/pugixml-autotest -# don't forget to chmod +x pugixml-autotest and to replace /home/USERNAME with actual path - -if [ "$1" = "start" -o "$1" = "faststart" ] -then -	PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin -	cd /home/USERNAME/pugixml -	perl tests/autotest-remote-host.pl "shutdown -p now" & -fi diff --git a/tests/autotest-linux.sh b/tests/autotest-linux.sh deleted file mode 100644 index 30b9346..0000000 --- a/tests/autotest-linux.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# chkconfig: 2345 20 80 -# description: pugixml autotest script -# put this to /etc/init.d/pugixml-autotest.sh, then launch -# Debian/Ubuntu: sudo update-rc.d pugixml-autotest.sh defaults 80 -# Fedora/RedHat: sudo chkconfig --add pugixml-autotest.sh -# don't forget to chmod +x pugixml-autotest.sh and to replace /home/USERNAME with actual path - -if [ "$1" = "start" ] -then -	PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin -	cd /home/USERNAME/pugixml -	perl tests/autotest-remote-host.pl "shutdown -P now" & -fi diff --git a/tests/autotest-local.pl b/tests/autotest-local.pl deleted file mode 100644 index 60f8b20..0000000 --- a/tests/autotest-local.pl +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/perl - -use Config; - -sub permute -{ -	my @defines = @_; -	my @result = (''); -	 -	foreach $define (@defines) -	{ -		push @result, map { length($_) == 0 ? $define : "$_,$define" } @result; -	} - -	@result; -} - -sub gcctoolset -{ -	my $gccversion = `gcc -dumpversion`; -	chomp($gccversion); - -	my $gcc = "gcc$gccversion"; - -	return ($^O =~ /darwin/) ? ($gcc, "${gcc}_x64", "${gcc}_ppc") : (`uname -m` =~ /64/) ? ("${gcc}_x64") : ($gcc); -} - -sub getcpucount -{ -	return $1 if ($^O =~ /linux/ && `cat /proc/cpuinfo` =~ /cpu cores\s*:\s*(\d+)/); -	return $1 if ($^O =~ /freebsd|darwin/ && `sysctl -a` =~ /hw\.ncpu\s*:\s*(\d+)/); -	return $1 - 1 if ($^O =~ /solaris/ && `mpstat | wc -l` =~ /(\d+)/); - -	undef; -} - -@alltoolsets = ($^O =~ /MSWin/) -	? (bcc, cw, dmc, -		ic8, ic9, ic9_x64, ic10, ic10_x64, ic11, ic11_x64, -		mingw34, mingw44, mingw45, mingw45_0x, mingw46_x64, -		msvc6, msvc7, msvc71, msvc8, msvc8_x64, msvc9, msvc9_x64, -		msvc10, msvc10_x64, msvc10_clr, msvc10_clr_x64, -		msvc11, msvc11_x64, msvc11_clr, msvc11_clr_x64, msvc11_arm, -		msvc12, msvc12_x64, msvc12_clr, msvc12_clr_x64, msvc12_arm, -		xbox360, ps3_gcc, ps3_snc, msvc8_wince, bada, blackberry, android, android_stlport) -	: ($^O =~ /solaris/) -		? (suncc, suncc_x64) -		: &gcctoolset(); - -$fast = scalar grep(/^fast$/, @ARGV); -@toolsets = map { /^fast$/ ? () : ($_) } @ARGV; -@toolsets = @toolsets ? @toolsets : @alltoolsets; - -@configurations = (debug, release); -@defines = (PUGIXML_NO_XPATH, PUGIXML_NO_EXCEPTIONS, PUGIXML_NO_STL, PUGIXML_WCHAR_MODE); -$stddefine = 'PUGIXML_STANDARD'; - -if ($fast) -{ -	@defines = (PUGIXML_WCHAR_MODE); -	@configurations = (debug); -} - -@definesets = permute(@defines); - -print "### autotest begin " . scalar localtime() . "\n"; - -# print Git revision info -print "### autotest revision $1\n" if (`git rev-parse HEAD` =~ /(.+)/); - -# get CPU info -$cpucount = &getcpucount(); - -# build all configurations -%results = (); - -foreach $toolset (@toolsets) -{ -	my $cmdline = "jam"; - -	# parallel build on non-windows platforms (since jam can't detect processor count) -	$cmdline .= " -j$cpucount" if (defined $cpucount); -	 -	# add toolset -	$cmdline .= " toolset=$toolset"; - -	# add configurations -	$cmdline .= " configuration=" . join(',', @configurations); - -	# add definesets -	$cmdline .= " defines=$stddefine"; - -	foreach $defineset (@definesets) -	{ -        # STLport lacks bad_alloc on Android so skip configurations without PUGIXML_NO_EXCEPTIONS -        next if ($toolset eq 'android_stlport' && $defineset !~ /PUGIXML_NO_EXCEPTIONS/); - -		$cmdline .= ":$defineset" if ($defineset ne ''); - -		# any configuration with prepare but without result is treated as failed -		foreach $configuration (@configurations) -		{ -			print "### autotest $Config{archname} $toolset $configuration [$defineset] prepare\n"; -		} -	} - -	print STDERR "*** testing $toolset... ***\n"; - -	# launch command -	print "### autotest launch $cmdline\n"; - -	open PIPE, "$cmdline autotest=on coverage |" || die "$cmdline failed: $!\n"; - -	# parse build output -	while (<PIPE>) -	{ -		# ... autotest release [wchar] success -		if (/^\.\.\. autotest (\S+) \[(.*?)\] (success|skiprun)/) -		{ -			my $configuration = $1; -			my $defineset = ($2 eq $stddefine) ? '' : $2; -            my $result = $3; - -			print "### autotest $Config{archname} $toolset $configuration [$defineset] $result\n"; -		} -		# ... autotest release [wchar] gcov -		elsif (/^\.\.\. autotest (\S+) \[(.*?)\] gcov/) -		{ -			my $configuration = $1; -			my $defineset = ($2 eq $stddefine) ? '' : $2; - -			if (/pugixml\.cpp' executed:([^%]+)%/) -			{ -				print "### autotest $Config{archname} $toolset $configuration [$defineset] coverage $1\n"; -			} -			else -			{ -				print; -			} -		} -		else -		{ -			print; -		} -	} - -	close PIPE; -} - -print "### autotest end " . scalar localtime() . "\n"; diff --git a/tests/autotest-macos.sh b/tests/autotest-macos.sh deleted file mode 100644 index fc21fc8..0000000 --- a/tests/autotest-macos.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# put this to /Library/StartupItems/pugixml-autotest/pugixml-autotest, then create -# file StartupParameters.plist in the same folder with the following contents: -# <plist><dict><key>Provides</key><array><string>pugixml-autotest</string></array></dict></plist> -# don't forget to chmod +x pugixml-autotest and to replace /Users/USERNAME with actual path - -if [ "$1" = "start" ] -then -	PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin -	cd /Users/USERNAME/pugixml -	perl tests/autotest-remote-host.pl "shutdown -h now" & -fi diff --git a/tests/autotest-remote-host.pl b/tests/autotest-remote-host.pl deleted file mode 100644 index 63dfe68..0000000 --- a/tests/autotest-remote-host.pl +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/perl - -sub execprint -{ -	my $cmd = shift; - -	open PIPE, "$cmd |" || die "$cmd failed: $!\n"; -	print while (<PIPE>); -	close PIPE; - -	return $?; -} - -use IO::Socket; -use Net::Ping; - -$exitcmd = shift; -$host = "10.0.2.2"; - -# wait while network is up -$ping = Net::Ping->new("icmp"); - -while (!$ping->ping($host)) -{ -	print "### autotest $host is down, retrying...\n"; -} - -print "### autotest $host is up, connecting...\n"; - -my $client = new IO::Socket::INET(PeerAddr => "$host:7183"); -exit unless $client; - -select $client; - -&execprint('git pull') == 0 || die "error updating from repo\n"; -&execprint('perl tests/autotest-local.pl') == 0 || die "error launching tests\n"; -system($exitcmd); diff --git a/tests/autotest-remote-server.pl b/tests/autotest-remote-server.pl deleted file mode 100644 index 811c3e8..0000000 --- a/tests/autotest-remote-server.pl +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/perl - -use IO::Socket; - -$vm = shift; -$log = shift; - -# start virtualbox gui in minimized mode - this should be the first thing we do since this process -# inherits all handles and we want our sockets/log file closed -system("start /min virtualbox --startvm $vm"); - -# start a server; vm will connect to the server via autotest-remote-host.pl -my $server = new IO::Socket::INET(LocalPort => 7183, Listen => 1); -die "Could not create socket: $!\n" unless $server; - -open LOG, ">> $log" || die "Could not open log file: $!\n"; - -print LOG "Listening for connection...\n"; - -my $client = $server->accept(); - -# echo all input to log file -print LOG $_ while (<$client>); -close LOG; - -$client->close(); -$server->close(); - -# wait for vm shutdown to decrease peak memory consumption -while (`vboxmanage showvminfo $vm` !~ /State:\s+powered off/) -{ -    sleep(1); -} diff --git a/tests/autotest-report.pl b/tests/autotest-report.pl deleted file mode 100644 index 9eebf39..0000000 --- a/tests/autotest-report.pl +++ /dev/null @@ -1,229 +0,0 @@ -#!/usr/bin/perl - -# pretty-printing -sub prettysuffix -{ -	my $suffix = shift; - -	return " C++0x" if ($suffix eq '_0x'); -	return " x64" if ($suffix eq '_x64'); -	return " CLR" if ($suffix eq '_clr'); -	return " CLR x64" if ($suffix eq '_clr_x64'); -	return " PPC" if ($suffix eq '_ppc'); -	return " WinCE" if ($suffix eq '_wince'); -	return " ARM" if ($suffix eq '_arm'); - -	return ""; -} - -sub prettytoolset -{ -	my $toolset = shift; - -	return "Borland C++ 5.82" if ($toolset eq 'bcc'); -	return "Metrowerks CodeWarrior 8" if ($toolset eq 'cw'); -	return "Digital Mars C++ 8.51" if ($toolset eq 'dmc'); -	return "Sun C++ 5.10" . prettysuffix($1) if ($toolset =~ /^suncc(.*)$/); - -	return "Intel C++ Compiler $1.0" . prettysuffix($2) if ($toolset =~ /^ic(\d+)(.*)$/); -	return "MinGW (GCC $1.$2)" . prettysuffix($3) if ($toolset =~ /^mingw(\d)(\d)(.*)$/); -	return "Microsoft Visual C++ 7.1" if ($toolset eq 'msvc71'); -	return "Microsoft Visual C++ $1.0" . prettysuffix($2) if ($toolset =~ /^msvc(\d+)(.*)$/); -	return "GNU C++ Compiler $1" . prettysuffix($2) if ($toolset =~ /^gcc([\d.]*)(.*)$/); - -	return "Microsoft Xbox360 Compiler" if ($toolset =~ /^xbox360/); -	return "Sony PlayStation3 GCC" if ($toolset =~ /^ps3_gcc/); -	return "Sony PlayStation3 SNC" if ($toolset =~ /^ps3_snc/); - -	return "Android NDK (GCC)" . ($1 eq '_stlport' ? " STLport" : "") if ($toolset =~ /^android(.*)$/); -	return "bada SDK (GCC)" if ($toolset =~ /^bada$/); -	return "BlackBerry NDK (GCC)" if ($toolset =~ /^blackberry$/); - -	$toolset; -} - -sub prettyplatform -{ -	my ($platform, $toolset) = @_; - -	return "solaris" if ($platform =~ /solaris/); - -	return "macos" if ($platform =~ /darwin/); - -	return "linux64" if ($platform =~ /64-linux/); -	return "linux32" if ($platform =~ /86-linux/); - -	return "fbsd64" if ($platform =~ /64-freebsd/); -	return "fbsd32" if ($platform =~ /86-freebsd/); - -	return "x360" if ($toolset =~ /^xbox360/); -	return "ps3" if ($toolset =~ /^ps3/); - -    return "arm" if ($toolset =~ /_arm$/); -    return "arm" if ($toolset =~ /_wince$/); -    return "arm" if ($toolset =~ /^android/); -    return "arm" if ($toolset =~ /^bada/); -    return "arm" if ($toolset =~ /^blackberry/); - -	return "win64" if ($platform =~ /MSWin32-x64/); -	return "win32" if ($platform =~ /MSWin32/); - -	$platform; -} - -sub prettybox -{ -	my $enabled = shift; -	my $color = $enabled ? "#cccccc" : "#ffffff"; - -	"<td bgcolor='$color' align='center'>" . ($enabled ? "+" : " ") . "</td>"; -} - -# parse build log -%results = (); -%toolsets = (); -%defines = (); -%configurations = (); - -sub insertindex -{ -	my ($hash, $key) = @_; - -	$$hash{$key} = scalar(keys %$hash) unless defined $$hash{$key}; -} - -while (<>) -{ -	### autotest i386-freebsd-64int gcc release [wchar] result 0 97.78 98.85 -	if (/^### autotest (\S+) (\S+) (\S+) \[(.*?)\] (.*)/) -	{ -		my ($platform, $toolset, $configuration, $defineset, $info) = ($1, $2, $3, $4, $5); - -		my $fulltool = &prettyplatform($platform, $toolset) . ' ' . &prettytoolset($toolset); -		my $fullconf = "$configuration $defineset"; - -		if ($info =~ /^prepare/) -		{ -			$results{$fulltool}{$fullconf}{result} = ""; -		} -		elsif ($info =~ /^success/) -		{ -			$results{$fulltool}{$fullconf}{result} = "success"; -		} -		elsif ($info =~ /^skiprun/) -		{ -			$results{$fulltool}{$fullconf}{result} = "skiprun"; -		} -		elsif ($info =~ /^coverage (\S+)/) -		{ -			$results{$fulltool}{$fullconf}{coverage} = $1; -		} -		else -		{ -			print STDERR "Unrecognized autotest infoline $_"; -		} - -		&insertindex(\%toolsets, $fulltool); - -		$defines{$_} = 1 foreach (split /,/, $defineset); -		&insertindex(\%configurations, $fullconf); -	} -	elsif (/^### autotest revision (.+)/) -	{ -		if (defined $revision && $revision != $1) -		{ -			print STDERR "Autotest build report contains several revisions: $revision, $1\n"; -		} -		else -		{ -			$revision = $1; -		} -	} -} - -# make arrays of toolsets and configurations -@toolsetarray = (); -@configurationarray = (); - -$toolsetarray[$toolsets{$_}] = $_ foreach (keys %toolsets); -$configurationarray[$configurations{$_}] = $_ foreach (keys %configurations); - -# print header -$stylesheet = <<END; -table.autotest { border: 1px solid black; border-left: none; border-top: none; } -table.autotest td { border: 1px solid black; border-right: none; border-bottom: none; } -END - -print <<END; -<html><head><title>pugixml autotest report</title><style type="text/css"><!-- $stylesheet --></style></head><body> -<h3>pugixml autotest report</h3> -<table border=1 cellspacing=0 cellpadding=4 class="autotest"> -END - -# print configuration header (release/debug) -print "<tr><td align='right' colspan=2>optimization</td>"; -print &prettybox((split /\s+/)[0] eq 'release') foreach (@configurationarray); -print "</tr>\n"; - -# print defines header (one row for each define) -foreach $define (sort {$a cmp $b} keys %defines) -{ -	print "<tr><td align='right' colspan=2><small>$define</small></td>"; - -	foreach (@configurationarray) -	{ -		my $present = ($_ =~ /\b$define\b/); -		 -		print &prettybox($present); -	} -	print "</tr>\n"; -} - -# print data (one row for each toolset) -foreach $tool (@toolsetarray) -{ -	my ($platform, $toolset) = split(/\s+/, $tool, 2); -	print "<tr><td style='border-right: none' align='center'><small>$platform</small></td><td style='border-left: none'><nobr>$toolset</nobr></td>"; - -	foreach (@configurationarray) -	{ -		my $info = $results{$tool}{$_}; - -		if (!defined $$info{result}) -		{ -			print "<td bgcolor='#cccccc'> </td>"; -		} -		elsif ($$info{result} eq "success") -		{ -			my $coverage = $$info{coverage}; - -			print "<td bgcolor='#00ff00' align='center'>pass"; -				 -			if ($coverage > 0) -			{ -				print "<br><font size='-2'>" . ($coverage + 0) . "%</font>"; -			} - -			print "</td>"; -		} -		elsif ($$info{result} eq "skiprun") -		{ -			print "<td bgcolor='#ffff80' align='center'>pass</td>" -		} -		else -		{ -			print "<td bgcolor='#ff0000' align='center'>fail</td>" -		} -	} - -	print "</tr>\n"; -} - -# print footer -$date = localtime; - -print <<END; -</table><br> -Generated on $date from Git $revision -</body></html> -END diff --git a/tests/autotest-solaris.sh b/tests/autotest-solaris.sh deleted file mode 100644 index 96111a7..0000000 --- a/tests/autotest-solaris.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# put this to /etc/init.d/pugixml-autotest.sh, then launch -# ln -s /etc/init.d/pugixml-autotest.sh /etc/rc3.d/S80pugixml-autotest -# don't forget to chmod +x pugixml-autotest.sh and to replace /export/home/USERNAME with actual path - -if [ "$1" = "start" ] -then -	cd /export/home/USERNAME/pugixml -	perl tests/autotest-remote-host.pl "shutdown -g 0 -i 5 -y" & -fi diff --git a/tests/gcov-filter.pl b/tests/gcov-filter.pl deleted file mode 100644 index f0d2019..0000000 --- a/tests/gcov-filter.pl +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl - -sub funcinfo -{ -	my ($name, $info) = @_; - -	return if ($info =~ /No executable lines/); - -	my $lines = ($info =~ /Lines executed:([^%]+)%/) ? $1 : 100; -	my $calls = ($info =~ /Calls executed:([^%]+)%/) ? $1 : 100; -	my $branches = ($info =~ /Branches executed:([^%]+)%/) ? $1 : 100; -	my $taken = ($info =~ /Taken at least once:([^%]+)%/) ? $1 : 100; - -	return if ($lines == 100 && $calls == 100 && $branches == 100 && $taken == 100); - -	return "Function $name: L $lines, C $calls, B $branches, BT $taken\n"; -} - -$prefix = join(' ', @ARGV); -$prefix .= ' ' if ($prefix ne ''); - -$lines = join('', <STDIN>); - -# merge file information -$lines =~ s/File (.+)\nLines (.+)\n(.+\n)*\n/$1 $2\n/g; - -# merge function information -$lines =~ s/Function (.+)\n((.+\n)*)\n/funcinfo($1, $2)/eg; - -# remove include information -$lines =~ s/.+include\/c\+\+.+\n//g; - -foreach $line (split /\n/, $lines) -{ -	print "$prefix$line\n"; -} | 
