You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.2 KiB

  1. #include <iostream>
  2. #include "gtest/gtest.h"
  3. #include "log4cplus/logger.h"
  4. #include "log4cplus/loggingmacros.h"
  5. #include "log4cplus/consoleappender.h"
  6. #include "log4cplus/fileappender.h"
  7. #include "src/utility/Settings.h"
  8. #include "src/modelchecker/GmmxxDtmcPrctlModelChecker.h"
  9. log4cplus::Logger logger;
  10. /*!
  11. * Initializes the logging framework.
  12. */
  13. void setUpLogging() {
  14. log4cplus::SharedAppenderPtr fileLogAppender(new log4cplus::FileAppender("storm-tests.log"));
  15. fileLogAppender->setName("mainFileAppender");
  16. fileLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M} (%r ms) - %F:%L : %m%n")));
  17. logger = log4cplus::Logger::getInstance("mainLogger");
  18. logger.addAppender(fileLogAppender);
  19. // Uncomment these lines to enable console logging output
  20. // log4cplus::SharedAppenderPtr consoleLogAppender(new log4cplus::ConsoleAppender());
  21. // consoleLogAppender->setName("mainConsoleAppender");
  22. // consoleLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M:%s} (%r ms) - %F:%L : %m%n")));
  23. // logger.addAppender(consoleLogAppender);
  24. }
  25. /*!
  26. * Function that parses the command line options.
  27. * @param argc The argc argument of main().
  28. * @param argv The argv argument of main().
  29. * @return True iff the program should continue to run after parsing the options.
  30. */
  31. bool parseOptions(int const argc, char const * const argv[]) {
  32. storm::settings::Settings* s = nullptr;
  33. try {
  34. storm::settings::Settings::registerModule<storm::modelchecker::GmmxxDtmcPrctlModelChecker<double>>();
  35. s = storm::settings::newInstance(argc, argv, nullptr, true);
  36. } catch (storm::exceptions::InvalidSettingsException& e) {
  37. std::cout << "Could not recover from settings error: " << e.what() << "." << std::endl;
  38. std::cout << std::endl << storm::settings::help;
  39. return false;
  40. }
  41. if (s->isSet("help")) {
  42. std::cout << storm::settings::help;
  43. return false;
  44. }
  45. return true;
  46. }
  47. int main(int argc, char* argv[]) {
  48. setUpLogging();
  49. if (!parseOptions(argc, argv)) {
  50. return 0;
  51. }
  52. std::cout << "STORM Testing Suite" << std::endl;
  53. testing::InitGoogleTest(&argc, argv);
  54. return RUN_ALL_TESTS();
  55. }