Release Readt
Some checks failed
CI / build-linux-and-wasm (x64-linux) (push) Has been cancelled

This commit is contained in:
2026-01-25 22:08:16 +05:30
parent 601b573983
commit ebde7c7e66
19 changed files with 51 additions and 567 deletions

View File

@ -21,9 +21,6 @@ using namespace IACore;
IAT_BEGIN_BLOCK(Core, Platform)
// -------------------------------------------------------------------------
// 1. OS Name Detection
// -------------------------------------------------------------------------
auto test_os_name() -> bool {
const char *os_name = Platform::get_operating_system_name();
IAT_CHECK(os_name != nullptr);
@ -44,9 +41,6 @@ auto test_os_name() -> bool {
return true;
}
// -------------------------------------------------------------------------
// 2. Architecture Name Detection
// -------------------------------------------------------------------------
auto test_arch_name() -> bool {
const char *arch_name = Platform::get_architecture_name();
IAT_CHECK(arch_name != nullptr);
@ -65,60 +59,45 @@ auto test_arch_name() -> bool {
return true;
}
// -------------------------------------------------------------------------
// 3. CPU Capabilities
// -------------------------------------------------------------------------
auto test_capabilities() -> bool {
// Initialize detection
const bool check_result = Platform::check_cpu();
IAT_CHECK(check_result);
const auto &caps = Platform::get_capabilities();
// We verify that we can access the capabilities struct.
// The actual value of hardware_crc32 depends on the host machine,
// so we cannot assert true or false, but we ensure no crash occurs.
volatile bool has_crc = caps.hardware_crc32;
(void)has_crc;
return true;
}
// -------------------------------------------------------------------------
// 4. CPUID (x64 Only)
// -------------------------------------------------------------------------
#if IA_ARCH_X64
auto test_cpuid() -> bool {
i32 regs[4] = {0};
// Call CPUID with Function 0 (Vendor ID)
Platform::cpuid(0, 0, regs);
// EAX (regs[0]) holds max supported function. Should be > 0 on any modern
// CPU.
IAT_CHECK(regs[0] >= 0);
// EBX, EDX, ECX hold the vendor string.
// The order for the string is EBX, EDX, ECX.
char vendor[13];
std::memset(vendor, 0, 13);
std::memcpy(vendor, &regs[1], 4); // EBX
std::memcpy(vendor + 4, &regs[3], 4); // EDX
std::memcpy(vendor + 8, &regs[2], 4); // ECX
std::memcpy(vendor, &regs[1], 4);
std::memcpy(vendor + 4, &regs[3], 4);
std::memcpy(vendor + 8, &regs[2], 4);
vendor[12] = '\0';
const String vendor_str(vendor);
IAT_CHECK(!vendor_str.empty());
// Check against common vendors to ensure registers contained valid ASCII
bool is_known =
(vendor_str == "GenuineIntel" || vendor_str == "AuthenticAMD" ||
vendor_str == "KVMKVMKVM" || vendor_str == "Microsoft Hv" ||
vendor_str == "VBoxVBoxVBox");
if (!is_known) {
// Not a failure, just an unknown CPU vendor (or virtualization)
std::cout << " [Info] Unknown CPU Vendor: " << vendor_str << "\n";
}
@ -126,9 +105,6 @@ auto test_cpuid() -> bool {
}
#endif
// -------------------------------------------------------------------------
// Registration
// -------------------------------------------------------------------------
IAT_BEGIN_TEST_LIST()
IAT_ADD_TEST(test_os_name);
IAT_ADD_TEST(test_arch_name);