xref: /xnu-11215/tests/ipc/port_api.c (revision 8d741a5d)
1 #include <darwintest.h>
2 #include <darwintest_utils.h>
3 
4 #include <mach/mach.h>
5 #include <mach/mach_types.h>
6 #include <mach/mach_vm.h>
7 #include <mach/message.h>
8 #include <mach/mach_error.h>
9 #include <mach/task.h>
10 
11 #include <pthread.h>
12 #include <pthread/workqueue_private.h>
13 
14 T_GLOBAL_META(
15 	T_META_NAMESPACE("xnu.ipc"),
16 	T_META_RUN_CONCURRENTLY(TRUE),
17 	T_META_RADAR_COMPONENT_NAME("xnu"),
18 	T_META_RADAR_COMPONENT_VERSION("IPC"));
19 
20 T_DECL(mach_port_insert_right_123724977, "regression test for 123724977")
21 {
22 	mach_port_name_t pset;
23 	kern_return_t kr;
24 
25 	kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_PORT_SET, &pset);
26 	T_ASSERT_MACH_SUCCESS(kr, "creating port set");
27 
28 	kr = mach_port_insert_right(mach_task_self(), pset, pset,
29 	    MACH_MSG_TYPE_MAKE_SEND);
30 	T_ASSERT_MACH_ERROR(kr, KERN_INVALID_RIGHT, "insert right fails");
31 }
32