import os
import KernelCollection
def check(kernel_cache):
kernel_cache.buildKernelCollection("arm64", "/auxkc-pageablekc-uuid/main.kc", "/auxkc-pageablekc-uuid/main.kernel", "/auxkc-pageablekc-uuid/extensions", [], [])
kernel_cache.analyze("/auxkc-pageablekc-uuid/main.kc", ["-layout", "-arch", "arm64"])
kernel_cache.analyze("/auxkc-pageablekc-uuid/main.kc", ["-uuid", "-arch", "arm64"])
kernelUUID = kernel_cache.dictionary()["uuid"]
assert kernelUUID != "00000000-0000-0000-0000-000000000000"
assert kernelUUID == kernel_cache.dictionary()["prelink-info-uuid"]
kernel_cache.buildPageableKernelCollection("arm64", "/auxkc-pageablekc-uuid/pageable.kc", "/auxkc-pageablekc-uuid/main.kc", "/auxkc-pageablekc-uuid/extensions", ["com.apple.foo", "com.apple.bar"], [])
kernel_cache.analyze("/auxkc-pageablekc-uuid/pageable.kc", ["-uuid", "-arch", "arm64"])
pageableUUID = kernel_cache.dictionary()["uuid"]
assert pageableUUID != "00000000-0000-0000-0000-000000000000"
assert kernel_cache.dictionary()["prelink-info-base-uuid"] == kernelUUID
kernel_cache.buildAuxKernelCollection("arm64", "/auxkc-pageablekc-uuid/aux.kc", "/auxkc-pageablekc-uuid/main.kc", "/auxkc-pageablekc-uuid/pageable.kc", "/auxkc-pageablekc-uuid/extensions", ["com.apple.foo", "com.apple.bar"], [])
kernel_cache.analyze("/auxkc-pageablekc-uuid/aux.kc", ["-uuid", "-arch", "arm64"])
assert kernel_cache.dictionary()["uuid"] != "00000000-0000-0000-0000-000000000000"
assert kernel_cache.dictionary()["prelink-info-base-uuid"] == kernelUUID
assert kernel_cache.dictionary()["prelink-info-pageable-uuid"] == pageableUUID