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.

90 lines
2.7 KiB

  1. #include <iostream>
  2. #include <list>
  3. #include <string>
  4. #include "storm-config.h"
  5. #include "gtest/gtest.h"
  6. #ifdef STORM_LOGGING_FRAMEWORK
  7. #include "log4cplus/logger.h"
  8. #include "log4cplus/loggingmacros.h"
  9. #include "log4cplus/consoleappender.h"
  10. #include "log4cplus/fileappender.h"
  11. log4cplus::Logger logger;
  12. #endif
  13. #include "src/settings/SettingsManager.h"
  14. /*!
  15. * Initializes the logging framework.
  16. */
  17. void setUpLogging() {
  18. #ifdef STORM_LOGGING_FRAMEWORK
  19. logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
  20. logger.setLogLevel(log4cplus::ERROR_LOG_LEVEL);
  21. log4cplus::SharedAppenderPtr fileLogAppender(new log4cplus::FileAppender("storm-functional-tests.log"));
  22. fileLogAppender->setName("mainFileAppender");
  23. fileLogAppender->setThreshold(log4cplus::FATAL_LOG_LEVEL);
  24. fileLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M} (%r ms) - %F:%L : %m%n")));
  25. logger.addAppender(fileLogAppender);
  26. #endif
  27. // Uncomment these lines to enable console logging output
  28. // log4cplus::SharedAppenderPtr consoleLogAppender(new log4cplus::ConsoleAppender());
  29. // consoleLogAppender->setName("mainConsoleAppender");
  30. // consoleLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M:%s} (%r ms) - %F:%L : %m%n")));
  31. // logger.addAppender(consoleLogAppender);
  32. }
  33. int main(int argc, char* argv[]) {
  34. setUpLogging();
  35. std::cout << "StoRM (Functional) Testing Suite" << std::endl;
  36. testing::InitGoogleTest(&argc, argv);
  37. int result = RUN_ALL_TESTS();
  38. #ifdef STORM_LOGGING_FRAMEWORK
  39. logger.closeNestedAppenders();
  40. #endif
  41. std::list<std::string> untestedModules;
  42. #ifndef STORM_HAVE_GUROBI
  43. untestedModules.push_back("Gurobi");
  44. #endif
  45. #ifndef STORM_HAVE_CUDA
  46. untestedModules.push_back("CUDA");
  47. #endif
  48. #ifndef STORM_HAVE_GLPK
  49. untestedModules.push_back("GLPK");
  50. #endif
  51. #ifndef STORM_HAVE_Z3
  52. untestedModules.push_back("Z3");
  53. #endif
  54. #ifndef STORM_HAVE_MSAT
  55. untestedModules.push_back("MathSAT");
  56. #endif
  57. #ifndef STORM_HAVE_INTELTBB
  58. untestedModules.push_back("Intel TBB");
  59. #endif
  60. if (result == 0) {
  61. if (untestedModules.empty()) {
  62. std::cout << std::endl << "ALL TESTS PASSED!" << std::endl;
  63. } else{
  64. std::cout << std::endl << "StoRM was built without the following optional dependencies: ";
  65. auto iter = untestedModules.begin();
  66. while (iter != untestedModules.end()) {
  67. std::cout << *iter;
  68. ++iter;
  69. if (iter != untestedModules.end()) {
  70. std::cout << ", ";
  71. }
  72. }
  73. std::cout << std::endl << "Functionality using that modules could not be tested." << std::endl << std::endl << "TESTS PASSED!" << std::endl;
  74. }
  75. } else{
  76. std::cout << std::endl << "TESTS FAILED!" << std::endl;
  77. }
  78. return result;
  79. }