| 159 | }; |
| 160 | |
| 161 | static ExecutionResult evaluateTestCaseInternal(fs::path harnessDirectory, |
| 162 | std::string testFile, |
| 163 | const TestCaseData& metadata, |
| 164 | bool isStrict, |
| 165 | std::string& error_type, |
| 166 | std::string& error_description) { |
| 167 | realm realm; |
| 168 | |
| 169 | const auto assertContent = readFileCached(harnessDirectory / kAssertFile); |
| 170 | const auto staContent = readFileCached(harnessDirectory / kSTAFile); |
| 171 | |
| 172 | if (!assertContent || !staContent) { |
| 173 | TEST262_LOG(cerr, "Failed to read content of {} or {}", kAssertFile, kSTAFile); |
| 174 | return ExecutionResult::Failed; |
| 175 | } |
| 176 | |
| 177 | if (!realm.evaluateHarness(kAssertFile, assertContent.value(), error_type, error_description)) { |
| 178 | TEST262_LOG(cerr, "Could not process {}", kAssertFile); |
| 179 | return ExecutionResult::Failed; |
| 180 | } |
| 181 | |
| 182 | if (!realm.evaluateHarness(kSTAFile, staContent.value(), error_type, error_description)) { |
| 183 | TEST262_LOG(cerr, "Could not process {}", kSTAFile); |
| 184 | return ExecutionResult::Failed; |
| 185 | } |
| 186 | |
| 187 | if (metadata.async) { |
| 188 | const auto doneprintHandleContent = readFileCached(harnessDirectory / kDonePrintHandle); |
| 189 | if (!doneprintHandleContent) { |
| 190 | return ExecutionResult::Failed; |
| 191 | } |
| 192 | |
| 193 | if (!realm.evaluateHarness(kDonePrintHandle, doneprintHandleContent.value(), error_type, error_description)) { |
| 194 | TEST262_LOG(cerr, "Could not process {}", kDonePrintHandle); |
| 195 | return ExecutionResult::Failed; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | for (auto include : metadata.includes) { |
| 200 | auto include_file = harnessDirectory / include; |
| 201 | |
| 202 | auto includeContents = readFileCached(include_file); |
| 203 | if (!includeContents) { |
| 204 | return ExecutionResult::Failed; |
| 205 | } |
| 206 | if (!realm.evaluateHarness(include, includeContents.value(), error_type, error_description)) { |
| 207 | return ExecutionResult::Failed; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | if (!realm.evaluateCompiledTest(testFile, isStrict, metadata.module, error_type, error_description)) { |
| 212 | return ExecutionResult::RunWithError; |
| 213 | } |
| 214 | return ExecutionResult::RunWithPass; |
| 215 | } |
| 216 | |
| 217 | static void evaluateTestCase(const std::set<std::string>& skipList, |
| 218 | std::string harnessDirectory, |
no test coverage detected