| 69 | namespace mdf::test { |
| 70 | |
| 71 | void TestChannelArray::SetUpTestSuite() { |
| 72 | |
| 73 | |
| 74 | try { |
| 75 | // Create the root asn log directory. Note that this directory |
| 76 | // exists in the temp dir of the operating system and is not |
| 77 | // deleted by this test program. May be deleted at restart |
| 78 | // of the operating system. |
| 79 | auto temp_dir = temp_directory_path(); |
| 80 | temp_dir.append("test"); |
| 81 | kTestRootDir = temp_dir.string(); |
| 82 | create_directories(temp_dir); // Not deleted |
| 83 | |
| 84 | |
| 85 | // Log to a file as this file is used as attachment file |
| 86 | auto& log_config = LogConfig::Instance(); |
| 87 | log_config.RootDir(kTestRootDir); |
| 88 | log_config.BaseName("mdf_channel_array"); |
| 89 | log_config.Type(LogType::LogToFile); |
| 90 | log_config.CreateDefaultLogger(); |
| 91 | |
| 92 | remove(log_config.GetLogFile()); // Remove any old log files |
| 93 | |
| 94 | // Connect MDF library to the util logging functionality |
| 95 | MdfLogStream::SetLogFunction1(LogFunc); |
| 96 | |
| 97 | |
| 98 | // Add console logging |
| 99 | log_config.AddLogger("Console",LogType::LogToConsole, {}); |
| 100 | LOG_TRACE() << "Log file created. File: " << log_config.GetLogFile(); |
| 101 | |
| 102 | // Create the test directory. Note that this directory is deleted before |
| 103 | // running the test, not after. This give the |
| 104 | temp_dir.append("mdf"); |
| 105 | temp_dir.append("channel_array"); |
| 106 | std::error_code err; |
| 107 | remove_all(temp_dir, err); |
| 108 | if (err) { |
| 109 | LOG_TRACE() << "Remove error. Message: " << err.message(); |
| 110 | } |
| 111 | create_directories(temp_dir); |
| 112 | kTestDir = temp_dir.string(); |
| 113 | |
| 114 | } catch (const std::exception& err) { |
| 115 | LOG_ERROR() << "Failed to create test directories. Error: " << err.what(); |
| 116 | kSkipTest = true; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | void TestChannelArray::TearDownTestSuite() { |
| 121 | LOG_TRACE() << "Tear down the test suite."; |
nothing calls this directly
no test coverage detected