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.

85 lines
2.6 KiB

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