MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / LoadTests

Function LoadTests

Source/Tools/CodeSizeValidation/Main.cpp:338–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338bool 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
372namespace {
373static const fextl::vector<std::pair<const char*, FEXCore::Config::ConfigOption>> EnvConfigLookup = {{

Callers 1

mainFunction · 0.85

Calls 1

closeFunction · 0.85

Tested by

no test coverage detected