1*c54f35caSApple OSS Distributions #include <darwintest.h> 2*c54f35caSApple OSS Distributions #include "nvram_helper.h" 3*c54f35caSApple OSS Distributions 4*c54f35caSApple OSS Distributions T_GLOBAL_META(T_META_NAMESPACE("xnu.nvram"), 5*c54f35caSApple OSS Distributions T_META_RADAR_COMPONENT_NAME("xnu"), 6*c54f35caSApple OSS Distributions T_META_RADAR_COMPONENT_VERSION("nvram")); 7*c54f35caSApple OSS Distributions 8*c54f35caSApple OSS Distributions static io_registry_entry_t optionsRef = IO_OBJECT_NULL; 9*c54f35caSApple OSS Distributions 10*c54f35caSApple OSS Distributions // xcrun -sdk macosx.internal make -C tests nvram_system && sudo ./tests/build/sym/nvram_system 11*c54f35caSApple OSS Distributions 12*c54f35caSApple OSS Distributions // Test that writing, reading, and deleting of system variables with system entitlement should succeed 13*c54f35caSApple OSS Distributions T_DECL(TestSystemEntitled, "Test system guids with entitlement") 14*c54f35caSApple OSS Distributions { 15*c54f35caSApple OSS Distributions #if ((TARGET_OS_OSX) && !(__x86_64__)) 16*c54f35caSApple OSS Distributions const char *varToTest = "40A0DDD2-77F8-4392-B4A3-1E7304206516:varToTest2"; 17*c54f35caSApple OSS Distributions 18*c54f35caSApple OSS Distributions optionsRef = GetOptions(); 19*c54f35caSApple OSS Distributions 20*c54f35caSApple OSS Distributions T_ASSERT_EQ(SetVariable(varToTest, "1234", optionsRef), KERN_SUCCESS, "Set variable %s successfully\n", varToTest); 21*c54f35caSApple OSS Distributions T_ASSERT_EQ(GetVariable(varToTest, optionsRef), KERN_SUCCESS, "Read variable %s successfully\n", varToTest); 22*c54f35caSApple OSS Distributions T_ASSERT_EQ(DeleteVariable(varToTest, optionsRef), KERN_SUCCESS, "Deleted variable %s successfully\n", varToTest); 23*c54f35caSApple OSS Distributions 24*c54f35caSApple OSS Distributions ReleaseOptions(optionsRef); 25*c54f35caSApple OSS Distributions #else 26*c54f35caSApple OSS Distributions T_PASS("Test not supported"); 27*c54f35caSApple OSS Distributions #endif /* ((TARGET_OS_OSX) && !(__x86_64__)) */ 28*c54f35caSApple OSS Distributions } 29