ConsenSysMesh / cava

ConsenSys core libraries for Java & Kotlin
Apache License 2.0
84 stars 34 forks source link

Toml library fails its own tests #143

Closed pie-flavor closed 5 years ago

pie-flavor commented 5 years ago
> Task :toml:test

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[3] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[8] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[23] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > testHardExampleUnicode() FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:512

net.consensys.cava.toml.TomlTest > shouldParseArray(String, Object[])[8] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:555

212 tests completed, 5 failed

> Task :toml:test FAILED

FAILURE: Build failed with an exception.
cleishm commented 5 years ago

Hi!

Every commit merged to master must pass CI and run those tests successfullly. Which is to say: I’m unsure why or how you’re getting that error.

Can you provide more detail, like the OS, the version of Java, the checkout git hash, etc?

atoulme commented 5 years ago

Hello @pie-flavor , thanks for taking the time to report this issue. I do not reproduce this issue locally or through CI. Please provide more information as @cleishm hinted at so we can help. I will close this issue in the meantime, please reopen if needed.

pie-flavor commented 5 years ago

OS is Windows 10 1809. Last tested commit d75e16e. Java version 1.8.0_144. Tested on a fresh clone just for this.


C:\Users\Adam\Documents\temp> git clone https://github.com/ConsenSys/cava.git
Cloning into 'cava'...
remote: Enumerating objects: 651, done.
remote: Counting objects: 100% (651/651), done.
remote: Compressing objects: 100% (225/225), done.
remote: Total 11903 (delta 186), reused 594 (delta 161), pack-reused 11252
Receiving objects: 100% (11903/11903), 4.10 MiB | 1.65 MiB/s, done.
Resolving deltas: 100% (7093/7093), done.
C:\Users\Adam\Documents\temp> cd cava
C:\Users\Adam\Documents\temp\cava [master ≡]> git submodule update --init --recursive
Submodule 'eth-reference-tests/src/test/resources/tests' (https://github.com/ethereum/tests.git) registered for path 'eth-reference-tests/src/test/resources/tests'
Cloning into 'C:/Users/Adam/Documents/temp/cava/eth-reference-tests/src/test/resources/tests'...
Submodule path 'eth-reference-tests/src/test/resources/tests': checked out '91b73143a19d206adae0a08f3d94dd4c5cc9e738'
C:\Users\Adam\Documents\temp\cava [master ≡]> cd toml
C:\Users\Adam\Documents\temp\cava\toml [master ≡]> ..\gradlew test

> Task :toml:compileTestJava
C:\Users\Adam\Documents\temp\cava\toml\src\test\java\net\consensys\cava\toml\TomlTest.java:512: error: unmappable character (0x9D) for encoding windows-1252
    assertEquals("├?├┤├║'ΓäôΓäô ╬╗├í╞¡├¿ ΓéÑ├¿ ├í╞Æ╞¡├¿┼Ö ╞¡╬╗├»╞¿ - #", result.getString("the.test_string"));
                   ^

> Task :toml:test

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[3] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[8] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[23] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > testHardExampleUnicode() FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:512

net.consensys.cava.toml.TomlTest > shouldParseArray(String, Object[])[8] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:555

212 tests completed, 5 failed

> Task :toml:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':toml:test'.
> There were failing tests. See the report at: file:///C:/Users/Adam/Documents/temp/cava/toml/build/reports/tests/test/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 19s
7 actionable tasks: 7 executed
cleishm commented 5 years ago

PR #153 ensures that all source files are treated as UTF-8, which should solve the "unmappable character" error, and possibly the test failures. Please test with the PR branch (or master after it is merged) and let us know if you still have an issue.

atoulme commented 5 years ago

Thank you both for chasing this issue, very appreciated!

cleishm commented 5 years ago

@pie-flavor That PR is merged, see if that resolves the issue or not.

pie-flavor commented 5 years ago
D:\temp> git clone ConsenSys/cava
Cloning into 'cava'...
remote: Enumerating objects: 239, done.
remote: Counting objects: 100% (239/239), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 12199 (delta 55), reused 204 (delta 37), pack-reused 11960
Receiving objects: 100% (12199/12199), 4.14 MiB | 1.05 MiB/s, done.
Resolving deltas: 100% (7204/7204), done.
D:\temp> cd cava
D:\temp\cava [master ≡]> git submodule update --recursive --init
Submodule 'eth-reference-tests/src/test/resources/tests' (https://github.com/ethereum/tests.git) registered for path 'eth-reference-tests/src/test/resources/tests'
Cloning into 'D:/temp/cava/eth-reference-tests/src/test/resources/tests'...
Submodule path 'eth-reference-tests/src/test/resources/tests': checked out '91b73143a19d206adae0a08f3d94dd4c5cc9e738'
D:\temp\cava [master ≡]> cd toml
D:\temp\cava\toml [master ≡]> ..\gradlew test
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :toml:test

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[3] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[8] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > shouldParseString(String, String)[23] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:81

net.consensys.cava.toml.TomlTest > shouldParseArray(String, Object[])[8] FAILED
    org.opentest4j.AssertionFailedError at TomlTest.java:555

212 tests completed, 4 failed

> Task :toml:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':toml:test'.
> There were failing tests. See the report at: file:///D:/temp/cava/toml/build/reports/tests/test/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 50s
7 actionable tasks: 7 executed
pie-flavor commented 5 years ago

and could this issue be reopened since it is in fact still an issue?

atoulme commented 5 years ago

The issues relate to the newline characters present in the expected value. The fix is to judiciously replace the '\n' characters with the proper newline character but only if the toml value is not quoted, in which case \n is escaped.

I also see that some tests in config fail for the same reason.

I managed to reproduce this after installing Windows 10 on a VM.

atoulme commented 5 years ago

I fixed the issues regarding the toml tests here: https://github.com/ConsenSys/cava/pull/177

Please review and let me know if the issue can be closed.

pie-flavor commented 5 years ago

Can't even get to the testing bit now.

D:\Temp\cava [master ≡]> git submodule update --init --recursive
Submodule 'eth-reference-tests/src/test/resources/eth2.0-tests' (git@github.com:ethereum/eth2.0-tests.git) registered for path 'eth-reference-tests/src/test/resources/eth2.0-tests'
Submodule 'eth-reference-tests/src/test/resources/tests' (https://github.com/ethereum/tests.git) registered for path 'eth-reference-tests/src/test/resources/tests'
Cloning into 'D:/temp/cava/eth-reference-tests/src/test/resources/eth2.0-tests'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:ethereum/eth2.0-tests.git' into submodule path 'D:/temp/cava/eth-reference-tests/src/test/resources/eth2.0-tests' failed
Failed to clone 'eth-reference-tests/src/test/resources/eth2.0-tests'. Retry scheduled
Cloning into 'D:/temp/cava/eth-reference-tests/src/test/resources/tests'...
Cloning into 'D:/temp/cava/eth-reference-tests/src/test/resources/eth2.0-tests'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:ethereum/eth2.0-tests.git' into submodule path 'D:/temp/cava/eth-reference-tests/src/test/resources/eth2.0-tests' failed
Failed to clone 'eth-reference-tests/src/test/resources/eth2.0-tests' a second time, aborting
D:\Temp\cava [master ≡ +0 ~1 -0 !]> cd toml
D:\Temp\cava\toml [master ≡ +0 ~1 -0 !]> ..\gradlew test

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\temp\cava\build.gradle' line: 27

* What went wrong:
A problem occurred evaluating root project 'cava'.
> eth-reference-tests/src/test/resources/tests/README.md missing: please clone submodules (git submodule update --init --recursive)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
atoulme commented 5 years ago

Yes, see what it reads in the error message?


A problem occurred evaluating root project 'cava'.
> eth-reference-tests/src/test/resources/tests/README.md missing: please clone submodules (git submodule update --init --recursive)```
atoulme commented 5 years ago

Never mind. Looks like you can't check out with git@github.com:ethereum/eth2.0-tests.git.

No support for git checkouts - will need to move this submodule to https.

atoulme commented 5 years ago

I have fixed that issue, so it should be possible for you to build on Windows.

pie-flavor commented 5 years ago

Looks like it's fixed.