| 94 | } |
| 95 | |
| 96 | int TestApp::run() { |
| 97 | #ifndef ASMJIT_NO_LOGGING |
| 98 | FormatOptions format_options; |
| 99 | format_options.add_flags( |
| 100 | FormatFlags::kMachineCode | |
| 101 | FormatFlags::kShowAliases | |
| 102 | FormatFlags::kExplainImms | |
| 103 | FormatFlags::kRegCasts ); |
| 104 | format_options.set_indentation(FormatIndentationGroup::kCode, 2); |
| 105 | |
| 106 | IndentedStdoutLogger print_logger(4); |
| 107 | print_logger.set_options(format_options); |
| 108 | |
| 109 | StringLogger string_logger; |
| 110 | string_logger.set_options(format_options); |
| 111 | |
| 112 | auto print_string_logger_content = [&]() { |
| 113 | if (!_verbose) { |
| 114 | printf("%s", string_logger.data()); |
| 115 | fflush(stdout); |
| 116 | } |
| 117 | }; |
| 118 | #else |
| 119 | auto print_string_logger_content = [&]() {}; |
| 120 | #endif // !ASMJIT_NO_LOGGING |
| 121 | |
| 122 | // maybe unused... |
| 123 | Support::maybe_unused(print_string_logger_content); |
| 124 | |
| 125 | #ifndef ASMJIT_NO_JIT |
| 126 | JitRuntime runtime; |
| 127 | #endif // !ASMJIT_NO_JIT |
| 128 | |
| 129 | PerformanceTimer compile_timer; |
| 130 | PerformanceTimer finalize_timer; |
| 131 | |
| 132 | double compile_time = 0; |
| 133 | double finalize_time = 0; |
| 134 | |
| 135 | for (std::unique_ptr<TestCase>& test : _tests) { |
| 136 | if (!should_run(test.get())) |
| 137 | continue; |
| 138 | |
| 139 | _num_tests++; |
| 140 | |
| 141 | for (uint32_t pass = 0; pass < 2; pass++) { |
| 142 | bool runnable = false; |
| 143 | CodeHolder code; |
| 144 | SimpleErrorHandler error_handler; |
| 145 | |
| 146 | const char* status_separator = " "; |
| 147 | |
| 148 | // Filter architecture to run. |
| 149 | if (strcmp(_arch, "all") != 0) { |
| 150 | switch (test->arch()) { |
| 151 | case Arch::kX86: |
| 152 | if (strcmp(_arch, "x86") == 0) |
| 153 | break; |
no test coverage detected