Loading...
--- libmalloc/libmalloc-792.60.6/tests/pgm_zone_api.c
+++ libmalloc/libmalloc-646.40.3/tests/pgm_zone_api.c
@@ -7,10 +7,7 @@
 
 #include <darwintest.h>
 
-// TODO: support these tests with xzone malloc - currently their direct
-// manipulation of the wrapped zone may prevent this (not tested)
-T_GLOBAL_META(T_META_RUN_CONCURRENTLY(TRUE), T_META_NAMESPACE("pgm"),
-		T_META_TAG_MAGAZINE_ONLY);
+T_GLOBAL_META(T_META_RUN_CONCURRENTLY(TRUE), T_META_NAMESPACE("pgm"));
 
 #define PGM_MOCK_SHOULD_SAMPLE_COUNTER
 static uint32_t should_sample_counter_call_count;
@@ -60,11 +57,10 @@
 {
 	T_ATEND(teardown);
 
-	wrapped_zone.version = 16;
+	wrapped_zone.version = 13;
 	wrapped_zone.calloc = malloc_default_zone()->calloc;
 	zone = (pgm_zone_t *)pgm_create_zone(&wrapped_zone);
 	wrapped_zone.calloc = NULL;
-	wrapped_zone.version = 0;
 }
 
 T_DECL(optional_apis, "Restrict zone API to what is supported by wrapped zone", T_META_TAG_VM_PREFERRED)
@@ -77,16 +73,15 @@
 	T_EXPECT_NOTNULL(z->batch_malloc, NULL);
 	T_EXPECT_NOTNULL(z->batch_free, NULL);
 	T_EXPECT_NOTNULL(z->pressure_relief, NULL);
+	T_EXPECT_NOTNULL(z->malloc_with_options, NULL);
 
 	// Never supported
 	T_EXPECT_NULL(z->try_free_default, NULL);
 
 	// Supported if wrapped zone has it
 	T_EXPECT_NULL(z->memalign, NULL);
-	T_EXPECT_NULL(z->malloc_type_memalign, NULL);
 	T_EXPECT_NULL(z->free_definite_size, NULL);
 	T_EXPECT_NULL(z->claimed_address, NULL);
-	T_EXPECT_NULL(z->malloc_type_malloc_with_options, NULL);
 }
 
 static size_t wrapped_zone_malloc_expected_size = size;
@@ -190,12 +185,14 @@
 	return ++wrapped_zone_memalign_ret_value;
 }
 
-T_DECL(memalign_invalid_alignment, "memalign delegates for alignment greater than page size", T_META_TAG_VM_PREFERRED)
+T_DECL(memalign_invalid_alignment, "memalign delegates for invalid alignment", T_META_TAG_VM_PREFERRED)
 {
 	wrapped_zone.memalign = wrapped_zone_memalign;
 	setup();
 
 	T_EXPECT_EQ(CALL(memalign, 2 * PAGE_SIZE, size), (void *)1, "alignment > page size");
+	T_EXPECT_EQ(CALL(memalign, 32+16, size), (void *)2, "alignment not a power of 2");
+	T_EXPECT_EQ(CALL(memalign, sizeof(void *) / 2, size), (void *)3, "alignment < sizeof(void *)");
 }
 
 static void *