Loading...
--- libmalloc/libmalloc-283.100.6/tests/Makefile
+++ libmalloc/libmalloc-521.120.7/tests/Makefile
@@ -1,7 +1,7 @@
PROJECT := libmalloc
TEST_DIR := tests/
-DEVELOPER_DIR ?= /Applications/Xcode.app/Contents/Developer/
+DEVELOPER_DIR ?= $(shell xcode-select -p)
include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.common
@@ -12,13 +12,9 @@
# exclude_this_file.mtrace
EXCLUDED_TRACE_FILES :=
-CUSTOM_TARGETS = \
- MALLOC_BENCH
-
OTHER_TEST_TARGETS = \
$(addprefix nano-trace-replay_, $(basename $(filter-out $(EXCLUDED_TRACE_FILES), $(TRACE_FILES))))
-MALLOCBENCHTEST_DIR = $(SRCROOT)/MallocBenchTest
BATS_PLISTS_EXTRACT = \
$(patsubst %,$(SYMROOT)/%.plist,$(OTHER_TEST_TARGETS))
@@ -29,7 +25,12 @@
WARNING_CFLAGS := -Wno-format-invalid-specifier -Wno-format-extra-args
OTHER_CFLAGS += \
-DDARWINTEST \
+ -DOS_ATOMIC_CONFIG_MEMORY_ORDER_DEPENDENCY=1 \
-DOS_UNFAIR_LOCK_INLINE=1 \
+ -DT_META_TAG_XZONE=T_META_TAG\(\"xzone\"\) \
+ -DT_META_TAG_XZONE_ONLY=T_META_TAG\(\"xzone_only\"\) \
+ -fno-builtin \
+ -fno-typed-memory-operations \
-lCrashReporterClient \
-I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders \
-I$(SRCROOT)/../private \
@@ -44,25 +45,18 @@
$(CFLAGS) $(DT_CFLAGS) $(OTHER_CFLAGS) \
$(LDFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) \
-DTRACE_NAME="$(patsubst nano-trace-replay_%,%,$(notdir $@))" \
+ $(patsubst _Photos_puja,-DTEST_TIMEOUT=3000,$(findstring _Photos_puja,$(notdir $@))) \
-o $@ \
$(SRCROOT)/nano_trace_replay.c
-# For now, we only build and run MallocBench on iOS. macOS requires
-# us to adopt installAPI.
-LOWER_SDKROOT = $(shell echo $(SDKROOT) | tr '[:upper:]' '[:lower:]')
-ifneq (, $(findstring iphoneos,$(LOWER_SDKROOT)))
-include MallocBenchTest/Makefile.malloc-bench
-BATS_PLISTS = $(BATS_PLISTS_EXTRACT) $(MALLOCBENCHTEST_DIR)/MallocBench.plist
-else
-include MallocBenchTest/Makefile.dummy
BATS_PLISTS = $(BATS_PLISTS_EXTRACT)
-endif
+BATS_PLISTS += $(PROJECT_DIR)/tests/xctests/BATS.plist
$(BATS_PLISTS_EXTRACT): %.plist : %
$(EXTRACTMETA) extract -i /$(INSTALLPATH)/$(notdir $<) -b $(SYMROOT)/$(notdir $<) -o $@
@plutil -convert binary1 $@
-SANITIZER_DYLIB_PATH := /usr/local/lib/sanitizers/
+SANITIZER_DYLIB_PATH := /usr/appleinternal/lib/sanitizers/
asan: OTHER_CFLAGS += -fsanitize=address
asan: OTHER_LDFLAGS += -Wl,-rpath -Wl,$(SANITIZER_DYLIB_PATH)
@@ -73,7 +67,46 @@
EXCLUDED_SOURCES += tsan.c
endif
+bounds_test: OTHER_CFLAGS += -fbounds-attributes
+
+malloc_msl: OTHER_CFLAGS += -F $(PRIVATE_FRAMEWORKS)
+malloc_msl: OTHER_CFLAGS += -framework MallocStackLogging
+malloc_msl: OTHER_LDFLAGS += -F $(PRIVATE_FRAMEWORKS)
+malloc_msl: OTHER_LDFLAGS += -framework MallocStackLogging
+
+malloc_with_options_test: OTHER_LDFLAGS += -F $(PRIVATE_FRAMEWORKS)
+malloc_with_options_test: OTHER_LDFLAGS += -framework ktrace
+malloc_with_options_test: OTHER_CFLAGS += -I../src
+
madvise: OTHER_CFLAGS += -I../src
+malloc_claimed_address_tests: OTHER_CFLAGS += -I../src
+scribble_tests: OTHER_CFLAGS += -I../src
+malloc_size_test: OTHER_CFLAGS += -I../src
+
+xzone: OTHER_LDFLAGS += -ldarwintest_utils
+
+malloc_type: OTHER_CFLAGS += -ftyped-memory-operations
+
+EXCLUDED_SOURCES += malloc_type_callsite_cpp.cpp
+
+malloc_type_callsite_cpp.o: malloc_type_callsite_cpp.cpp
+ $(CXX) $(OTHER_CXXFLAGS) $(CXXFLAGS) -fno-typed-memory-operations -fno-typed-cxx-new-delete -c $< -o $(SYMROOT)/$@
+
+malloc_type_callsite: malloc_type_callsite_cpp.o
+malloc_type_callsite: OTHER_CFLAGS += $(SYMROOT)/malloc_type_callsite_cpp.o
+malloc_type_callsite: OTHER_LDFLAGS += -lc++
+
+# BATS test plist handling
+# - Modify plist (add tests) to run general tests again with xzone malloc enabled
+project_test_configs: bats.plist
+ cp ./libmalloc_pgm.plist $(DSTROOT)/AppleInternal/CoreOS/BATS/unit_tests/
+ xcrun -sdk $(SDKROOT) python3 ./add_xzone_tests.py $(SYMROOT)/bats.plist --platform $(PLATFORM)
+
+.PHONY: project_test_configs
+
+# Ensure that we add the xzone tests before bats.plist is installed to the
+# dstroot
+install: project_test_configs
.DEFAULT_GOAL := all