X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fmain.cc;h=46429241f56a264777ff91b973d8de8c5809f00b;hb=ee1620247d27b52cc849811899d2d8884a6a2d02;hp=fe8938b97d84919edb54d23e5a0d64de843334f5;hpb=743e893ecbbaacd66d2832e9c3ae16404422a173;p=awesomized%2Flibmemcached diff --git a/libtest/main.cc b/libtest/main.cc index fe8938b9..46429241 100644 --- a/libtest/main.cc +++ b/libtest/main.cc @@ -158,7 +158,13 @@ int main(int argc, char *argv[]) break; case OPT_LIBYATL_REPEAT: + errno= 0; opt_repeat= strtoul(optarg, (char **) NULL, 10); + if (errno != 0) + { + Error << "unknown value passed to --repeat: `" << optarg << "`"; + exit(EXIT_FAILURE); + } break; case OPT_LIBYATL_MATCH_COLLECTION: @@ -186,9 +192,16 @@ int main(int argc, char *argv[]) srandom((unsigned int)time(NULL)); - if (bool(getenv("YATL_REPEAT")) and (strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10) > 1)) + errno= 0; + if (bool(getenv("YATL_REPEAT"))) { + errno= 0; opt_repeat= strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10); + if (errno != 0) + { + Error << "ENV YATL_REPEAT passed an invalid value: `" << getenv("YATL_REPEAT") << "`"; + exit(EXIT_FAILURE); + } } if ((bool(getenv("YATL_QUIET")) and (strcmp(getenv("YATL_QUIET"), "0") == 0)) or opt_quiet) @@ -284,7 +297,6 @@ int main(int argc, char *argv[]) std::auto_ptr frame(new libtest::Framework(signal, binary_name, collection_to_run, wildcard)); // Run create(), bail on error. - try { switch (frame->create()) { @@ -292,17 +304,14 @@ int main(int argc, char *argv[]) break; case TEST_SKIPPED: - return EXIT_SKIP; + SKIP("SKIP was returned from framework create()"); + break; case TEST_FAILURE: std::cerr << "Could not call frame->create()" << std::endl; return EXIT_FAILURE; } } - catch (const libtest::__skipped& e) - { - return EXIT_SKIP; - } frame->exec(); @@ -369,9 +378,9 @@ int main(int argc, char *argv[]) std::cerr << "std::exception:" << e.what() << std::endl; exit_code= EXIT_FAILURE; } - catch (char const*) + catch (char const* s) { - std::cerr << "Exception:" << std::endl; + std::cerr << "Exception:" << s << std::endl; exit_code= EXIT_FAILURE; } catch (...)