-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. You can throw an exception instead of silently returning. |
||
} | ||
else if (arg == "--vm" || arg == "--evmc") | ||
{ | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Make sure that the process terminates after the execution takes this path. |
||
#endif | ||
} | ||
else if (arg == "--jsontrace") | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
} | ||
} | ||
else if (arg == "-t") | ||
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
} | ||
else if (arg == "--createRandomTest") | ||
{ | ||
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
} | ||
} | ||
else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. This one is fine. |
||
} | ||
|
||
dev::test::Options const& opt = dev::test::Options::get(); | ||
|
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.