hoijui / JavaOSC

OSC content format/"protocol" library for JVM languages
http://www.illposed.com/software/javaosc.html
BSD 3-Clause "New" or "Revised" License
157 stars 44 forks source link

Test failures on OSX 10.10.1 / Java 1.8.0_40-ea #18

Closed xpe closed 7 years ago

xpe commented 9 years ago

My environment is a Mac running OSX 10.10.1 with Java 1.8.

java version "1.8.0_40-ea"
Java(TM) SE Runtime Environment (build 1.8.0_40-ea-b19)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b23, mixed mode)

Running mvn test, as of commit 9d26e1f240db75c2bd8e9154187a4361faa0703f, gives these results:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.illposed.osc.OSCBundleTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec - in com.illposed.osc.OSCBundleTest
Running com.illposed.osc.OSCMessageTest
Tests run: 36, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.019 sec <<< FAILURE! - in com.illposed.osc.OSCMessageTest
testArgumentTimestampAfterFeb2036(com.illposed.osc.OSCMessageTest)  Time elapsed: 0.002 sec  <<< FAILURE!
java.lang.AssertionError: Failed to convert correctly at position: 30
 result (str): "/timestampAfterFeb2036,t�WP"
 answer (str): "/timestampAfterFeb2036,t��"
 result (raw): "{ 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 65, 102, 116, 101, 114, 70, 101, 98, 50, 48, 51, 54, 0, 0, 44, 116, 0, 0, 1, -80, 87, 80, 0, 0, 0, 0 };"
 answer (raw): "{ 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 65, 102, 116, 101, 114, 70, 101, 98, 50, 48, 51, 54, 0, 0, 44, 116, 0, 0, 1, -80, 2, -16, 0, 0, 0, 0 };"
    at org.junit.Assert.fail(Assert.java:88)
    at com.illposed.osc.OSCMessageTest.checkResultEqualsAnswer(OSCMessageTest.java:45)
    at com.illposed.osc.OSCMessageTest.testArgumentTimestampAfterFeb2036(OSCMessageTest.java:236)

testArgumentTimestamp2000(com.illposed.osc.OSCMessageTest)  Time elapsed: 0 sec  <<< FAILURE!
java.lang.AssertionError: Failed to convert correctly at position: 22
 result (str): "/timestamp2000,t���"
 answer (str): "/timestamp2000,t�bp"
 result (raw): "{ 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 50, 48, 48, 48, 0, 0, 44, 116, 0, 0, -68, 22, -74, -48, 0, 0, 0, 0 };"
 answer (raw): "{ 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 50, 48, 48, 48, 0, 0, 44, 116, 0, 0, -68, 22, 98, 112, 0, 0, 0, 0 };"
    at org.junit.Assert.fail(Assert.java:88)
    at com.illposed.osc.OSCMessageTest.checkResultEqualsAnswer(OSCMessageTest.java:45)
    at com.illposed.osc.OSCMessageTest.testArgumentTimestamp2000(OSCMessageTest.java:223)

Running com.illposed.osc.OSCPortTest
Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.62 sec - in com.illposed.osc.OSCPortTest
Running com.illposed.osc.utility.OSCByteArrayToJavaConverterTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in com.illposed.osc.utility.OSCByteArrayToJavaConverterTest
Running com.illposed.osc.utility.OSCJavaToByteArrayConverterTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in com.illposed.osc.utility.OSCJavaToByteArrayConverterTest
Running com.illposed.osc.utility.OSCPacketDispatcherTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in com.illposed.osc.utility.OSCPacketDispatcherTest
Running com.illposed.osc.utility.OSCPatternAddressSelectorTest
Tests run: 29, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec - in com.illposed.osc.utility.OSCPatternAddressSelectorTest

Results :

Failed tests:
  OSCMessageTest.testArgumentTimestamp2000:223->checkResultEqualsAnswer:45 Failed to convert correctly at position: 22
 result (str): "/timestamp2000,t���"
 answer (str): "/timestamp2000,t�bp"
 result (raw): "{ 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 50, 48, 48, 48, 0, 0, 44, 116, 0, 0, -68, 22, -74, -48, 0, 0, 0, 0 };"
 answer (raw): "{ 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 50, 48, 48, 48, 0, 0, 44, 116, 0, 0, -68, 22, 98, 112, 0, 0, 0, 0 };"
  OSCMessageTest.testArgumentTimestampAfterFeb2036:236->checkResultEqualsAnswer:45 Failed to convert correctly at position: 30
 result (str): "/timestampAfterFeb2036,t�WP"
 answer (str): "/timestampAfterFeb2036,t��"
 result (raw): "{ 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 65, 102, 116, 101, 114, 70, 101, 98, 50, 48, 51, 54, 0, 0, 44, 116, 0, 0, 1, -80, 87, 80, 0, 0, 0, 0 };"
 answer (raw): "{ 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 65, 102, 116, 101, 114, 70, 101, 98, 50, 48, 51, 54, 0, 0, 44, 116, 0, 0, 1, -80, 2, -16, 0, 0, 0, 0 };"

Tests run: 96, Failures: 2, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JavaOSC - Parent ................................... SUCCESS [  0.154 s]
[INFO] JavaOSC - Core ..................................... FAILURE [  7.502 s]
[INFO] JavaOSC - UI ....................................... SKIPPED
[INFO] JavaOSC - Aggregation .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.272 s
[INFO] Finished at: 2015-01-06T21:21:13-05:00
[INFO] Final Memory: 20M/177M
[INFO] ------------------------------------------------------------------------
xpe commented 9 years ago

I'm tracing through the code. Here's what I see.

To take one test:

    @Test
    public void testArgumentTimestamp2000() {
        final List<Object> args = new ArrayList<Object>(1);
        Calendar calendar = Calendar.getInstance();
        calendar.clear();
        calendar.set(2000, 0, 0);
        args.add(calendar.getTime());
        final OSCMessage message = new OSCMessage("/timestamp2000", args);
        final byte[] answer = { 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 50, 48, 48, 48, 0, 0, 44, 116, 0, 0, -68, 22, 98, 112, 0, 0, 0, 0 };
        final byte[] result = message.getByteArray();
        checkResultEqualsAnswer(result, answer);
    }

In public class OSCMessage extends AbstractOSCPacket

    private void computeArgumentsByteArray(OSCJavaToByteArrayConverter stream) {
        stream.write(',');
        stream.writeTypes(arguments);
        for (final Object argument : arguments) {
            stream.write(argument);
        }
    }

In public class OSCJavaToByteArrayConverter:

    public void write(Date timestamp) {
        writeInteger64ToByteArray(javaToNtpTimeStamp(timestamp.getTime()));
    }

I'm going to stop here. I don't know the history of those commits. It could just be a simple matter of stale tests.

hoijui commented 9 years ago

thanks xpe for the reporting! :-) i foudn the problem and fixed it already, locally (basically, it is because your system and the one where the reference code was generated, probably used a different time-zone). in turn though, i found some other problem which i will fix first, before pushing the fix for this.. or maybe not either way, the fix will come soon, but this is just a faulty test code problem, not really a problem with the library. thanks again for your time and effort! :-)

digithree commented 9 years ago

I'd like to chime in that this is still an issue, I'm experiencing it with a very similar setup

hoijui commented 7 years ago

It is fixed in the develop branch and will be in master somewhen in the future. The fix is in commit: 46ff3df4d55d0fd77bb4006a0156050967134c8a