Loading...
tests/enablement_tests.m libmalloc-792.41.1 libmalloc-792.1.1
--- libmalloc/libmalloc-792.41.1/tests/enablement_tests.m
+++ libmalloc/libmalloc-792.1.1/tests/enablement_tests.m
@@ -9,7 +9,7 @@
 #include <darwintest_utils.h>
 #include <../src/internal.h>
 
-#if CONFIG_XZONE_MALLOC && (MALLOC_TARGET_IOS_ONLY || TARGET_OS_OSX || TARGET_OS_VISION || TARGET_OS_WATCH)
+#if CONFIG_XZONE_MALLOC && (MALLOC_TARGET_IOS_ONLY || TARGET_OS_OSX || TARGET_OS_VISION)
 
 #include <Foundation/Foundation.h>
 #include <Foundation/NSJSONSerialization.h>
@@ -385,9 +385,6 @@
 #elif TARGET_OS_OSX
 		.batch_size = space_efficient ? 0 : 10,
 		.ptr_bucket_count = 4,
-#elif TARGET_OS_WATCH
-		.batch_size = 0,
-		.ptr_bucket_count = 2,
 #else
 		.batch_size = 0,
 		.ptr_bucket_count = 3,
@@ -422,8 +419,6 @@
 		.batch_size = 0,
 #if TARGET_OS_OSX || TARGET_OS_VISION
 		.ptr_bucket_count = 4,
-#elif TARGET_OS_WATCH
-		.ptr_bucket_count = 2,
 #else
 		.ptr_bucket_count = 3,
 #endif
@@ -439,12 +434,11 @@
 			&configuration);
 }
 
-void terminate_process(pid_t pid)
-{
-	T_EXPECT_POSIX_SUCCESS(kill(pid, SIGKILL), "terminated process");
-}
-
-T_GLOBAL_META(T_META_TAG_NO_ALLOCATOR_OVERRIDE);
+void terminate_process(pid_t pid) {
+	char terminate_process_buffer[PID_BUFFER_SIZE] = {};
+	snprintf(terminate_process_buffer, PID_BUFFER_SIZE, "kill -9 %d", pid);
+	T_ASSERT_POSIX_ZERO(system(terminate_process_buffer), "terminated process");
+}
 
 T_DECL(xzone_enabled_launchd,
 		"Verify enablement configuration for security critical processes"
@@ -472,8 +466,6 @@
 	security_critical_configuration_checks("notifyd");
 }
 
-#if !TARGET_OS_WATCH
-
 // This test needs to be run as the local (non-root) user on macOS in order to
 // successfully launch Safari
 T_DECL(xzone_enabled_safari,
@@ -510,11 +502,6 @@
 	terminate_process(safari_pid);
 #endif
 }
-
-#endif // !TARGET_OS_WATCH
-
-// TODO: port this test to watchOS
-#if !TARGET_OS_WATCH
 
 T_DECL(xzone_enabled_driverkit,
 		"Verify enablement configuration for Driverkit processes",
@@ -537,8 +524,6 @@
 		.batch_size = 0,
 #if TARGET_OS_OSX || TARGET_OS_VISION
 		.ptr_bucket_count = 4,
-#elif TARGET_OS_WATCH
-		.ptr_bucket_count = 2,
 #else
 		.ptr_bucket_count = 3,
 #endif
@@ -558,8 +543,6 @@
 	terminate_process(driver_test_pid);
 }
 
-#endif // !TARGET_OS_WATCH
-
 T_DECL(xzone_enabled_general_process_test_runner,
 		"Verify enablement configuration for general processes (the test" "process itself)",
 		T_META_TAG_VM_NOT_ELIGIBLE,
@@ -578,8 +561,6 @@
 #endif
 #if TARGET_OS_OSX || TARGET_OS_VISION
 		.ptr_bucket_count = 4,
-#elif TARGET_OS_WATCH
-		.ptr_bucket_count = 1,
 #else
 		.ptr_bucket_count = 2,
 #endif
@@ -618,8 +599,6 @@
 		.batch_size = 0,
 #if TARGET_OS_VISION || TARGET_OS_OSX
 		.ptr_bucket_count = 4,
-#elif TARGET_OS_WATCH
-		.ptr_bucket_count = 1,
 #else
 		.ptr_bucket_count = 2,
 #endif
@@ -671,8 +650,6 @@
 }
 #endif // TARGET_OS_OSX
 
-#if !TARGET_OS_WATCH
-
 T_DECL(xzone_enabled_general_app,
 		"Verify enablement configuration for a general app (Notes)",
 		T_META_TAG_VM_NOT_ELIGIBLE)
@@ -740,8 +717,6 @@
 #endif // TARGET_OS_OSX
 }
 
-#endif // !TARGET_OS_WATCH
-
 T_DECL(xzone_enabled_hardened_heap_entitlement_space_efficient,
 		"Verify enablement configuration for hardened-heap entitled process"
 		" (SpaceEfficient configuration)",
@@ -771,8 +746,6 @@
 
 	terminate_process(pid);
 }
-
-#if !TARGET_OS_WATCH
 
 T_DECL(xzone_enabled_hardened_heap_entitlement_non_space_efficient,
 		"Verify enablement configuration for hardened-heap entitled process"
@@ -808,8 +781,6 @@
 	terminate_process(pid);
 }
 
-#endif // !TARGET_OS_WATCH
-
 #if MALLOC_TARGET_IOS_ONLY
 
 T_DECL(xzone_enabled_hardened_browser_entitlement,
@@ -831,14 +802,13 @@
 	terminate_process(pid);
 }
 
-#endif // MALLOC_TARGET_IOS_ONLY
+#endif
 
 #else // CONFIG_XZONE_MALLOC && (MALLOC_TARGET_IOS_ONLY || TARGET_OS_OSX ||
-// TARGET_OS_VISION || TARGET_OS_WATCH)
-T_DECL(skip_json_printer_tests, "Skip printer tests",
-		T_META_TAG_VM_PREFERRED, T_META_TAG_NO_ALLOCATOR_OVERRIDE)
-{
-	T_SKIP("Nothing to test without xzone malloc");
+// TARGET_OS_VISION)
+T_DECL(skip_json_printer_tests, "Skip printer tests")
+{
+	T_SKIP("Nothing to test without xzone malloc on ios/macos/visionos");
 }
 #endif // CONFIG_XZONE_MALLOC && (MALLOC_TARGET_IOS_ONLY || TARGET_OS_OSX ||
 // TARGET_OS_VISION)