]> git.saurik.com Git - apple/dyld.git/blob - testing/kernel-cache-tests/kext-relative-paths/test.py
dyld-851.27.tar.gz
[apple/dyld.git] / testing / kernel-cache-tests / kext-relative-paths / test.py
1 #!/usr/bin/python2.7
2
3 import os
4 import KernelCollection
5
6 # Foo has a macOS style bundle layout while bar is an iOS style layout. Make sure we
7 # get the relative path right in each case
8
9 def check(kernel_cache):
10 kernel_cache.buildKernelCollection("arm64", "/kext-relative-paths/main.kc", "/kext-relative-paths/main.kernel", "/kext-relative-paths/extensions", ["com.apple.foo", "com.apple.bar"], [])
11 kernel_cache.analyze("/kext-relative-paths/main.kc", ["-layout", "-arch", "arm64"])
12
13 assert len(kernel_cache.dictionary()["dylibs"]) == 3
14 # main.kernel
15 assert kernel_cache.dictionary()["dylibs"][0]["name"] == "com.apple.kernel"
16 # bar.kext
17 assert kernel_cache.dictionary()["dylibs"][1]["name"] == "com.apple.bar"
18 assert kernel_cache.dictionary()["dylibs"][1]["relativePath"] == "bar"
19 # foo.kext
20 assert kernel_cache.dictionary()["dylibs"][2]["name"] == "com.apple.foo"
21 assert kernel_cache.dictionary()["dylibs"][2]["relativePath"] == "Contents/MacOS/foo"
22
23
24 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -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
25 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const foo.c -o extensions/foo.kext/Contents/MacOS/foo
26 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const bar.c -o extensions/bar.kext/bar
27 # [~]> rm -r extensions/*.kext/*.ld
28