dyld-832.7.1.tar.gz
[apple/dyld.git] / testing / kernel-cache-tests / large-auxkc-errors / test.py
1 #!/usr/bin/python2.7
2
3 import os
4 import KernelCollection
5
6 # The arm64e auxKC has a lower memory limit than other KCs. Verify that we get an error with only 64MB in there.
7
8 def check(kernel_cache):
9 # First build a kernel collection
10 kernel_cache.buildKernelCollection("arm64e", "/large-auxkc-errors/main.kc", "/large-auxkc-errors/main.kernel", "/large-auxkc-errors/extensions", [], [])
11 kernel_cache.analyze("/large-auxkc-errors/main.kc", ["-layout", "-arch", "arm64e"])
12
13 # Now build an aux cache using the baseline kernel collection
14 kernel_cache.buildAuxKernelCollection("arm64e", "/large-auxkc-errors/aux.kc", "/large-auxkc-errors/main.kc", "", "/large-auxkc-errors/extensions", ["com.apple.foo", "com.apple.bar"], ["-json-errors"])
15
16 assert len(kernel_cache.dictionary()) == 1
17 assert "kernel collection size exceeds maximum size of 67108864" in kernel_cache.dictionary()[0]
18
19
20 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64e -Wl,-static -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-rename_section,__TEXT,__text,__TEXT_EXEC,__text -Wl,-e,__start -Wl,-pagezero_size,0x0 -Wl,-pie main.c -o main.kernel
21 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64e -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const foo.c -o extensions/foo.kext/foo
22 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64e -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const bar.c -o extensions/bar.kext/bar
23 # [~]> rm -r extensions/*.kext/*.ld
24