Loading...
--- libmalloc/libmalloc-646.40.3/tests/add_xzone_tests.py
+++ libmalloc/libmalloc-715.140.5/tests/add_xzone_tests.py
@@ -5,10 +5,12 @@
import plistlib
from os.path import exists
-def create_xzone_test(test, nano_on_xzone):
+def create_xzone_test(test, nano_on_xzone=False, force_pgm=False):
xzone_test = copy.deepcopy(test)
extension = 'nano-on-xzone' if nano_on_xzone else 'xzone'
+ if force_pgm:
+ extension += '.pgm'
if 'TestName' in xzone_test:
orig_name = xzone_test['TestName']
@@ -29,6 +31,7 @@
xzone_test['CanonicalName'] = new_name
envvars = [
+ 'MallocAllowInternalSecurity=1',
'MallocSecureAllocator=1',
]
@@ -37,6 +40,13 @@
envvars.append('MallocNanoOnXzone=1')
else:
envvars.append('MallocSecureAllocatorNano=1')
+
+ if force_pgm:
+ # If we're forcing PGM, it should already be disabled in the test
+ # we're starting with
+ assert('MallocProbGuard=0' in xzone_test['ShellEnv'])
+ xzone_test['ShellEnv'].remove('MallocProbGuard=0')
+ envvars.append('MallocProbGuard=1')
if 'perf' not in xzone_test['Tags'] and \
'no_debug' not in xzone_test['Tags'] and \
@@ -75,21 +85,37 @@
# Keep the original test, unless it's xzone-only
if 'Tags' not in test or 'xzone_only' not in test['Tags']:
test_copy = copy.deepcopy(test)
- # Explicitly disable xzone malloc, so that the old allocator is
- # still tested on platforms that have xzone malloc by default
- envvars = ['MallocSecureAllocator=0']
- extend_env(test_copy, envvars)
+
+ if 'Tags' not in test or 'no_allocator_override' not in test['Tags']:
+ # Explicitly disable xzone malloc, so that the old allocator is
+ # still tested on platforms that have xzone malloc by default
+ envvars = [
+ 'MallocAllowInternalSecurity=1',
+ 'MallocSecureAllocator=0',
+ ]
+ extend_env(test_copy, envvars)
+
tests.append(test_copy)
if 'Tags' in test and not disable_xzone:
if 'xzone' in test['Tags'] or 'xzone_only' in test['Tags']:
# This test has been tagged to run with xzone malloc
- xzone_test = create_xzone_test(test, False)
+ xzone_test = create_xzone_test(test)
tests.append(xzone_test)
+ if 'xzone_and_pgm' in test['Tags']:
+ xzone_and_pgm_test = create_xzone_test(test,
+ nano_on_xzone=False, force_pgm=True)
+ tests.append(xzone_and_pgm_test)
+
if 'nano_on_xzone' in test['Tags']:
- nano_on_xzone_test = create_xzone_test(test, True)
+ nano_on_xzone_test = create_xzone_test(test, nano_on_xzone=True)
tests.append(nano_on_xzone_test)
+
+ if 'xzone_and_pgm' in test['Tags']:
+ pgm_on_nano_on_xzone_test = create_xzone_test(test,
+ nano_on_xzone=True, force_pgm=True)
+ tests.append(pgm_on_nano_on_xzone_test)
new_bats_plist['Tests'] = tests