Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

C client unit test failure

Compiling c client
(35 lines)
Aug 7, 2010
Michi Mutsuzaki
Michi Mutsuzaki
Hello,

I'm having 2 issues while compiling/running c client unit test in
branch-3.3.

1. I get this error from "make check":

   g++: unrecognized option `-static-libtool-libs'
   
2. testAsyncWatcherAutoReset is not working for me.

Zookeeper_simpleSystem::testAsyncWatcherAutoResetterminate called after
throwing an instance of 'CppUnit::Exception'  what():  equality assertion
failed- Expected: -101- Actual  : -4

Let me know if anybody has seen these errors.

Thanks!
--Michi



Reply
Tags: workingtestasyncwatcherautoreset
Messages in this thread
C client unit test failure
reply Re: C client unit test failure
(33 lines) Aug 8, 2010 01:58
reply Re: C client unit test failure
(54 lines) Aug 9, 2010 13:28
reply Re: C client unit test failure
(69 lines) Aug 12, 2010 03:40
reply Re: C client unit test failure
(80 lines) Aug 12, 2010 11:43
reply Re: C client unit test failure
(91 lines) Aug 12, 2010 12:04
Similar Threads
unit test failure
Hi,

I am attempting to build the C client on debian lenny.

autoconf, configure, make and make install all appear to work cleanly.

I ran:

autoreconf -if
./configure
make
make install
make run-check

However, the unit tests fail:

$ make run-check
make  zktest-st zktest-mt
make[1]: Entering directory `/home/martin/zookeeper-3.3.1/src/c'
make[1]: `zktest-st' is up to date.
make[1]: `zktest-mt' is up to date.
make[1]: Leaving directory `/home/martin/zookeeper-3.3.1/src/c'
./zktest-st
./tests/zkServer.sh: line 52: kill: (17711) - No such process
 ZooKeeper server startedRunning
Zookeeper_operations::testPing : elapsed 1 : OK
Zookeeper_operations::testTimeoutCausedByWatches1 : elapsed 0 : OK
Zookeeper_operations::testTimeoutCausedByWatches2 : elapsed 0 : OK
Zookeeper_operations::testOperationsAndDisconnectConcurrently1 : elapsed 2
:
OK
Zookeeper_operations::testOperationsAndDisconnectConcurrently2 : elapsed 0
:
OK
Zookeeper_operations::testConcurrentOperations1 : elapsed 206 : OK
Zookeeper_init::testBasic : elapsed 0 : OK
Zookeeper_init::testAddressResolution : elapsed 0 : OK
Zookeeper_init::testMultipleAddressResolution : elapsed 0 : OK
Zookeeper_init::testNullAddressString : elapsed 0 : OK
Zookeeper_init::testEmptyAddressString : elapsed 0 : OK
Zookeeper_init::testOneSpaceAddressString : elapsed 0 : OK
Zookeeper_init::testTwoSpacesAddressString : elapsed 0 : OK
Zookeeper_init::testInvalidAddressString1 : elapsed 0 : OK
Zookeeper_init::testInvalidAddressString2 : elapsed 2 : OK
Zookeeper_init::testNonexistentHost : elapsed 108 : OK
Zookeeper_init::testOutOfMemory_init : elapsed 0 : OK
Zookeeper_init::testOutOfMemory_getaddrs1 : elapsed 0 : OK
Zookeeper_init::testOutOfMemory_getaddrs2 : elapsed 0 : OK
Zookeeper_init::testPermuteAddrsList : elapsed 0 : OK
Zookeeper_close::testCloseUnconnected : elapsed 0 : OK
Zookeeper_close::testCloseUnconnected1 : elapsed 0 : OK
Zookeeper_close::testCloseConnected1 : elapsed 0 : OK
Zookeeper_close::testCloseFromWatcher1 : elapsed 0 : OK
Zookeeper_simpleSystem::testAsyncWatcherAutoResetterminate called after
throwing an instance of 'CppUnit::Exception'
  what():  equality assertion failed
- Expected: -101
- Actual  : -4

make: *** [run-check] Aborted

This appears to come from tests/TestClient.cc - but beyond that, it is
hard
to identify which equality assertion failed.

Help !

regards,
Martin


Ant intergrate with Android Unit Test building
Hi,

 

Ant used by Java web or java application, when building the Unit test.
It can create a .html file to show the result.

      <target name="junit" depends="instrument" description="Junit">

            <!--<junit haltonfailure="no" printsummary="on"
errorProperty="test.failed" failureProperty="test.failed"
fork="true">-->

            <junit printsummary="yes" haltonfailure="no"
fork="true">

                  <sysproperty key="emma.coverage.out.file"
value="${coverage.absolute.dir}/coverage.emma" />

                  <jvmarg
value="-Demma.coverage.out.file=${coverage.absolute.dir}/metadata.emma"
/>

                  <jvmarg value="-Demma.coverage.out.merge=true" />

                  <classpath location="${instrument.absolute.dir}"
/>

                  <classpath
location="${out.test-classes.absolute.dir}"
/>

                  <classpath refid="emma.lib" />

                  <formatter type="xml" />

                  <batchtest todir="${junit.absolute.dir}"
haltonfailure="no">

                        <fileset
dir="${out.test-classes.absolute.dir}">

                             <include name="**/*Test.class" />

                        </fileset>

                  </batchtest>

            </junit>

            <junitreport>

                  <fileset dir="${junit.absolute.dir}">

                        <include name="TEST-*.xml" />

                  </fileset>

                  <report format="frames" todir="${junit.absolute.dir}"
/>

            </junitreport>

            <fail if="test.failed">

                  Tests failed. Check ${junit.absolute.dir}

            </fail>

            <antcall target="checkstyle" />

            <antcall target="findbugs" />

            <antcall target="build_html" />

            <antcall target="pmd" />

            <antcall target="gen-report-coverage" />

      </target>

 

But when building the Android application Unit test, It cannot create
.html or .xml file to show the result, just only the log.

                <macrodef name="run-tests-helper">

                               <attribute name="emma.enabled"
default="false" />

                               <element name="extra-instrument-args"
optional="yes" />

                               <sequential>

                                               <echo>Running tests
...</echo>

                                               <exec
executable="${adb}"
failonerror="true">

                                                               <arg
value="shell" />

                                                               <arg
value="am" />

                                                               <arg
value="instrument" />

                                                               <arg
value="-w" />

                                                               <arg
value="-e" />

                                                               <arg
value="coverage" />

                                                               <arg
value="@{emma.enabled}" />

 
<extra-instrument-args />

                                                               <arg
value="${manifest.package}/${test.runner}" />

                                               </exec>

                               </sequential>

                </macrodef>

 

And I want to know whether building android application can same as jave
web or jave application building? Can create a .html or .xml file to
show the result?

 

 

 

Thank you

Best Regards

Jianmin



Re: Mapper Reducer : Unit Test and mocking with static variables
FYI
I am on Hadoop 0.20.2, JUnit 4


Varene Olivier a écrit :
 Hello to all,
 
 first of all many thanks for this great piece of software you are all
 contributing to :)
 
 I am actually creating a program in Hadoop MapReduce, but I intend to
 massively use JUnit Tests to validate my code.
 
 To test a Mapper, I mock a Mapper.Context object and run the
Mapper.map
 function with it, but inside my Mapper.map function, I am using
Counters 
 to maintain internal statistics. The update of those counters make
the 
 test fails with a null pointer (JavaNullPointerException).
 There is an issue "Counters" of variable visibility from my test ...
 
 Do you have any idea how to mock/validate/overcome this issue ?
 
 
 
 Thanks a lots
 Best Regards
 Olivier Varene
 
 
 : Code :
 --------
 
 private static enum Counters {NBLINES};
 private static IntWritable one = new IntWritable(1);
 private static LongWritable oneL = new LongWritable(1);
 
 
 // Mapper
 /**
  * outputs 1 for each line encountered
  */
 public static class LCMapper extends
     Mapper<LongWritable, Text, IntWritable, LongWritable>
 {
   private final static IntWritable one = new IntWritable(1);
   private final static LongWritable oneL = new LongWritable(1);
   /**
   * for each line encountered outputs 1 for the key 1
   */
   public void map(LongWritable p_key, Text p_inputs, Context
p_context)
     throws IOException, InterruptedException
   {
     p_context.getCounter(Counters.NBLINES).increment(1);
     p_context.write(one,oneL);   
   } // end map
 } // end Mapper
 
 : Test :
 --------
 
 @Test
 public void testLCMapper() throws IOException, InterruptedException
 {   
   LCMapper mapper = new LCMapper();
   Text value = new Text("ligneA\nlignB\n");
   // mock the map job execution context
   Context context = mock(Context.class);
   try {
     mapper.map(null, value, context);
   } catch (NullPointerException e)
   {
     // exception raised by context.getCounter(...) null pointer
     // HOW TO MOCK ???
     // Counter is a static enum from the englobing class ...
     // issue with variable visibility (from map function) in this
test
   }
   // verify that the Mapper issued (one,oneL) pair
   verify(context).write(one,oneL);
        
 } // end testLCMapper
 
 


Created: (CLK-708) Configurable loop count in performance unit test
Configurable loop count in performance unit test

Created: (HDFS-1304) There is no unit test for HftpFileSystem.open(..)
There is no unit test for HftpFileSystem.open(..)

DO NOT REPLY Fix occasional test failure in TestConcurrency
https://issues.apache.org/bugzilla/show_bug.cgi?id=47583

Mark Thomas <mar### @apache.org> changed:

           What    |Removed                     |Added

Created: (MRM-1388) Test failure in ShowArtifactActionTest for certain locales
Test failure in ShowArtifactActionTest for certain locales

Test Failure:mixin nodetype mix:simpleVersionable is missing
Hi,
$subject occurs in simple version test.This test failure says repository
does not support versioning

But I have set the following to true

OPTION_VERSIONING_SUPPORTED = true
OPTION_SIMPLE_VERSIONING_SUPPORTED = true

It will be really great if anyone can help me to solve this problem

Regards
/subash


Created: (DERBY-4760) test failure in derbynet/testProtocol.java with ibm jvms
test failure in derbynet/testProtocol.java with ibm jvms 

Created: (DERBY-4689) Provide a JUnit test option to isolate client from server jars in a separate c
Provide a JUnit test option to isolate client from server jars in a
separate class loader to expose any dependencies that may exist

Simple Unit testing.
Hello,

I have read the tutorial
http://felix.apache.org/site/apache-f...sgi-tutorial.html
but I didn't find it simple at all.

Currently when I run a unit test, in my IDE I can select a single unit
test, a test case or a package and I select Run -> Tests.  If I want to
debug my test, I select Debug -> Tests. 

That's what I call simple.

When I have worked with frameworks in the past, I had to add a few
things in the setUp() and tearDown() or extend a custom abstract
TestCase which did this for me, but after that the unit test ran
normally, in my IDE and in maven.

Has anyone done this with OSGi/iPOJO components?

Regards,
  Peter.


Unit tests + injection
Did a bit of unit test hacking while on the plane last night. Just  
checked in some pretty good early results. We are still bound by JUnit  
3 lifecycle simplicity and have to use static singletons, still I was  
able to build a little framework for dependency injection into the  
test cases, with access to the new DI Cayenne stack. Underneath that  
is an old CayenneResources singleton that loads DB connection,  
generates the schema, etc...

Still the unit test "frontend" is now drastically different (see e.g.  
DataContextEJBQLConditionsTest, one of the few tests that I switched).  
Tests extending DICase (or its subclass - ServerCase) can use @Inject  
annotations to get access to the interesting parts of the stack being  
tested (in 90% of cases that I converted so far this would be  
ObjectContext and DBHelper) in a clean manner that does not obfuscate  
the test purpose. I also replaced Spring/XML data sets with DBHelper.  
So a typical DB-aware test case may look like  
DataContextEJBQLConditionsTest:

@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
public class DataContextEJBQLConditionsTest extends ServerCase {

     @Inject
     protected ObjectContext context;

     @Inject
     protected DBHelper dbHelper;

     protected TableHelper tArtist;

     @Override
     protected void setUpAfterInjection() throws Exception {
         dbHelper.deleteAll("PAINTING_INFO");
         ...
         tArtist = new TableHelper(dbHelper, "ARTIST");
         tArtist.setColumns("ARTIST_ID", "ARTIST_NAME");
         ...
     }

     protected void createDataSetXYZ() throws Exception {
         tArtist.insert(33001, "B");
         tArtist.insert(33002, "A");
         tArtist.insert(33003, "D");

         tPainting.insert(33009, 33001, "X", 5000);
         tPainting.insert(33010, 33001, "Y", 5000);
         tPainting.insert(33011, 33002, "Z", 5000);
     }

     public void testSomething() throws Exception {
         createDataSetXYZ();

         // normal unit test goes here
         ...
     }

It is much cleaner than what we had before at the unit test level at  
the expense of a few trivial DI providers in the DI backend.

In general I feel like the Cayenne DI container is a cool little piece  
of technology that will take us pretty far in many areas of the  
framework. It is still only 36K in size and has simplicity as its main  
design paradigm. The only major feature that it is missing compared to  
the other guys is method interception, and we can add that down the  
road if we feel compelled to have it for Cayenne uses.

Cheers,
Andrus


unit testing jaxrs services
Does CXF provide a mechanism, such as an embedded server, for easily
unit-testing jaxrs services?  I didn't seen anything in the
documentation.

 

Something similar to what RESTEasy provides:
http://docs.jboss.org/resteasy/docs/1...ml_single/index.h
tml#RESTEasy_Embedded_Container

 

Jason



Status about hadoop unit testing.
Hi guys,

I am running hadoop unit testing and trying to fix some failures for a
while. Combining two great projects excites me a lot. Here is my current
status:

Env:
Harmony 6 (requires by hadoop) + linux 32 platform

Using: run-test-core
Whole test cases:  757
Failures: 8
Errors: 25

To get this result, some code need to be changed in hadoop-common [0],
some
jiras should be commited [1] and some modules I borrowed from RI [2].

[0]
a. UserGroupInformation.java should be changed, because hadoop hard coding
the its login module, using com.sun.security things.
b. reduce the failure trying times from 45 to 2. Because junit testcase
will
be timeout if we are trying 45 times. (ri also failed on this)

[1]
a. HARMONY-6529 </jira/browse/HARMONY-6529>. hadoop is required
jdk1.6,
patch available.
b. HARMONY-6561 </jira/browse/HARMONY-6561> Fixed
c. HARMONY-6569 </jira/browse/HARMONY-6569> Fixed
d. HARMONY-6571 </jira/browse/HARMONY-6571> JNDI things
e. HARMONY-6575 </jira/browse/HARMONY-6575> It may be a drlvm, in my
todo
list.
f.  HARMONY-6580 </jira/browse/HARMONY-6580>,
HARMONY-6605</jira/browse/HARMONY-6605>
 Fixed
g. HARMONY-6587 </jira/browse/HARMONY-6587> Fixed
h. HARMONY-6604 </jira/browse/HARMONY-6604> Behavior different
between ri
and harmony

[2]
a. add tools.jar, which in the harmony jdk/lib, in the
bootclasspath.properties. Ant try to find the com.sun.tools.javac.Main to
determine whether JAVA_HOME is point to a jre or a jdk. This jar is not
from
ri, but we may need to change our layout a little bit.
b. add ecj.jar to the $ANT_HOME/lib or add it in the
bootclasspath.properties.
c. javax.annotation.processing, javax.lang.model, javax.tools, these
package
borrow from RI, which is missing in harmony java6.
d. sun.security.krb5, this package borrow from RI. Do we have couterpart
in
harmony? I have not found one.
e. sun.misc.HexDumpEncoder, this borrow from RI. Missing in harmony java6.
f.  sun.reflect.ReflectionFactory, this borrow from RI. Missing in harmony
java6. [3]
g.
sun/misc/Unsafe.defineClass(Ljava/lang/String;[BIILjava/lang/ClassLoader;Ljava/security/ProtectionDomain;)Ljava/lang/Class;
This method is not defined in our Unsafe. [3]
h. javadoc and doclet package is borrowed from RI. Missing in harmony
java6.
Is is one of our GSoC now?

[3]
f and g in [2] is raised from a popular project: mockito. Mockito is using
another project: objenesis. Now g is at the top of my todo list.




Created: (DERBY-4709) Create test that parse client trace file to detect round-trips for Derby-4653
Create test that parse client trace file to detect round-trips for
Derby-4653