Skip to content

Improved error messages for EndToEnd tests.#2937

Merged
axic merged 1 commit intodevelopfrom
failureDiagnosis
Sep 25, 2017
Merged

Improved error messages for EndToEnd tests.#2937
axic merged 1 commit intodevelopfrom
failureDiagnosis

Conversation

@chriseth
Copy link
Contributor

Much nicer to read and interpret error messages for mismatches in end to end test return data:

ethereum/solidity/test/libsolidity/ABIDecoderTests.cpp(252): error: in "ABIDecoderTest/byte_arrays": Invalid encoded data
   Result                                                           Expectation
   ...............................................................6 ...............................................................6
   ...............................................................7 ...............................................................7
   64.............................................................. 64..............................................................
 X ...............................................................c ...............................................................9

Where X marks a mismatch and every 0 is replaced by ..

u256 m_gasUsed;
};

#define ABI_CHECK(RES, EXP) do { \
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just use result and expected as in line with other macros we have?

@axic
Copy link
Contributor

axic commented Sep 20, 2017

Yeah it seems like . is more readable than 0 because it is not full height.

@chriseth
Copy link
Contributor Author

Changed the name of the macro parameters and added another safety check inside the printing function.

u256 m_gasUsed;
};

#define ABI_CHECK(RESULT, EXPECTATION) do { \
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you actually go lowercase since that is what we have in the rest of the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, also for preprocessor macros?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, mixed, but I'll make it lowercase.

Copy link
Contributor

Choose a reason for hiding this comment

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

That is what we have. I don't think I've seen anywhere uppercase for macros, but could make sense, though I'd prefer to do a single sweeping change to update all macros for that style if decided on.

for (size_t i = 0; i < std::max(resHex.size(), expHex.size()); i += 0x40)
{
std::string r{i >= resHex.size() ? string{} : resHex.substr(i, 0x40)};
std::string e{i > expHex.size() ? string{} : expHex.substr(i, 0x40)};
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, actually I think we should change these to a bit longer variants (perhaps res and exp) for readability in the below section.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed it to longer variants.

@axic axic merged commit e6bbbb3 into develop Sep 25, 2017
@axic axic deleted the failureDiagnosis branch September 25, 2017 11:58
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.

2 participants

Comments