xref: /xnu-10002.1.13/tests/nvram_tests/nvram_ve_read.c (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
1 #include <darwintest.h>
2 #include "nvram_helper.h"
3 
4 T_GLOBAL_META(T_META_NAMESPACE("xnu.nvram"),
5     T_META_RADAR_COMPONENT_NAME("xnu"),
6     T_META_RADAR_COMPONENT_VERSION("nvram"));
7 
8 static io_registry_entry_t optionsRef = IO_OBJECT_NULL;
9 
10 // xcrun -sdk iphoneos.internal make -C tests nvram_ve_read && sudo ./tests/build/sym/nvram_ve_read
11 
12 // Test that read of entitled variables with entitlement should succeed
13 T_DECL(TestEntRdEnt, "Test read entitled variables")
14 {
15 #if !(__x86_64__)
16 	char * varToTest = "testEntRd";
17 
18 	optionsRef = CreateOptionsRef();
19 
20 	TestVarOp(OP_SET, varToTest, DefaultSetVal, KERN_SUCCESS, optionsRef);
21 	TestVarOp(OP_GET, varToTest, NULL, KERN_SUCCESS, optionsRef);
22 	TestVarOp(OP_DEL, varToTest, NULL, KERN_SUCCESS, optionsRef);
23 
24 	ReleaseOptionsRef(optionsRef);
25 #else
26 	T_PASS("Test not supported");
27 #endif /* !(__x86_64__) */
28 }
29