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.

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