You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2008/01/29 10:53:52 UTC
svn commit: r616229 - in /logging/log4cxx/trunk: ./ src/test/cpp/
src/test/cpp/defaultinit/ src/test/cpp/net/ src/test/cpp/xml/
src/test/resources/
Author: carnold
Date: Tue Jan 29 01:53:50 2008
New Revision: 616229
URL: http://svn.apache.org/viewvc?rev=616229&view=rev
Log:
LOGCXX-225: Replace cppunit with APR test framework
Added:
logging/log4cxx/trunk/src/test/cpp/abts.c
- copied, changed from r615721, apr/apr/trunk/test/abts.c
logging/log4cxx/trunk/src/test/cpp/abts.h
- copied unchanged from r615721, apr/apr/trunk/test/abts.h
logging/log4cxx/trunk/src/test/cpp/abts_tests.h
- copied, changed from r615721, apr/apr/trunk/test/abts_tests.h
logging/log4cxx/trunk/src/test/cpp/testutil.h
- copied, changed from r615721, apr/apr/trunk/test/testutil.h
Removed:
logging/log4cxx/trunk/src/test/cpp/main.cpp
Modified:
logging/log4cxx/trunk/INSTALL
logging/log4cxx/trunk/build.xml
logging/log4cxx/trunk/configure.in
logging/log4cxx/trunk/src/test/cpp/Makefile.am
logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp
logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp
logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp
logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp
logging/log4cxx/trunk/src/test/cpp/logunit.cpp
logging/log4cxx/trunk/src/test/cpp/logunit.h
logging/log4cxx/trunk/src/test/cpp/net/socketservertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp
logging/log4cxx/trunk/src/test/resources/Makefile.am
Modified: logging/log4cxx/trunk/INSTALL
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/INSTALL?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/INSTALL (original)
+++ logging/log4cxx/trunk/INSTALL Tue Jan 29 01:53:50 2008
@@ -30,7 +30,7 @@
Prerequisites:
-Apache Ant 1.6.1 or later (1.6.2 preferred)
+Apache Ant 1.6.1 or later
http://ant.apache.org
cpptasks.jar and ant-contrib.jar on CLASSPATH
@@ -51,11 +51,9 @@
The following files placed in the lib directory:
apr-1.2.2.tar.gz
apr-util-1.2.2.tar.gz
- cppunit-1.10.2.gz
-
+
http://apr.apache.org
- http://cppunit.sourceforge.net
-
+
Building:
@@ -93,7 +91,6 @@
-Dlib.type=[shared | static | dylib]
-Drtti=[false | true]
-Dapache.mirror=URL
- -Dcppunit.mirror=URL
-Dapr.lib.type=[static | shared]
-Daprutil.lib.type=[static | shared]
-Dapriconv.lib.type=[static | shared]
@@ -224,7 +221,6 @@
--with-apr : Specify non-default location for apr.
--with-aprutil: Specify non-default location for apr-util.
---enable-cppunit=no: Disable building CppUnit unit tests.
--enable-wchar_t: Enable wchar_t API methods.
--enable-unichar: Enable UniChar API methods, UniChar is an unsigned short containing UTF-16.
--enable-cfstring: Enable CFString API methods, CFString is Mac OS/X CoreFoundation's string.
Modified: logging/log4cxx/trunk/build.xml
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/build.xml?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/build.xml (original)
+++ logging/log4cxx/trunk/build.xml Tue Jan 29 01:53:50 2008
@@ -73,7 +73,6 @@
<property name="has.wcout" value="1"/>
<property name="apache.mirror" value="http://archive.apache.org/dist"/>
-<property name="cppunit.mirror" value="http://easynews.dl.sourceforge.net/sourceforge"/>
<property name="apache.dist" value="http://archive.apache.org/dist"/>
<!-- property name="apache.doc_dest" value="/www/logging.apache.org/log4cxx"/ -->
@@ -89,10 +88,6 @@
<property name="aprutil.lib.type" value="static"/>
-<property name="cppunit.version" value="1.10.2"/>
-<property name="cppunit.lib.name" value="cppunit"/>
-<property name="cppunit.lib.type" value="static"/>
-
<property name="svnrepo.url" value="https://svn.apache.org/repos/asf"/>
<property name="svnsite.url" value="${svnrepo.url}/logging/site/trunk/docs/log4cxx"/>
<available property="svn-available" file="target/site-deploy/.svn"/>
@@ -111,12 +106,10 @@
> ant
-Builds and tests log4cxx. Will download and build
-apr, apr-util, apr-iconv and cppunit from source.
-
-> ant -Dapr.dir=/usr/local/lib -Dcppunit.dir=/usr/lib
+Builds and tests log4cxx.
+> ant -Dapr.dir=/usr/local/lib
-Builds and tests log4cxx using installed APR and cppunit
+Builds and tests log4cxx using installed APR
> ant -p
@@ -209,14 +202,6 @@
<condition property="mac_osx_wchar_not_supported_yet" value="true">
<equals arg1="${has.wchar_t}" arg2="1"/>
</condition>
- <!-- fail if="mac_osx_wchar_not_supported_yet">
-
-wchar_t is not supported in Mac OS/X yet,
-cppunit fails to link
-LogString may become CFString, see bug LOGCXX-85
-
-specify -Dhas.wchar_t=0 on Ant command line for UTF-8 build as work-around
-</fail-->
</target>
@@ -310,13 +295,6 @@
<isset property="aprutil.dir"/>
</condition>
- <condition property="cppunit.include.dir" value="${cppunit.dir}/include">
- <isset property="cppunit.dir"/>
- </condition>
- <condition property="cppunit.lib.dir" value="${cppunit.dir}/lib">
- <isset property="cppunit.dir"/>
- </condition>
-
<condition property="lib-suffix" value="d">
<isset property="is-debug"/>
</condition>
@@ -326,20 +304,10 @@
file="${apr.lib.dir}/${lib.prefix}apr-1${lib-suffix}${lib.extension}"/>
<available property="aprutil-available"
file="${aprutil.lib.dir}/${lib.prefix}aprutil-1${lib-suffix}${lib.extension}"/>
- <available property="cppunit-available"
- file="${cppunit.lib.dir}/${lib.prefix}cppunit${lib-suffix}${lib.extension}"/>
<available property="apr-src-expanded" file="${lib.dir}/apr-${apr.version}"/>
<available property="aprutil-src-expanded" file="${lib.dir}/apr-util-${aprutil.version}"/>
- <available property="cppunit-src-expanded" file="${lib.dir}/cppunit-${cppunit.version}"/>
-
- <condition property="cppunit-src-available" value="">
- <or>
- <isset property="cppunit-src-expanded"/>
- <available file="${lib.dir}/cppunit-${cppunit.version}.tar.gz"/>
- </or>
- </condition>
<condition property="is-static" value="true">
<equals arg1="${lib.type}" arg2="static"/>
@@ -353,11 +321,6 @@
<equals arg1="${aprutil.lib.type}" arg2="static"/>
</condition>
- <condition property="cppunit-static" value="true">
- <equals arg1="${cppunit.lib.type}" arg2="static"/>
- </condition>
-
-
<condition property="executable.dir" value="${build.dir}/debug">
<isset property="is-debug"/>
</condition>
@@ -543,44 +506,6 @@
</ant>
</target>
-<target name="get-cppunit-src" unless="cppunit-src-available">
- <mkdir dir="${lib.dir}"/>
- <get src="${cppunit.mirror}/cppunit/cppunit-${cppunit.version}.tar.gz"
- dest="${lib.dir}/cppunit-${cppunit.version}.tar.gz"
- usetimestamp="true"/>
-</target>
-
-<target name="untar-cppunit-src" depends="get-cppunit-src" unless="cppunit-src-expanded">
- <untar src="${lib.dir}/cppunit-${cppunit.version}.tar.gz"
- dest="${lib.dir}" compression="gzip"/>
- <chmod file="${lib.dir}/cppunit-${cppunit.version}/configure"
- perm="u+x"/>
-</target>
-
-
-<target name="build-cppunit" depends="init" unless="cppunit-available">
- <antcall target="untar-cppunit-src"/>
-
- <property name="cppunit.dir" value="${lib.dir}/cppunit-${cppunit.version}"/>
-
- <ant antfile="src/cppunit/ant/build.xml" target="build" inheritAll="false">
- <property name="base.dir" value="${cppunit.dir}"/>
- <property name="cppunit.version" value="${cppunit.version}"/>
- <property name="debug" value="${debug}"/>
- <property name="lib-suffix" value="${lib-suffix}"/>
- <property name="compiler" value="${compiler}"/>
- <property name="executable.dir" value="${executable.dir}"/>
- <property name="lib.type" value="${cppunit.lib.type}"/>
- <property name="project.type" value="${project.type}"/>
- <property name="project.dir" value="${project.dir}"/>
- <property name="project.if.value" value="${project.if}"/>
- <property name="use-pic" value="${use-pic}"/>
- <property name="os.family" value="${os.family}"/>
- </ant>
- <property name="cppunit.include.dir" value="${cppunit.dir}/include"/>
- <property name="cppunit.lib.dir" value="${executable.dir}/${cppunit.lib.type}"/>
-</target>
-
<target name="make-header-check">
<echo file="${header}.cpp" append="false">
@@ -759,24 +684,22 @@
</target>
-<target name="build-unittest" depends="build, build-cppunit"
+<target name="build-unittest" depends="build"
description="Builds unit test app">
- <mkdir dir="${log4cxx.lib.dir}/log4cxx-test_obj"/>
+ <mkdir dir="${log4cxx.lib.dir}/testsuite_obj"/>
<property name="project.compiler" value="${compiler}"/>
<cc name="${project.compiler}"
exceptions="true"
- outfile="${log4cxx.lib.dir}/log4cxx-test"
+ outfile="${log4cxx.lib.dir}/testsuite"
subsystem="console"
multithreaded="true"
- outputfileproperty="log4cxx-test.exe"
+ outputfileproperty="testsuite.exe"
outtype="executable"
- objdir="${log4cxx.lib.dir}/log4cxx-test_obj"
+ objdir="${log4cxx.lib.dir}/testsuite_obj"
debug="${debug}"
projectsOnly="${projectsOnly}">
- <fileset dir="${tests.cpp.dir}" includes="**/*.cpp **/*.h">
- </fileset>
- <includepath path="${cppunit.include.dir}" if="cppunit.include.dir"/>
+ <fileset dir="${tests.cpp.dir}" includes="**/*.cpp **/*.c **/*.h"/>
<includepath path="${include.dir}"/>
<includepath path="${apr.include.dir}"/>
<includepath path="${aprutil.include.dir}"/>
@@ -787,12 +710,10 @@
<compilerarg value="${pic-option}" if="pic-option"/>
<libset libs="log4cxx${lib-suffix}" dir="${log4cxx.lib.dir}"/>
- <libset libs="${cppunit.lib.name}${lib-suffix}" dir="${cppunit.lib.dir}" if="cppunit.lib.dir"/>
- <libset libs="${cppunit.lib.name}${lib-suffix}" unless="cppunit.lib.dir"/>
<libset libs="dl" if="is-unix"/>
&libsets;
- <project outfile="${project.dir}/log4cxx-test" type="${project.type}" if="project.if"/>
+ <project outfile="${project.dir}/testsuite" type="${project.type}" if="project.if"/>
</cc>
</target>
@@ -800,25 +721,22 @@
<target name="build-standalone-unittest"
- depends="build-cppunit"
description="Builds a unit tests + log4cxx executable">
- <mkdir dir="${executable.dir}/static/log4cxx-standalone-test_obj"/>
+ <mkdir dir="${executable.dir}/static/testsuite-standalone_obj"/>
<property name="project.compiler" value="${compiler}"/>
<cc name="${project.compiler}"
exceptions="true"
- outfile="${executable.dir}/static/log4cxx-standalone-test"
+ outfile="${executable.dir}/static/testsuite-standalone"
subsystem="console"
multithreaded="true"
- outputfileproperty="log4cxx-standalone-test.exe"
+ outputfileproperty="testsuite-standalone.exe"
outtype="executable"
- objdir="${executable.dir}/static/log4cxx-standalone-test_obj"
+ objdir="${executable.dir}/static/testsuite-standalone_obj"
debug="${debug}"
projectsOnly="${projectsOnly}">
<fileset dir="${src.dir}" includes="*.cpp" excludes="**/iconv_module.cpp"/>
<fileset dir="${include.dir}" includes="**/*.h"/>
- <fileset dir="${tests.cpp.dir}" includes="**/*.cpp **/*.h">
- </fileset>
- <includepath path="${cppunit.include.dir}" if="cppunit.include.dir"/>
+ <fileset dir="${tests.cpp.dir}" includes="**/*.cpp **/*.c **/*.h"/>
<includepath path="${include.dir}"/>
<includepath path="${apr.include.dir}"/>
<includepath path="${aprutil.include.dir}"/>
@@ -827,8 +745,6 @@
<defineset define="APU_DECLARE_STATIC" if="aprutil-static"/>
<defineset define="WIN32" if="is-windows"/>
<compilerarg value="${pic-option}" if="pic-option"/>
- <libset libs="${cppunit.lib.name}${lib-suffix}" dir="${cppunit.lib.dir}" if="cppunit.lib.dir"/>
- <libset libs="${cppunit.lib.name}${lib-suffix}" unless="cppunit.lib.dir"/>
&libsets;
@@ -838,7 +754,7 @@
<libset libs="cw32mt" if="is-bcc"/>
- <project outfile="${projects.dir}/log4cxx-standalone-test"
+ <project outfile="${projects.dir}/testsuite-standalone"
type="${project.type}"
if="project.if"/>
</cc>
@@ -853,88 +769,79 @@
</delete>
</target>
-<target name="run-defaultinit-unittest" depends="build-unittest"
- description="Runs default init unit tests">
+<target name="run-defaultinit-unittest" depends="build-unittest">
+ <antcall target="run-defaultinit-log4X">
+ <param name="config" value="log4j"/>
+ </antcall>
+ <antcall target="run-defaultinit-log4X">
+ <param name="config" value="log4cxx"/>
+ </antcall>
+</target>
+<target name="run-defaultinit-log4X">
<mkdir dir="${tests.output.dir}"/>
- <!-- test use of log4j.configuration -->
- <property name="defaultInit3.properties"
- location="${tests.resources.dir}/input/defaultInit3.properties"/>
-
- <property name="defaultInit.xml"
- location="${tests.resources.dir}/input/xml/defaultInit.xml"/>
-
<!-- test of log4j.properties -->
- <delete file="${log4cxx.lib.dir}/log4*.properties"/>
- <delete file="${log4cxx.lib.dir}/log4*.xml"/>
- <copy tofile="${log4cxx.lib.dir}/log4j.properties"
- file="${defaultInit3.properties}" overwrite="true"/>
- <exec executable="${log4cxx-test.exe}" dir="${log4cxx.lib.dir}"
+ <delete>
+ <fileset dir="${log4cxx.lib.dir}" includes="*.properties *.xml"/>
+ </delete>
+ <exec executable="${testsuite.exe}" dir="${log4cxx.lib.dir}"
failonerror="true">
- <arg value="TestCase3"/>
+ <arg value="-v"/>
+ <arg value="testcase1"/>
<env key="DYLD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
<env key="LD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.LD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.LD_LIBRARY_PATH}"/>
</exec>
- <!-- modify log4j.properties so if it has precedence the test fails -->
- <replace file="${log4cxx.lib.dir}/log4j.properties" token="D3" value="D4"/>
- <copy tofile="${log4cxx.lib.dir}/log4cxx.properties"
- file="${defaultInit3.properties}"/>
- <exec executable="${log4cxx-test.exe}" dir="${log4cxx.lib.dir}"
+ <copy tofile="${log4cxx.lib.dir}/${config}.xml"
+ file="${tests.resources.dir}/input/xml/defaultInit.xml" overwrite="true"/>
+ <exec executable="${testsuite.exe}" dir="${log4cxx.lib.dir}"
failonerror="true">
- <arg value="TestCase3"/>
+ <arg value="-v"/>
+ <arg value="testcase2"/>
<env key="DYLD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
<env key="LD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.LD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.LD_LIBRARY_PATH}"/>
</exec>
+ <delete>
+ <fileset dir="${log4cxx.lib.dir}" includes="*.properties *.xml"/>
+ </delete>
- <delete file="${log4cxx.lib.dir}/log4cxx.properties"/>
- <delete file="${log4cxx.lib.dir}/log4j.properties"/>
- <copy tofile="${log4cxx.lib.dir}/log4j.xml"
- file="${defaultInit.xml}"/>
- <copy todir="${log4cxx.lib.dir}" file="${tests.resources.dir}/input/xml/log4j.dtd"/>
- <exec executable="${log4cxx-test.exe}" dir="${log4cxx.lib.dir}"
+ <copy tofile="${log4cxx.lib.dir}/${config}.properties"
+ file="${tests.resources.dir}/input/defaultInit3.properties" overwrite="true"/>
+ <exec executable="${testsuite.exe}" dir="${log4cxx.lib.dir}"
failonerror="true">
- <arg value="TestCase4"/>
- <env key="LD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.LD_LIBRARY_PATH}"/>
+ <arg value="-v"/>
+ <arg value="testcase3"/>
<env key="DYLD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
+ <env key="LD_LIBRARY_PATH"
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.LD_LIBRARY_PATH}"/>
</exec>
-
- <mkdir dir="${tests.resources.dir}/output"/>
<delete>
- <fileset dir="${tests.resources.dir}/output"/>
+ <fileset dir="${log4cxx.lib.dir}" includes="*.properties *.xml"/>
</delete>
- <exec executable="${log4cxx-test.exe}" dir="${tests.resources.dir}"
- failonerror="true">
- <arg value="TestCase3"/>
- <env key="LD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.LD_LIBRARY_PATH}"/>
- <env key="DYLD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
- <env key="log4j.configuration"
- value="${defaultInit3.properties}"/>
- </exec>
- <!-- test of LOG4CXX_CONFIGURATION -->
- <exec executable="${log4cxx-test.exe}" dir="${tests.resources.dir}"
+ <copy file="${tests.resources.dir}/input/xml/defaultInit.xml" tofile="${log4cxx.lib.dir}/${config}.xml"/>
+ <copy file="${tests.resources.dir}/input/defaultInit3.properties" tofile="${log4cxx.lib.dir}/${config}.properties"/>
+ <exec executable="${testsuite.exe}" dir="${log4cxx.lib.dir}"
failonerror="true">
- <arg value="TestCase3"/>
+ <arg value="-v"/>
+ <arg value="testcase4"/>
<env key="LD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.LD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.LD_LIBRARY_PATH}"/>
<env key="DYLD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
- <env key="LOG4CXX_CONFIGURATION"
- value="${defaultInit3.properties}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
</exec>
+ <delete>
+ <fileset dir="${log4cxx.lib.dir}" includes="*.properties *.xml"/>
+ </delete>
</target>
@@ -946,16 +853,16 @@
<delete>
<fileset dir="${tests.output.dir}" includes="*"/>
</delete>
- <exec executable="${log4cxx-test.exe}" dir="${tests.resources.dir}"
+ <exec executable="${testsuite.exe}" dir="${tests.resources.dir}"
failonerror="true">
- <arg value="+TestCase1"/>
+ <arg value="-v"/>
<env key="TOTO" value="wonderful"/>
<env key="key1" value="value1"/>
<env key="key2" value="value2"/>
<env key="LD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.LD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.LD_LIBRARY_PATH}"/>
<env key="DYLD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
<env key="Path"
value="${log4cxx.lib.dir};${env.Path}"/>
</exec>
@@ -972,13 +879,14 @@
</delete>
<exec executable="${log4cxx-standalone-test.exe}" dir="${tests.resources.dir}"
failonerror="true">
+ <arg value="-v"/>
<env key="TOTO" value="wonderful"/>
<env key="key1" value="value1"/>
<env key="key2" value="value2"/>
<env key="DYLD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
<env key="LD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.LD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.LD_LIBRARY_PATH}"/>
<env key="Path"
value="${log4cxx.lib.dir};${env.Path}"/>
</exec>
@@ -1004,13 +912,14 @@
</java>
<sequential>
<sleep seconds="2"/>
- <exec executable="${log4cxx-test.exe}" dir="${tests.resources.dir}"
+ <exec executable="${testsuite.exe}" dir="${tests.resources.dir}"
failonerror="true">
- <arg value="SocketServerTestCase"/>
+ <arg value="-v"/>
+ <arg value="socketservertestcase"/>
<env key="LD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.LD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.LD_LIBRARY_PATH}"/>
<env key="DYLD_LIBRARY_PATH"
- value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${cppunit.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
+ value="${log4cxx.lib.dir}:${apr.lib.dir}:${aprutil.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
<env key="Path"
value="${log4cxx.lib.dir};${env.Path}"/>
</exec>
Modified: logging/log4cxx/trunk/configure.in
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/configure.in?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/configure.in (original)
+++ logging/log4cxx/trunk/configure.in Tue Jan 29 01:53:50 2008
@@ -117,41 +117,6 @@
AC_SUBST(manual_dest)
AC_SUBST(base_dir)
-# CppUnit
-
-AC_ARG_ENABLE(cppunit,
- AC_HELP_STRING(--enable-cppunit,
- [enable test execution with cppunit (auto)]))
-
-enable_tests=yes
-
-if test "x$enable_cppunit" = xno; then
- enable_tests=no
-else
- AC_CHECK_PROG(CPPUNIT_CONFIG, cppunit-config, yes, no)
- if test "x$CPPUNIT_CONFIG" = "xyes"
- then
- LIBS_CPPUNIT="`cppunit-config --libs`"
- CPPFLAGS_CPPUNIT="`cppunit-config --cflags`"
- AC_SUBST(LIBS_CPPUNIT)
- AC_SUBST(CPPFLAGS_CPPUNIT)
- else
- AC_MSG_WARN(cppunit not found !)
- fi
-
- # save cpp and ld options
- _save_CPPFLAGS="$CPPFLAGS"
- _save_LIBS="$LIBS"
-
- LIBS="$LIBS $LIBS_CPPUNIT"
- CPPFLAGS="$CPPFLAGS $CPPFLAGS_CPPUNIT"
- AC_CHECK_HEADER([cppunit/TestFixture.h],,
- enable_tests=no)
- CPPFLAGS="$_save_CPPFLAGS"
- LIBS="$_save_LIBS"
-fi
-
-AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
Modified: logging/log4cxx/trunk/src/test/cpp/Makefile.am
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/Makefile.am?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/Makefile.am (original)
+++ logging/log4cxx/trunk/src/test/cpp/Makefile.am Tue Jan 29 01:53:50 2008
@@ -22,8 +22,6 @@
$(top_srcdir)/src/test/cpp/xml/*.h \
$(top_srcdir)/src/test/cpp/*.h
-if TESTS
-
INCLUDES = -I$(top_srcdir)/src/main/include -I$(top_builddir)/src/main/include
noinst_PROGRAMS = testsuite
@@ -129,6 +127,7 @@
$(db_tests) \
$(xml_tests) \
$(nt_tests) \
+ abts.c \
asyncappendertestcase.cpp\
encodingtest.cpp\
filetestcase.cpp \
@@ -136,8 +135,8 @@
hierarchythresholdtestcase.cpp\
l7dtestcase.cpp\
leveltestcase.cpp \
+ logunit.cpp \
loggertestcase.cpp\
- main.cpp\
minimumtestcase.cpp\
patternlayouttest.cpp\
vectorappender.cpp\
@@ -153,15 +152,9 @@
testsuite_LDADD = \
$(top_builddir)/src/main/cpp/liblog4cxx.la
-testsuite_LDFLAGS = \
- @LIBS_CPPUNIT@
-
-AM_CPPFLAGS = \
- @CPPFLAGS_CPPUNIT@
testsuite_DEPENDENCIES = \
$(top_builddir)/src/main/cpp/liblog4cxx.la
check: testsuite
-endif
Copied: logging/log4cxx/trunk/src/test/cpp/abts.c (from r615721, apr/apr/trunk/test/abts.c)
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/abts.c?p2=logging/log4cxx/trunk/src/test/cpp/abts.c&p1=apr/apr/trunk/test/abts.c&r1=615721&r2=616229&rev=616229&view=diff
==============================================================================
--- apr/apr/trunk/test/abts.c (original)
+++ logging/log4cxx/trunk/src/test/cpp/abts.c Tue Jan 29 01:53:50 2008
@@ -422,11 +422,13 @@
}
}
- for (i = 0; i < (sizeof(alltests) / sizeof(struct testlist *)); i++) {
- suite = alltests[i].func(suite);
- }
+ suite = abts_run_suites(suite);
- rv = report(suite);
+ if (suite == 0) {
+ fputs("No tests selected\n", stderr);
+ } else {
+ rv = report(suite);
+ }
return rv;
}
Copied: logging/log4cxx/trunk/src/test/cpp/abts_tests.h (from r615721, apr/apr/trunk/test/abts_tests.h)
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/abts_tests.h?p2=logging/log4cxx/trunk/src/test/cpp/abts_tests.h&p1=apr/apr/trunk/test/abts_tests.h&r1=615721&r2=616229&rev=616229&view=diff
==============================================================================
--- apr/apr/trunk/test/abts_tests.h (original)
+++ logging/log4cxx/trunk/src/test/cpp/abts_tests.h Tue Jan 29 01:53:50 2008
@@ -20,53 +20,4 @@
#include "abts.h"
#include "testutil.h"
-const struct testlist {
- abts_suite *(*func)(abts_suite *suite);
-} alltests[] = {
- {testatomic},
- {testdir},
- {testdso},
- {testdup},
- {testenv},
- {testfile},
- {testfilecopy},
- {testfileinfo},
- {testflock},
- {testfmt},
- {testfnmatch},
- {testgetopt},
-#if 0 /* not ready yet due to API issues */
- {testglobalmutex},
-#endif
- {testhash},
- {testipsub},
- {testlock},
- {testcond},
- {testlfs},
- {testmmap},
- {testnames},
- {testoc},
- {testpath},
- {testpipe},
- {testpoll},
- {testpool},
- {testproc},
- {testprocmutex},
- {testrand},
- {testsleep},
- {testshm},
- {testsock},
- {testsockets},
- {testsockopt},
- {teststr},
- {teststrnatcmp},
- {testtable},
- {testtemp},
- {testthread},
- {testtime},
- {testud},
- {testuser},
- {testvsn}
-};
-
#endif /* APR_TEST_INCLUDES */
Modified: logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp Tue Jan 29 01:53:50 2008
@@ -48,5 +48,5 @@
};
-LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(TestCase1)
+LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TestCase1)
Modified: logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp Tue Jan 29 01:53:50 2008
@@ -56,6 +56,6 @@
};
-LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(TestCase2)
+LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TestCase2)
Modified: logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp Tue Jan 29 01:53:50 2008
@@ -52,4 +52,4 @@
};
-LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(TestCase3)
+LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TestCase3)
Modified: logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp Tue Jan 29 01:53:50 2008
@@ -57,5 +57,5 @@
};
-LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(TestCase4)
+LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TestCase4)
Modified: logging/log4cxx/trunk/src/test/cpp/logunit.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/logunit.cpp?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/logunit.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/logunit.cpp Tue Jan 29 01:53:50 2008
@@ -17,3 +17,212 @@
#include "logunit.h"
+#include <apr_general.h>
+
+extern "C" {
+void initialize() {
+ apr_initialize();
+}
+
+extern const char** testlist;
+
+bool suite_sort(const LogUnit::SuiteList::value_type& lhs, const LogUnit::SuiteList::value_type& rhs) {
+ return lhs.first < rhs.first;
+}
+
+abts_suite* abts_run_suites(abts_suite* suite) {
+ LogUnit::SuiteList sorted(LogUnit::getAllSuites());
+ std::sort(sorted.begin(), sorted.end(), suite_sort);
+
+ for(LogUnit::SuiteList::const_iterator iter = sorted.begin();
+ iter != sorted.end();
+ iter++) {
+ //
+ // if there is an explicit testlist or if the suite is not by default disabled
+ // pump suite through filter
+ if(testlist || !iter->second->isDisabled()) {
+ suite = iter->second->run(suite);
+ }
+ }
+ apr_terminate();
+ return suite;
+}
+}
+
+using namespace LogUnit;
+
+
+TestException::TestException() {}
+TestException::TestException(const TestException& src) : std::exception(src) {
+}
+
+TestException& TestException::operator=(const TestException& src) {
+ std::exception::operator=(src);
+ return *this;
+}
+
+
+AssertException::AssertException(std::string message, int line) : msg(message), lineno(line) {}
+
+AssertException::AssertException(bool expected, const char* actualExpr, int line) : msg(actualExpr), lineno(line) {
+ if (expected) {
+ msg.append(" was expected to be true, was false.");
+ } else {
+ msg.append(" was expected to be true, was false.");
+ }
+}
+
+AssertException::AssertException(const AssertException& src)
+ : std::exception(src),
+ msg(src.msg),
+ lineno(src.lineno) {
+}
+
+AssertException::~AssertException() throw() {
+}
+
+AssertException& AssertException::operator=(const AssertException& src) {
+ std::exception::operator=(src);
+ msg = src.msg;
+ lineno = src.lineno;
+ return *this;
+}
+
+std::string AssertException::getMessage() const {
+ return msg;
+}
+
+int AssertException::getLine() const {
+ return lineno;
+}
+
+
+
+
+TestFixture::TestFixture() : tc(0) {}
+TestFixture::~TestFixture() {}
+void TestFixture::setCase(abts_case* tc) {
+ this->tc = tc;
+}
+void TestFixture::setUp() {}
+void TestFixture::tearDown() {}
+
+void TestFixture::assertEquals(const std::string expected,
+ const std::string actual,
+ const char* expectedExpr,
+ const char* actualExpr,
+ int lineno) {
+ abts_str_equal(tc, expected.c_str(), actual.c_str(), lineno);
+ if (expected != actual) {
+ throw TestException();
+ }
+}
+
+#if LOG4CXX_LOGCHAR_IS_WCHAR || LOG4CXX_WCHAR_T_API
+void TestFixture::assertEquals(const std::wstring expected,
+ const std::wstring actual,
+ const char* expectedExpr,
+ const char* actualExpr,
+ int lineno) {
+ if (expected != actual) {
+ std::string exp;
+ std::string act;
+ for(std::wstring::const_iterator iter = expected.begin();
+ iter != expected.end();
+ iter++) {
+ if (*iter <= 0x7F) {
+ exp.append(1, (char) *iter);
+ } else {
+ exp.append(1, '?');
+ }
+ }
+ for(std::wstring::const_iterator iter = actual.begin();
+ iter != actual.end();
+ iter++) {
+ if (*iter <= 0x7F) {
+ act.append(1, (char) *iter);
+ } else {
+ act.append(1, '?');
+ }
+ }
+ abts_str_equal(tc, exp.c_str(), act.c_str(), lineno);
+ throw TestException();
+ }
+}
+#endif
+#if LOG4CXX_LOGCHAR_IS_UNICHAR || LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
+void TestFixture::assertEquals(const std::basic_string<UniChar> expected,
+ const std::basic_string<UniChar> actual,
+ const char* expectedExpr,
+ const char* actualExpr,
+int lineno) {
+ if (expected != actual) {
+ std::string exp;
+ std::string act;
+ for(std::basic_string<UniChar>::const_iterator iter = expected.begin();
+ iter != expected.end();
+ iter++) {
+ if (*iter <= 0x7F) {
+ exp.append(1, (char) *iter);
+ } else {
+ exp.append(1, '?');
+ }
+ }
+ for(std::basic_string<UniChar>::const_iterator iter = actual.begin();
+ iter != actual.end();
+ iter++) {
+ if (*iter <= 0x7F) {
+ act.append(1, (char) *iter);
+ } else {
+ act.append(1, '?');
+ }
+ }
+ abts_str_equal(tc, exp.c_str(), act.c_str(), lineno);
+ throw TestException();
+ }
+}
+#endif
+
+
+void TestFixture::assertEquals(const int expected, const int actual, int lineno) {
+ abts_int_equal(tc, expected, actual, lineno);
+ if (expected != actual) {
+ throw TestException();
+ }
+}
+
+
+LogUnit::TestSuite::TestSuite(const char* fname) : filename(fname), disabled(false) {}
+
+void LogUnit::TestSuite::addTest(const char*, test_func func) {
+ test_funcs.push_back(func);
+}
+
+const char* LogUnit::TestSuite::getName() const {
+ return filename;
+}
+
+void LogUnit::TestSuite::setDisabled(bool newVal) {
+ disabled = newVal;
+}
+
+bool LogUnit::TestSuite::isDisabled() const {
+ return disabled;
+}
+
+abts_suite* TestSuite::run(abts_suite* suite) const {
+ suite = abts_add_suite(suite, filename);
+ for(TestList::const_iterator iter = test_funcs.begin();
+ iter != test_funcs.end();
+ iter++) {
+ abts_run_test(suite, *iter, NULL);
+ }
+ return suite;
+}
+
+
+LogUnit::SuiteList& LogUnit::getAllSuites() {
+ static LogUnit::SuiteList allSuites;
+ return allSuites;
+}
+
Modified: logging/log4cxx/trunk/src/test/cpp/logunit.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/logunit.h?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/logunit.h (original)
+++ logging/log4cxx/trunk/src/test/cpp/logunit.h Tue Jan 29 01:53:50 2008
@@ -18,18 +18,202 @@
#if !defined(_LOG4CXX_LOGUNIT_H)
#define _LOG4CXX_LOGUNIT_H
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include "abts.h"
+#include <exception>
+#include <map>
+#include <string>
+#include <vector>
+#include <log4cxx/logstring.h>
-#define LOGUNIT_TEST_SUITE(x) CPPUNIT_TEST_SUITE(x)
-#define LOGUNIT_TEST(x) CPPUNIT_TEST(x)
-#define LOGUNIT_TEST_SUITE_END(x) CPPUNIT_TEST_SUITE_END(x)
-#define LOGUNIT_ASSERT(x) CPPUNIT_ASSERT(x)
-#define LOGUNIT_ASSERT_EQUAL(x, y) CPPUNIT_ASSERT_EQUAL(x, y)
-#define LOGUNIT_CLASS(x) class x : public CppUnit::TestFixture
-#define LOGUNIT_TEST_SUITE_REGISTRATION(x) CPPUNIT_TEST_SUITE_REGISTRATION(x)
-#define LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(x) CPPUNIT_NS::Test* create ## x () { return x :: suite(); }
-#define LOGUNIT_FAIL(msg) CPPUNIT_FAIL(msg)
-#define LOGUNIT_TEST_EXCEPTION(t, x) CPPUNIT_TEST_EXCEPTION(t, x)
+namespace LogUnit {
+ class TestException : public std::exception {
+ public:
+ TestException();
+ TestException(const TestException&);
+ TestException& operator=(const TestException&);
+ };
+ class AssertException : public std::exception {
+ public:
+ AssertException(std::string msg, int lineno);
+ AssertException(bool expected, const char* actualExpr, int lineno);
+ AssertException(const AssertException&);
+ AssertException& operator=(const AssertException&);
+ virtual ~AssertException() throw();
+ std::string getMessage() const;
+ int getLine() const;
+ private:
+ std::string msg;
+ int lineno;
+ };
+ class TestFixture {
+ public:
+ TestFixture();
+ virtual ~TestFixture();
+ void setCase(abts_case* tc);
+ virtual void setUp();
+ virtual void tearDown();
+
+ void assertEquals(const int expected, const int actual, int lineno);
+ void assertEquals(const std::string expected,
+ const std::string actual,
+ const char* expectedExpr,
+ const char* actualExpr,
+ int lineno);
+#if LOG4CXX_LOGCHAR_IS_WCHAR || LOG4CXX_WCHAR_T_API
+ void assertEquals(const std::wstring expected,
+ const std::wstring actual,
+ const char* expectedExpr,
+ const char* actualExpr,
+ int lineno);
+#endif
+#if LOG4CXX_LOGCHAR_IS_UNICHAR || LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
+ void assertEquals(const std::basic_string<UniChar> expected,
+ const std::basic_string<UniChar> actual,
+ const char* expectedExpr,
+ const char* actualExpr, int lineno);
+#endif
+ template<class T>
+ void assertEquals(const T& expected,
+ const T& actual,
+ const char* expectedExpr,
+ const char* actualExpr,
+ int lineno) {
+ if (expected != actual) {
+ std::string msg(expectedExpr);
+ msg.append(" != ");
+ msg.append(actualExpr);
+ abts_fail(tc, msg.c_str(), lineno);
+ }
+ }
+ private:
+ TestFixture(const TestFixture&);
+ TestFixture& operator=(const TestFixture&);
+ abts_case* tc;
+ };
+ template<class T>
+ void runTest(abts_case* tc, void (T::*func)()) {
+ T ti;
+ ti.setCase(tc);
+ ti.setUp();
+ try {
+ (ti.*func)();
+ } catch(TestException&) {
+ } catch(AssertException& fx) {
+ abts_fail(tc, fx.getMessage().c_str(), fx.getLine());
+ } catch(...) {
+ abts_fail(tc, "Unexpected exception", -1);
+ }
+ ti.tearDown();
+ }
+ template<class T, class X>
+ void runTestWithException(abts_case* tc, void (T::*func)()) {
+ T ti;
+ ti.setCase(tc);
+ ti.setUp();
+ try {
+ (ti.*func)();
+ } catch(TestException&) {
+ } catch(AssertException& fx) {
+ abts_fail(tc, fx.getMessage().c_str(), fx.getLine());
+ } catch(X&) {
+ } catch(...) {
+ abts_fail(tc, "Unexpected exception", -1);
+ }
+ ti.tearDown();
+ }
+ class TestSuite {
+ public:
+ TestSuite(const char* filename);
+ void addTest(const char* testName, test_func func);
+ abts_suite* run(abts_suite* suite) const;
+ const char* getName() const;
+ void setDisabled(bool newVal);
+ bool isDisabled() const;
+ private:
+ TestSuite(const TestSuite&);
+ TestSuite& operator=(const TestSuite&);
+ typedef std::vector<test_func> TestList;
+ TestList test_funcs;
+ const char* filename;
+ bool disabled;
+ };
+ typedef std::vector< std::pair<std::string, const TestSuite*> > SuiteList;
+ SuiteList& getAllSuites();
+ template<class T>
+ class RegisterSuite {
+ public:
+ RegisterSuite() {
+ T::populateSuite();
+ TestSuite* suite = T::getSuite();
+ LogUnit::getAllSuites().push_back(SuiteList::value_type(suite->getName(), suite));
+ }
+ };
+ template<class T>
+ class RegisterDisabledSuite {
+ public:
+ RegisterDisabledSuite() {
+ T::populateSuite();
+ TestSuite* suite = T::getSuite();
+ suite->setDisabled(true);
+ LogUnit::getAllSuites().push_back(SuiteList::value_type(suite->getName(), suite));
+ }
+ };
+}
+
+#define LOGUNIT_CLASS(x) class x : public LogUnit::TestFixture
+
+
+#define LOGUNIT_TEST_SUITE(TF) \
+public: \
+ static LogUnit::TestSuite* getSuite() { \
+ static LogUnit::TestSuite suite(__FILE__); \
+ return &suite; \
+ } \
+ private: \
+ class RegisterSuite { \
+ public: \
+ typedef TF ThisFixture;
+
+#define LOGUNIT_TEST(testName) \
+ class testName ## Registration { \
+ public: \
+ testName ## Registration() { \
+ ThisFixture::getSuite()->addTest(#testName, &testName ## Registration :: run); \
+ } \
+ static void run(abts_case* tc, void*) { \
+ LogUnit::runTest<ThisFixture>(tc, &ThisFixture::testName); \
+ } \
+ } register ## testName;
+
+#define LOGUNIT_TEST_EXCEPTION(testName, Exception) \
+ class testName ## Registration { \
+ public: \
+ testName ## Registration() { \
+ ThisFixture::getSuite()->addTest(#testName, &testName ## Registration :: run); \
+ } \
+ static void run(abts_case* tc, void*) { \
+ LogUnit::runTestWithException<ThisFixture, Exception>(tc, &ThisFixture::testName); \
+ } \
+ } register ## testName;
+
+
+#define LOGUNIT_TEST_SUITE_END(TF) \
+ }; \
+ public: \
+ static void populateSuite() { \
+ static RegisterSuite registration; \
+ }
+
+
+#define LOGUNIT_TEST_SUITE_REGISTRATION(TF) \
+static LogUnit::RegisterSuite<TF> registration;
+
+#define LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TF) \
+static LogUnit::RegisterDisabledSuite<TF> registration;
+
+
+#define LOGUNIT_ASSERT(x) { if (!(x)) throw LogUnit::AssertException(true, #x, __LINE__); }
+#define LOGUNIT_ASSERT_EQUAL(expected, actual) assertEquals(expected, actual, #expected, #actual, __LINE__)
+#define LOGUNIT_FAIL(msg) throw LogUnit::AssertException(msg, __LINE__)
#endif
Modified: logging/log4cxx/trunk/src/test/cpp/net/socketservertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/net/socketservertestcase.cpp?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/net/socketservertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/net/socketservertestcase.cpp Tue Jan 29 01:53:50 2008
@@ -478,4 +478,4 @@
const File SocketServerTestCase::TEMP("output/temp");
const File SocketServerTestCase::FILTERED("output/filtered");
-LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(SocketServerTestCase)
+LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(SocketServerTestCase)
Copied: logging/log4cxx/trunk/src/test/cpp/testutil.h (from r615721, apr/apr/trunk/test/testutil.h)
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/testutil.h?p2=logging/log4cxx/trunk/src/test/cpp/testutil.h&p1=apr/apr/trunk/test/testutil.h&r1=615721&r2=616229&rev=616229&view=diff
==============================================================================
--- apr/apr/trunk/test/testutil.h (original)
+++ logging/log4cxx/trunk/src/test/cpp/testutil.h Tue Jan 29 01:53:50 2008
@@ -14,93 +14,15 @@
* limitations under the License.
*/
-#include "apr_pools.h"
-#include "apr_general.h"
#include "abts.h"
#ifndef APR_TEST_UTIL
#define APR_TEST_UTIL
-/* XXX: FIXME - these all should become much more utilitarian
- * and part of apr, itself
- */
-#ifdef WIN32
-#ifdef BINPATH
-#define TESTBINPATH APR_STRINGIFY(BINPATH) "/"
-#else
-#define TESTBINPATH ""
-#endif
-#else
-#define TESTBINPATH "./"
-#endif
-
-#ifdef WIN32
-#define EXTENSION ".exe"
-#elif NETWARE
-#define EXTENSION ".nlm"
-#else
-#define EXTENSION
-#endif
-
-#define STRING_MAX 8096
-
-/* Some simple functions to make the test apps easier to write and
- * a bit more consistent...
- */
-
-extern apr_pool_t *p;
-
-/* Assert that RV is an APR_SUCCESS value; else fail giving strerror
- * for RV and CONTEXT message. */
-void apr_assert_success(abts_case* tc, const char *context,
- apr_status_t rv, int lineno);
-#define APR_ASSERT_SUCCESS(tc, ctxt, rv) \
- apr_assert_success(tc, ctxt, rv, __LINE__)
void initialize(void);
+abts_suite* abts_run_suites(abts_suite*);
-abts_suite *testatomic(abts_suite *suite);
-abts_suite *testdir(abts_suite *suite);
-abts_suite *testdso(abts_suite *suite);
-abts_suite *testdup(abts_suite *suite);
-abts_suite *testenv(abts_suite *suite);
-abts_suite *testfile(abts_suite *suite);
-abts_suite *testfilecopy(abts_suite *suite);
-abts_suite *testfileinfo(abts_suite *suite);
-abts_suite *testflock(abts_suite *suite);
-abts_suite *testfmt(abts_suite *suite);
-abts_suite *testfnmatch(abts_suite *suite);
-abts_suite *testgetopt(abts_suite *suite);
-abts_suite *testglobalmutex(abts_suite *suite);
-abts_suite *testhash(abts_suite *suite);
-abts_suite *testipsub(abts_suite *suite);
-abts_suite *testlock(abts_suite *suite);
-abts_suite *testcond(abts_suite *suite);
-abts_suite *testlfs(abts_suite *suite);
-abts_suite *testmmap(abts_suite *suite);
-abts_suite *testnames(abts_suite *suite);
-abts_suite *testoc(abts_suite *suite);
-abts_suite *testpath(abts_suite *suite);
-abts_suite *testpipe(abts_suite *suite);
-abts_suite *testpoll(abts_suite *suite);
-abts_suite *testpool(abts_suite *suite);
-abts_suite *testproc(abts_suite *suite);
-abts_suite *testprocmutex(abts_suite *suite);
-abts_suite *testrand(abts_suite *suite);
-abts_suite *testsleep(abts_suite *suite);
-abts_suite *testshm(abts_suite *suite);
-abts_suite *testsock(abts_suite *suite);
-abts_suite *testsockets(abts_suite *suite);
-abts_suite *testsockopt(abts_suite *suite);
-abts_suite *teststr(abts_suite *suite);
-abts_suite *teststrnatcmp(abts_suite *suite);
-abts_suite *testtable(abts_suite *suite);
-abts_suite *testtemp(abts_suite *suite);
-abts_suite *testthread(abts_suite *suite);
-abts_suite *testtime(abts_suite *suite);
-abts_suite *testud(abts_suite *suite);
-abts_suite *testuser(abts_suite *suite);
-abts_suite *testvsn(abts_suite *suite);
#endif /* APR_TEST_INCLUDES */
Modified: logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp Tue Jan 29 01:53:50 2008
@@ -149,7 +149,7 @@
apr_xml_parser* parser = apr_xml_parser_create(apr_pool);
LOGUNIT_ASSERT(parser != 0);
apr_status_t stat = apr_xml_parser_feed(parser, buf.data(), buf.remaining());
- LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT(stat == APR_SUCCESS);
apr_xml_doc* doc = 0;
stat = apr_xml_parser_done(parser, &doc);
LOGUNIT_ASSERT(doc != 0);
Modified: logging/log4cxx/trunk/src/test/resources/Makefile.am
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/resources/Makefile.am?rev=616229&r1=616228&r2=616229&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/resources/Makefile.am (original)
+++ logging/log4cxx/trunk/src/test/resources/Makefile.am Tue Jan 29 01:53:50 2008
@@ -16,7 +16,7 @@
SUBDIRS = input witness
EXTRA_DIST = L7D_en_US.properties L7D_fr_CH.properties L7D_fr.properties
-if TESTS
+
# if we are building in a separate build tree, then copy all necessary files
all-local:
@@ -37,11 +37,11 @@
build: check-recursive prepare
cleanOutputDir:
- @rm -f output/*
+ @rm -rf output/*
check: prepare run-unittest
-run-unittest: cleanOutputDir
+run-unittest: build cleanOutputDir
@export TOTO=wonderful; \
export key1=value1; \
export key2=value2; \
@@ -127,4 +127,3 @@
L7d: build cleanOutputDir
../cpp/testsuite L7dTestCase
-endif