Author: mahadev
Date: Thu Apr  2 21:28:27 2009
New Revision: 761433

URL: http://svn.apache.org/viewvc?rev=761433&view=rev
Log:
ZOOKEEPER-60. Get cppunit tests running as part of Hudson CI. (girish via 
mahadev)

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/build.xml
    hadoop/zookeeper/trunk/src/c/Makefile.am
    hadoop/zookeeper/trunk/src/c/configure.ac
    hadoop/zookeeper/trunk/src/c/tests/LibCSymTable.h
    hadoop/zookeeper/trunk/src/c/tests/TestClient.cc
    hadoop/zookeeper/trunk/src/c/tests/zkServer.sh

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=761433&r1=761432&r2=761433&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Apr  2 21:28:27 2009
@@ -64,6 +64,9 @@
   ZOOKEEPER-305.  Replace timers with semaphores in FLENewEpochTest.
 (flavio via mahadev)
 
+  ZOOKEEPER-60. Get cppunit tests running as part of Hudson CI. (girish via
+mahadev)
+
 NEW FEATURES:
 
 

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=761433&r1=761432&r2=761433&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Thu Apr  2 21:28:27 2009
@@ -55,6 +55,7 @@
     <property name="test.log.dir" value="${test.build.dir}/logs" />
     <property name="test.data.dir" value="${test.build.dir}/data" />
     <property name="test.data.upgrade.dir" value="${test.data.dir}/upgrade" />
+    <property name="test.cppunit.dir" value="${test.build.dir}/test-cppunit"/>
     <property name="test.tmp.dir" value="${test.build.dir}/tmp" />
     <property name="test.output" value="no" />
     <property name="test.timeout" value="900000" />
@@ -572,7 +573,43 @@
         <fail if="tests.failed">Tests failed!</fail>
     </target>
 
+    <target name="create-cppunit-configure" depends="init" if="cppunit">
+       <exec executable="autoreconf" dir="${c.src.dir}" searchpath="yes" 
+               failonerror="yes">
+                       <arg value="-if"/>
+       </exec>
+    </target>  
 
+    <target name="check-cppunit-makefile" depends="init" >
+       <condition property="need.cppunit.makefile">
+                       <not> <available file="${test.cppunit.dir}/Makefile"/> 
</not>
+       </condition>
+    </target>
+
+    <target name="create-cppunit-makefile" depends="check-cppunit-makefile" 
+                                           if="need.cppunit.makefile">
+       <mkdir dir="${test.cppunit.dir}"/>
+       <exec executable="${c.src.dir}/configure" dir="${test.cppunit.dir}"
+               failonerror="yes">
+                <env key="base_dir" value="${basedir}"/>
+                <env key="CALLER" value="ANT"/>
+               <arg value="--prefix=${test.cppunit.dir}"/>
+       </exec>
+    </target>
+
+    <target name="test-cppunit" depends="compile_jute, jar, 
create-cppunit-makefile" if="cppunit" 
+               description="to run cppunit test cases">
+        <property name="fuser.bin" value="/sbin"/>
+        <property name="lib.cppunit" value="/usr/local/lib"/>
+       <exec dir="${test.cppunit.dir}" executable="make">
+               <env key="LD_LIBRARY_PATH" value="${lib.cppunit}"/>
+               <env key="PATH" path="${env.PATH};${c.src.dir};${fuser.bin};"/>
+                <env key="CALLER" value="ANT"/>
+                <env key="base_dir" value="${basedir}"/>
+               <arg line="clean run-check"/>
+       </exec>
+    </target>
+   
     <target name="test-unit-category">
       <property name="test.category" value="Unit"/>
     </target>

Modified: hadoop/zookeeper/trunk/src/c/Makefile.am
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/Makefile.am?rev=761433&r1=761432&r2=761433&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/Makefile.am (original)
+++ hadoop/zookeeper/trunk/src/c/Makefile.am Thu Apr  2 21:28:27 2009
@@ -1,7 +1,7 @@
 # need this for Doxygen integration
 include $(top_srcdir)/aminclude.am
 
-AM_CPPFLAGS = -Iinclude -Igenerated
+AM_CPPFLAGS = -I${srcdir}/include -I${srcdir}/tests -I${srcdir}/generated
 AM_CFLAGS = -Wall -Werror 
 CXXFLAGS = -Wall -g
 
@@ -65,8 +65,8 @@
 #########################################################################
 # build and run unit tests
 
-EXTRA_DIST+=$(wildcard tests/*.cc) $(wildcard tests/*.h) \
-    tests/wrappers.opt tests/wrappers-mt.opt
+EXTRA_DIST+=$(wildcard ${srcdir}/tests/*.cc) $(wildcard ${srcdir}/tests/*.h) \
+    ${srcdir}/tests/wrappers.opt ${srcdir}/tests/wrappers-mt.opt
 
 TEST_SOURCES = tests/TestDriver.cc tests/LibCMocks.cc tests/LibCSymTable.cc \
     tests/MocksBase.cc  tests/ZKMocks.cc tests/Util.cc tests/ThreadingUtil.cc \
@@ -74,7 +74,7 @@
     tests/TestOperations.cc tests/TestZookeeperInit.cc \
     tests/TestZookeeperClose.cc tests/TestClient.cc
 
-SYMBOL_WRAPPERS=$(shell cat tests/wrappers.opt)
+SYMBOL_WRAPPERS=$(shell cat ${srcdir}/tests/wrappers.opt)
 
 check_PROGRAMS = zktest-st
 nodist_zktest_st_SOURCES = $(TEST_SOURCES)
@@ -87,7 +87,7 @@
   nodist_zktest_mt_SOURCES = $(TEST_SOURCES) tests/PthreadMocks.cc
   zktest_mt_LDADD = libzkmt.la libhashtable.la -lpthread $(CPPUNIT_LIBS)
   zktest_mt_CXXFLAGS = -DUSE_STATIC_LIB -DTHREADED $(CPPUNIT_CFLAGS)
-  SYMBOL_WRAPPERS_MT=$(SYMBOL_WRAPPERS) $(shell cat tests/wrappers-mt.opt)
+  SYMBOL_WRAPPERS_MT=$(SYMBOL_WRAPPERS) $(shell cat 
${srcdir}/tests/wrappers-mt.opt)
   zktest_mt_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS_MT)
 endif
 

Modified: hadoop/zookeeper/trunk/src/c/configure.ac
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/configure.ac?rev=761433&r1=761432&r2=761433&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/configure.ac (original)
+++ hadoop/zookeeper/trunk/src/c/configure.ac Thu Apr  2 21:28:27 2009
@@ -5,9 +5,6 @@
 
 AC_INIT([zookeeper C 
client],3.2.0,[zookeeper-u...@hadoop.apache.org],[c-client-src])
 AC_CONFIG_SRCDIR([src/zookeeper.c])
-AC_CHECK_FILES([generated/zookeeper.jute.c generated/zookeeper.jute.h],[],
-    [AC_MSG_ERROR([jute files are missing! Please run "ant compile_jute" while 
in the zookeeper top level directory.])
-])
 
 # initialize Doxygen support
 DX_HTML_FEATURE(ON)
@@ -36,6 +33,16 @@
    AM_PATH_CPPUNIT(1.10.2)
 fi
 
+if test "$CALLER" = "ANT" ; then
+CPPUNIT_CFLAGS="-DZKSERVER_CMD=\"\\\"${base_dir}/src/c/tests/zkServer.sh\\\"\""
+else
+CPPUNIT_CFLAGS="-DZKSERVER_CMD=\"\\\"./tests/zkServer.sh\\\"\""
+AC_CHECK_FILES([generated/zookeeper.jute.c generated/zookeeper.jute.h],[],
+    [AC_MSG_ERROR([jute files are missing! Please run "ant compile_jute" while 
in the zookeeper top level directory.])
+])
+fi
+AC_SUBST(CPPUNIT_CFLAGS)
+
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX

Modified: hadoop/zookeeper/trunk/src/c/tests/LibCSymTable.h
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/LibCSymTable.h?rev=761433&r1=761432&r2=761433&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/LibCSymTable.h (original)
+++ hadoop/zookeeper/trunk/src/c/tests/LibCSymTable.h Thu Apr  2 21:28:27 2009
@@ -31,7 +31,7 @@
 #include <pthread.h>
 #endif
 
-#include "../config.h"
+#include "config.h"
 
 // TODO: move all these macros to config.h (generated by autoconf) 
 #ifdef __CYGWIN__

Modified: hadoop/zookeeper/trunk/src/c/tests/TestClient.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestClient.cc?rev=761433&r1=761432&r2=761433&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/TestClient.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestClient.cc Thu Apr  2 21:28:27 2009
@@ -197,7 +197,6 @@
     
 public:
 
-#define ZKSERVER_CMD "./tests/zkServer.sh"
 
     void setUp()
     {

Modified: hadoop/zookeeper/trunk/src/c/tests/zkServer.sh
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/zkServer.sh?rev=761433&r1=761432&r2=761433&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/zkServer.sh (original)
+++ hadoop/zookeeper/trunk/src/c/tests/zkServer.sh Thu Apr  2 21:28:27 2009
@@ -16,7 +16,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 if [ "x$1" == "x" ]
 then
        echo "USAGE: $0 startClean|start|stop hostPorts"
@@ -34,8 +33,13 @@
 case $1 in
 start|startClean)
        mkdir -p /tmp/zkdata
-       java -cp 
../../zookeeper-dev.jar:../../src/java/lib/log4j-1.2.15.jar:../../conf 
org.apache.zookeeper.server.ZooKeeperServerMain 22181 /tmp/zkdata &> 
/tmp/zk.log &
-       sleep 5
+       if [ "x${base_dir}" == "x" ]
+        then
+        java -cp 
../../zookeeper-dev.jar:../../src/java/lib/log4j-1.2.15.jar:../../conf 
org.apache.zookeeper.server.ZooKeeperServerMain 22181 /tmp/zkdata &> 
/tmp/zk.log &
+        else
+        java -cp 
${base_dir}/zookeeper-dev.jar:${base_dir}/src/java/lib/log4j-1.2.15.jar:${base_dir}/conf
 org.apache.zookeeper.server.ZooKeeperServerMain 22181 /tmp/zkdata &> 
/tmp/zk.log &
+       fi
+        sleep 5
        ;;
 stop)
        # Already killed above


Reply via email to