I'm trying to test some code that's entirely stand-alone from my app, and in 
fact I'm having trouble testing it within my app because the app does some 
things that interfere.

So, I tried creating a new test target and specifying "None" for the Test Host, 
then adding the files needed to the new test target.

One of these files is a .dylib (and associated module map file). I finally got 
everything to link, but at run time it couldn't find the dylib. So I added the 
path to the dylib in the runtime search path, and now it finds it, but the test 
crashes in the dyld loader:

#0      0x000000010b500711 in memcmp ()
#1      0x000000010b4f5abf in 
ImageLoaderMachO::validateFirstPages(linkedit_data_command const*, int, 
unsigned char const*, unsigned long, long long, ImageLoader::LinkContext 
const&) ()
#2      0x000000010b4f88fa in 
ImageLoaderMachOCompressed::instantiateFromFile(char const*, int, unsigned char 
const*, unsigned long, unsigned long long, unsigned long long, stat const&, 
unsigned int, unsigned int, linkedit_data_command const*, 
encryption_info_command const*, ImageLoader::LinkContext const&) ()
#3      0x000000010b4f4d01 in ImageLoaderMachO::instantiateFromFile(char 
const*, int, unsigned char const*, unsigned long, unsigned long long, unsigned 
long long, stat const&, ImageLoader::LinkContext const&) ()
#4      0x000000010b4e9289 in dyld::loadPhase6(int, stat const&, char const*, 
dyld::LoadContext const&) ()
#5      0x000000010b4eccac in dyld::loadPhase5(char const*, char const*, 
dyld::LoadContext const&, unsigned int&, std::__1::vector<char const*, 
std::__1::allocator<char const*> >*) ()
#6      0x000000010b4eca6f in dyld::loadPhase4(char const*, char const*, 
dyld::LoadContext const&, unsigned int&, std::__1::vector<char const*, 
std::__1::allocator<char const*> >*) ()
#7      0x000000010b4ec3de in dyld::loadPhase3(char const*, char const*, 
dyld::LoadContext const&, unsigned int&, std::__1::vector<char const*, 
std::__1::allocator<char const*> >*) ()
#8      0x000000010b4ec05e in dyld::loadPhase1(char const*, char const*, 
dyld::LoadContext const&, unsigned int&, std::__1::vector<char const*, 
std::__1::allocator<char const*> >*) ()
#9      0x000000010b4e8fed in dyld::loadPhase0(char const*, char const*, 
dyld::LoadContext const&, unsigned int&, std::__1::vector<char const*, 
std::__1::allocator<char const*> >*) ()
#10     0x000000010b4e8d28 in dyld::load(char const*, dyld::LoadContext const&, 
unsigned int&) ()
#11     0x000000010b4ed097 in dyld::libraryLocator(char const*, bool, char 
const*, ImageLoader::RPathChain const*, unsigned int&) ()
#12     0x000000010b4f24f2 in 
ImageLoader::recursiveLoadLibraries(ImageLoader::LinkContext const&, bool, 
ImageLoader::RPathChain const&, char const*) ()
#13     0x000000010b4f1913 in ImageLoader::link(ImageLoader::LinkContext 
const&, bool, bool, bool, ImageLoader::RPathChain const&, char const*) ()
#14     0x000000010b4ea474 in dyld::link(ImageLoader*, bool, bool, 
ImageLoader::RPathChain const&, unsigned int) ()
#15     0x000000010b4eeb7e in dlopen ()
#16     0x000000010d73fd25 in dlopen ()
#17     0x000000010c11f1c8 in _CFBundleDlfcnLoadBundle ()
#18     0x000000010c11f04f in _CFBundleLoadExecutableAndReturnError ()
#19     0x000000010b58c235 in -[NSBundle loadAndReturnError:] ()
#20     0x000000010baf9816 in _XCTestMain ()
#21     0x000000010b4de679 in ___lldb_unnamed_symbol3$$xctest ()
#22     0x000000010d74265d in start ()

The dyld itself has this:

$ file iOS/Controller/lib/MyLibrary/MyLibrary.dylib 
iOS/Controller/lib/MyLibrary/MyLibrary.dylib: Mach-O universal binary with 2 
architectures: [x86_64: Mach-O 64-bit dynamically linked shared library x86_64] 
[arm64]
iOS/Controller/lib/MyLibrary/MyLibrary.dylib (for architecture x86_64): Mach-O 
64-bit dynamically linked shared library x86_64
iOS/Controller/lib/MyLibrary/MyLibrary.dylib (for architecture arm64):  Mach-O 
64-bit dynamically linked shared library arm64

I don't have source code for the library.

Perhaps it's trying to link against the iOS SDK? How do I unit test, with 
minimal overhead (i.e. without having to run my entire app) some iOS-linked 
code?

-- 
Rick Mann
[email protected]


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to