Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEAST_DEFINE_TESTSUITE_MANUAL(ProtocolJson,protocol,ripple); #1972

Closed
wants to merge 2 commits into from

Conversation

sublimator
Copy link
Contributor

Just leaving this quick hack here as a starting point for you C++ gurus to work off/consider. This is a manually run test that dumps the protocol definitions in json, which I used to update ripple-lib-java for omnigate.com.

It's too error-prone to do manually so I hacked this in to spit out json, and then loaded the json inside a java unit test and made sure all the Java definitions (using native enums/classes etc) were in sync.

It would be quite a useful command/feature to have, to keep the various ripple-lib-* up to date. It might be more nicely exposed as an RPC command.

@codecov-io
Copy link

codecov-io commented Jan 18, 2017

Current coverage is 67.06% (diff: 0.00%)

Merging #1972 into develop will decrease coverage by 0.08%

@@            develop      #1972   diff @@
==========================================
  Files           686        686          
  Lines         49340      49388    +48   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          33132      33121    -11   
- Misses        16208      16267    +59   
  Partials          0          0          

Powered by Codecov. Last update a0a4eed...ff9d822

@MarkusTeufelberger
Copy link
Collaborator

@sublimator
Copy link
Contributor Author

Yeah, the schema/code could be improved but I think this would be a very useful feature

Json::Value all(Json::arrayValue);
for (auto const& pair : knownCodeToField)
{
if (pair.second->isBinary())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of makes the 'isBinary' output pointless ...

The reason it was there in the first place was that that there's some Hash256 fields like index and hash that are useful to declare, such that any Json -> dehydrated class works simply. There's also other Amount fields like "taker_gets_funded" etc in offers json.

@ripplelabs-jenkins
Copy link
Collaborator

ripplelabs-jenkins commented Jan 2, 2018

Jenkins Build Summary

Built from this commit

Built at 20190618 - 00:20:01

Test Results

Build Type Log Result Status
msvc.Debug console no test results, t: n/a [BAD EXIT] FAIL 🔴
msvc.Debug,
NINJA_BUILD=true
console no test results, t: n/a [BAD EXIT] FAIL 🔴
msvc.Debug
-Dunity=OFF
console no test results, t: n/a [BAD EXIT] FAIL 🔴
msvc.Release console no test results, t: n/a [BAD EXIT] FAIL 🔴
gcc.Release
-Dassert=ON,
MANUAL_TESTS=true
logfile no test results, t: 24s [BAD EXIT] FAIL 🔴
gcc.Debug
-Dcoverage=ON,
TARGET=coverage_report,
SKIP_TESTS=true
logfile no test results, t: 14s [BAD EXIT] FAIL 🔴
docs,
TARGET=docs
logfile 1 cases, 0 failed, t: 0m1s PASS ✅
clang.Debug logfile no test results, t: 9s [BAD EXIT] FAIL 🔴
clang.Debug
-Dunity=OFF
logfile no test results, t: 9s [BAD EXIT] FAIL 🔴
gcc.Debug logfile no test results, t: 13s [BAD EXIT] FAIL 🔴
gcc.Debug
-Dunity=OFF
logfile no test results, t: 7s [BAD EXIT] FAIL 🔴
clang.Release
-Dassert=ON
logfile no test results, t: 12s [BAD EXIT] FAIL 🔴
gcc.Release
-Dassert=ON
logfile no test results, t: 24s [BAD EXIT] FAIL 🔴
gcc.Debug
-Dstatic=OFF
logfile no test results, t: 13s [BAD EXIT] FAIL 🔴
gcc.Debug
-Dstatic=OFF -DBUILD_SHARED_LIBS=ON
logfile no test results, t: 13s [BAD EXIT] FAIL 🔴
gcc.Debug,
NINJA_BUILD=true
logfile no test results, t: 42s [BAD EXIT] FAIL 🔴
clang.Debug
-Dunity=OFF -Dsan=address,
PARALLEL_TESTS=false,
DEBUGGER=false
logfile no test results, t: 8s [BAD EXIT] FAIL 🔴
clang.Debug
-Dunity=OFF -Dsan=undefined,
PARALLEL_TESTS=false
logfile no test results, t: 10s [BAD EXIT] FAIL 🔴

@ripplelabs-jenkins
Copy link
Collaborator

Thank you for your submission. It will be reviewed soon and submitted for processing in CI.

6 similar comments
@ripplelabs-jenkins
Copy link
Collaborator

Thank you for your submission. It will be reviewed soon and submitted for processing in CI.

@ripplelabs-jenkins
Copy link
Collaborator

Thank you for your submission. It will be reviewed soon and submitted for processing in CI.

@ripplelabs-jenkins
Copy link
Collaborator

Thank you for your submission. It will be reviewed soon and submitted for processing in CI.

@ripplelabs-jenkins
Copy link
Collaborator

Thank you for your submission. It will be reviewed soon and submitted for processing in CI.

@ripplelabs-jenkins
Copy link
Collaborator

Thank you for your submission. It will be reviewed soon and submitted for processing in CI.

@ripplelabs-jenkins
Copy link
Collaborator

Thank you for your submission. It will be reviewed soon and submitted for processing in CI.

Copy link
Contributor

@nbougalis nbougalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the commenting out of several lovely checks here so I can't give a thumbs up.

More broadly, while I am supportive of this, I think it would probably be better if it was a standalone tool that parsed the source code. 🤔

@sublimator
Copy link
Contributor Author

sublimator commented Jun 19, 2019 via email

@sublimator
Copy link
Contributor Author

sublimator commented Jun 19, 2019 via email

@sublimator
Copy link
Contributor Author

sublimator commented Jun 19, 2019 via email

@nbougalis
Copy link
Contributor

nbougalis commented Aug 6, 2019

I would like to merge this but the commenting of several static_assert calls is a concern. Moreover, I'm pretty sure that this functionality should be part of a standalone tool that consumes a definition file and produces the required files in the programming language of choice.

For example:

generate-xrp-fields.py --lang=c++ fields.xrpl

And:

generate-xrp-fields.py --lang=java fields.xrpl

@sublimator
Copy link
Contributor Author

sublimator commented Aug 6, 2019 via email

@sublimator sublimator closed this Aug 6, 2019
@sublimator
Copy link
Contributor Author

@nbougalis
Note, that it's not just the fields. It's also the formats (object schemas) and engine results. Maybe some other enums.

@sublimator
Copy link
Contributor Author

https://raw.githubusercontent.com/sublimator/ripple-lib-java/master/ripple-core/src/test/resources/protocol.json

> Object.keys(require('./protocol'))

[ 'engineResults', 'fields', 'ledgerEntries', 'transactions' ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants