summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Utility/ArchSpecTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/unittests/Utility/ArchSpecTest.cpp')
-rw-r--r--lldb/unittests/Utility/ArchSpecTest.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/lldb/unittests/Utility/ArchSpecTest.cpp b/lldb/unittests/Utility/ArchSpecTest.cpp
index d7397cbec53..a84112ea289 100644
--- a/lldb/unittests/Utility/ArchSpecTest.cpp
+++ b/lldb/unittests/Utility/ArchSpecTest.cpp
@@ -171,3 +171,53 @@ TEST(ArchSpecTest, MergeFromMachOUnknown) {
A.MergeFrom(B);
ASSERT_EQ(A.GetCore(), ArchSpec::eCore_uknownMach64);
}
+
+TEST(ArchSpecTest, Compatibility) {
+ {
+ ArchSpec A("x86_64-apple-macosx10.12");
+ ArchSpec B("x86_64-apple-macosx10.12");
+ ASSERT_TRUE(A.IsExactMatch(B));
+ ASSERT_TRUE(A.IsCompatibleMatch(B));
+ }
+ {
+ // The version information is auxiliary to support availablity but
+ // doesn't affect compatibility.
+ ArchSpec A("x86_64-apple-macosx10.11");
+ ArchSpec B("x86_64-apple-macosx10.12");
+ ASSERT_TRUE(A.IsExactMatch(B));
+ ASSERT_TRUE(A.IsCompatibleMatch(B));
+ }
+ {
+ ArchSpec A("x86_64-apple-macosx10.13");
+ ArchSpec B("x86_64h-apple-macosx10.13");
+ ASSERT_FALSE(A.IsExactMatch(B));
+ ASSERT_TRUE(A.IsCompatibleMatch(B));
+ }
+ {
+ ArchSpec A("x86_64-apple-macosx");
+ ArchSpec B("x86_64-apple-ios-simulator");
+ ASSERT_FALSE(A.IsExactMatch(B));
+ ASSERT_FALSE(A.IsCompatibleMatch(B));
+ }
+ {
+ ArchSpec A("x86_64-*-*");
+ ArchSpec B("x86_64-apple-ios-simulator");
+ ASSERT_FALSE(A.IsExactMatch(B));
+ ASSERT_FALSE(A.IsCompatibleMatch(B));
+ }
+ {
+ ArchSpec A("arm64-*-*");
+ ArchSpec B("arm64-apple-ios");
+ ASSERT_FALSE(A.IsExactMatch(B));
+ // FIXME: This looks unintuitive and we should investigate whether
+ // thi is the desired behavior.
+ ASSERT_FALSE(A.IsCompatibleMatch(B));
+ }
+ {
+ ArchSpec A("x86_64-*-*");
+ ArchSpec B("x86_64-apple-ios-simulator");
+ ASSERT_FALSE(A.IsExactMatch(B));
+ // FIXME: See above, though the extra environment complicates things.
+ ASSERT_FALSE(A.IsCompatibleMatch(B));
+ }
+}
OpenPOWER on IntegriCloud