int export_drecord_cb( ipfixs_node_t *s, ipfixt_node_t *t, ipfix_datarecord_t *d, void *arg ) { reexport(t, d); return 0; }
TEST(TBDv2, ReadFile) { static const char tbd_v2_file1[] = "--- !tapi-tbd-v2\n" "archs: [ armv7, armv7s, armv7k, arm64 ]\n" "platform: ios\n" "flags: [ installapi ]\n" "install-name: Test.dylib\n" "current-version: 2.3.4\n" "compatibility-version: 1.0\n" "swift-version: 1.1\n" "parent-umbrella: Umbrella.dylib\n" "exports:\n" " - archs: [ armv7, armv7s, armv7k, arm64 ]\n" " allowable-clients: [ clientA ]\n" " re-exports: [ /usr/lib/libfoo.dylib ]\n" " symbols: [ _sym1, _sym2, _sym3, _sym4, $ld$hide$os9.0$_sym1 ]\n" " objc-classes: [ _class1, _class2 ]\n" " objc-ivars: [ _class1._ivar1, _class1._ivar2 ]\n" " weak-def-symbols: [ _weak1, _weak2 ]\n" " thread-local-symbols: [ _tlv1, _tlv2 ]\n" " - archs: [ armv7, armv7s, armv7k ]\n" " symbols: [ _sym5 ]\n" " objc-classes: [ _class3 ]\n" " objc-ivars: [ _class1._ivar3 ]\n" " weak-def-symbols: [ _weak3 ]\n" " thread-local-symbols: [ _tlv3 ]\n" "...\n"; auto Buffer = MemoryBuffer::getMemBuffer(tbd_v2_file1, "Test.tbd"); auto Result = TextAPIReader::get(std::move(Buffer)); EXPECT_TRUE(!!Result); auto File = std::move(Result.get()); EXPECT_EQ(FileType::TBD_V2, File->getFileType()); auto Archs = AK_armv7 | AK_armv7s | AK_armv7k | AK_arm64; EXPECT_EQ(Archs, File->getArchitectures()); EXPECT_EQ(PlatformKind::iOS, File->getPlatform()); EXPECT_EQ(std::string("Test.dylib"), File->getInstallName()); EXPECT_EQ(PackedVersion(2, 3, 4), File->getCurrentVersion()); EXPECT_EQ(PackedVersion(1, 0, 0), File->getCompatibilityVersion()); EXPECT_EQ(2U, File->getSwiftABIVersion()); EXPECT_EQ(ObjCConstraintType::Retain_Release, File->getObjCConstraint()); EXPECT_TRUE(File->isTwoLevelNamespace()); EXPECT_TRUE(File->isApplicationExtensionSafe()); EXPECT_TRUE(File->isInstallAPI()); InterfaceFileRef client("clientA", Archs); InterfaceFileRef reexport("/usr/lib/libfoo.dylib", Archs); EXPECT_EQ(1U, File->allowableClients().size()); EXPECT_EQ(client, File->allowableClients().front()); EXPECT_EQ(1U, File->reexportedLibraries().size()); EXPECT_EQ(reexport, File->reexportedLibraries().front()); ExportedSymbolSeq Exports; for (const auto *Sym : File->symbols()) { EXPECT_FALSE(Sym->isWeakReferenced()); EXPECT_FALSE(Sym->isUndefined()); Exports.emplace_back(ExportedSymbol{Sym->getKind(), Sym->getName(), Sym->isWeakDefined(), Sym->isThreadLocalValue()}); } llvm::sort(Exports.begin(), Exports.end()); EXPECT_EQ(sizeof(TBDv2Symbols) / sizeof(ExportedSymbol), Exports.size()); EXPECT_TRUE( std::equal(Exports.begin(), Exports.end(), std::begin(TBDv2Symbols))); }