1 //
2 // simple_test.c
3 // DiagThresholdTest
4 //
5 //
6
7 #include <stdio.h>
8 #include "vm/diag_threshold_test.h"
9 #include <sys/kern_memorystatus.h>
10
11 static void simple_test_execution(struct test_case *test_case, void *param);
12 T_GLOBAL_META(
13 T_META_ENABLED(TARGET_OS_IPHONE),
14 T_META_NAMESPACE("xnu.vm.100432442"),
15 T_META_RADAR_COMPONENT_NAME("xnu"),
16 T_META_OWNER("jsolsona"),
17 T_META_RADAR_COMPONENT_VERSION("VM")
18 );
19
20
21 static test_case_t diag_mem_threshold_simple_test = {
22 .short_name = "simple_test1",
23 .test_name = "Simple test, set a limit and wait for exception",
24 .test_code = simple_test_execution,
25 .result_already_present = FALSE,
26 .exception_not_expected = FALSE,
27 };
28
29 static void
simple_test_execution(__unused struct test_case * test_case,void * param)30 simple_test_execution(__unused struct test_case *test_case, void *param)
31 {
32 test_context_t *info = (test_context_t *)param;
33 dispatch_semaphore_signal(info->executor_ready_for_exceptions);
34 (void)set_memory_diagnostics_threshold_limits(WORKING_LIMIT, true);
35 diag_mem_threshold_waste_memory(TEST_LIMIT);
36 }
37
38
39 T_DECL(diag_mem_threshold_simple_test,
40 "Simple test, set a limit and wait for exception", T_META_TAG_VM_PREFERRED)
41 {
42 diag_mem_threshold_set_setup(&diag_mem_threshold_simple_test);
43 }
44