| 146 | bool TestTool::m_exitRequested = false; |
| 147 | |
| 148 | TestTool::Result TestTool::process() |
| 149 | { |
| 150 | bool formatted{!m_options.noColor}; |
| 151 | |
| 152 | try |
| 153 | { |
| 154 | if (m_filter.matches(m_path, m_name)) |
| 155 | { |
| 156 | (AnsiColorized(std::cout, formatted, {BOLD}) << m_name << ": ").flush(); |
| 157 | |
| 158 | m_test = m_testCaseCreator(TestCase::Config{ |
| 159 | m_path.string(), |
| 160 | m_options.evmVersion(), |
| 161 | m_options.eofVersion(), |
| 162 | m_options.vmPaths, |
| 163 | m_options.enforceGasTest, |
| 164 | m_options.enforceGasTestMinValue |
| 165 | }); |
| 166 | if (m_test->shouldRun()) |
| 167 | { |
| 168 | std::stringstream outputMessages; |
| 169 | switch (TestCase::TestResult result = m_test->run(outputMessages, " ", formatted)) |
| 170 | { |
| 171 | case TestCase::TestResult::Success: |
| 172 | AnsiColorized(std::cout, formatted, {BOLD, GREEN}) << "OK" << std::endl; |
| 173 | return Result::Success; |
| 174 | default: |
| 175 | AnsiColorized(std::cout, formatted, {BOLD, RED}) << "FAIL" << std::endl; |
| 176 | |
| 177 | AnsiColorized(std::cout, formatted, {BOLD, CYAN}) << " Contract:" << std::endl; |
| 178 | m_test->printSource(std::cout, " ", formatted); |
| 179 | m_test->printSettings(std::cout, " ", formatted); |
| 180 | |
| 181 | std::cout << std::endl << outputMessages.str() << std::endl; |
| 182 | return result == TestCase::TestResult::FatalError ? Result::Exception : Result::Failure; |
| 183 | } |
| 184 | } |
| 185 | else |
| 186 | { |
| 187 | AnsiColorized(std::cout, formatted, {BOLD, YELLOW}) << "NOT RUN" << std::endl; |
| 188 | return Result::Skipped; |
| 189 | } |
| 190 | } |
| 191 | else |
| 192 | return Result::Skipped; |
| 193 | } |
| 194 | catch (...) |
| 195 | { |
| 196 | AnsiColorized(std::cout, formatted, {BOLD, RED}) << |
| 197 | "Unhandled exception during test: " << boost::current_exception_diagnostic_information() << std::endl; |
| 198 | return Result::Exception; |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | void TestTool::updateTestCase() |
| 203 | { |
no test coverage detected