tools/reduce: change default timeout to 5 minutes no matter if --hang is used or not.

This commit is contained in:
Daniel Marjamäki 2013-01-08 07:10:14 +01:00
parent 29c66dd9bc
commit 9ecc74e845
1 changed files with 3 additions and 3 deletions

View File

@ -49,6 +49,8 @@ public:
if (std::time(0) > stopTime) { if (std::time(0) > stopTime) {
if (pattern.empty()) if (pattern.empty())
foundLine = true; foundLine = true;
else
std::cerr << "timeout. You might want to use a longer --maxtime timeout" << std::endl;
std::cout << "terminate" << std::endl; std::cout << "terminate" << std::endl;
cppcheck.terminate(); cppcheck.terminate();
} }
@ -548,15 +550,13 @@ int main(int argc, char *argv[])
bool print = false; bool print = false;
struct ReduceSettings settings = {0}; struct ReduceSettings settings = {0};
settings.maxtime = ~0U; settings.maxtime = 300; // default timeout = 5 minutes
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--stdout") == 0) if (strcmp(argv[i], "--stdout") == 0)
print = true; print = true;
else if (strcmp(argv[i], "--hang") == 0) { else if (strcmp(argv[i], "--hang") == 0) {
settings.hang = true; settings.hang = true;
if (settings.maxtime == ~0U)
settings.maxtime = 300; // default timeout = 5 minutes
} else if (strncmp(argv[i], "--maxtime=", 10) == 0) } else if (strncmp(argv[i], "--maxtime=", 10) == 0)
settings.maxtime = std::atoi(argv[i] + 10); settings.maxtime = std::atoi(argv[i] + 10);
else if (settings.filename==NULL && strchr(argv[i],'.')) else if (settings.filename==NULL && strchr(argv[i],'.'))