| 336 | } |
| 337 | |
| 338 | bool LoadTests(const char* Path) { |
| 339 | int FD = open(Path, O_RDONLY | O_CLOEXEC); |
| 340 | if (FD == -1) { |
| 341 | return false; |
| 342 | } |
| 343 | |
| 344 | struct stat buf; |
| 345 | if (fstat(FD, &buf) == -1) { |
| 346 | close(FD); |
| 347 | return false; |
| 348 | } |
| 349 | |
| 350 | TestDataSize = buf.st_size; |
| 351 | TestData = FEXCore::Allocator::mmap(nullptr, TestDataSize, PROT_READ, MAP_PRIVATE, FD, 0); |
| 352 | if (reinterpret_cast<uint64_t>(TestData) == ~0ULL) { |
| 353 | close(FD); |
| 354 | return false; |
| 355 | } |
| 356 | |
| 357 | close(FD); |
| 358 | |
| 359 | TestHeaderData = reinterpret_cast<const TestHeader*>(TestData); |
| 360 | |
| 361 | // Need to walk past the environment variables to get to the actual tests. |
| 362 | const uint8_t* Data = TestHeaderData->Data; |
| 363 | for (size_t i = 0; i < TestHeaderData->EnvironmentVariableCount; ++i) { |
| 364 | // Environment variables are a pair of null terminated strings. |
| 365 | Data += strlen(reinterpret_cast<const char*>(Data)) + 1; |
| 366 | Data += strlen(reinterpret_cast<const char*>(Data)) + 1; |
| 367 | } |
| 368 | TestsStart = reinterpret_cast<const TestInfo*>(Data); |
| 369 | return true; |
| 370 | } |
| 371 | |
| 372 | namespace { |
| 373 | static const fextl::vector<std::pair<const char*, FEXCore::Config::ConfigOption>> EnvConfigLookup = {{ |