-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Change exit calls to returns in testeth, closes #4667 #4971
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4971 +/- ##
===========================================
+ Coverage 61.1% 61.17% +0.07%
===========================================
Files 350 350
Lines 28298 28291 -7
Branches 2886 2889 +3
===========================================
+ Hits 17291 17308 +17
+ Misses 10048 10021 -27
- Partials 959 962 +3 |
@@ -608,7 +608,7 @@ void ImportTest::checkAllowedNetwork(string const& _network) | |||
// Can't use boost at this point | |||
std::cerr << TestOutputHelper::get().testName() + " Specified Network not found: " | |||
<< _network << "\n"; | |||
exit(1); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caller of this function should terminate the test when this happens.
@@ -127,12 +127,12 @@ Options::Options(int argc, const char** argv) | |||
if (arg == "--help") | |||
{ | |||
printHelp(); | |||
exit(0); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure that the process terminates when this constructor takes this path.
} | ||
else if (arg == "--version") | ||
{ | ||
printVersion(); | ||
exit(0); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure that the process terminates after the execution takes this path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can throw an exception instead of silently returning.
@@ -147,7 +147,7 @@ Options::Options(int argc, const char** argv) | |||
g_logVerbosity = 13; | |||
#else | |||
cerr << "--vmtrace option requires a build with cmake -DVMTRACE=1\n"; | |||
exit(1); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure that the process terminates after the execution takes this path.
@@ -232,7 +232,7 @@ Options::Options(int argc, const char** argv) | |||
else | |||
{ | |||
std::cerr << "Options file not found! Default options at: tests/src/randomCodeOptions.json\n"; | |||
exit(0); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@@ -272,11 +272,11 @@ Options::Options(int argc, const char** argv) | |||
if (maxCodes > 1000 || maxCodes <= 0) | |||
{ | |||
cerr << "Argument for the option is invalid! (use range: 1...1000)\n"; | |||
exit(1); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
} | ||
test::RandomCodeOptions options; | ||
cout << test::RandomCode::get().generate(maxCodes, options) << "\n"; | ||
exit(0); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@@ -309,7 +309,7 @@ Options::Options(int argc, const char** argv) | |||
else if (seenSeparator) | |||
{ | |||
cerr << "Unknown option: " + arg << "\n"; | |||
exit(1); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@@ -322,7 +322,7 @@ Options::Options(int argc, const char** argv) | |||
cerr << "--createRandomTest cannot be used with any of the options: " << | |||
"trValueIndex, trGasIndex, trDataIndex, nonetwork, singleTest, all, " << | |||
"stats, filltests, fillchain \n"; | |||
exit(1); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@@ -136,7 +136,7 @@ int main(int argc, const char* argv[]) | |||
catch (dev::test::InvalidOption const& e) | |||
{ | |||
std::cerr << *boost::get_error_info<errinfo_comment>(e) << "\n"; | |||
exit(1); | |||
return 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is fine.
@chfast what are the plans for testeth in cpp client ? |
@winsvega I don't have any. |
return should be used over exit calls because return guarentees the destructor is called for locally scoped objects.