summaryrefslogtreecommitdiffstats
path: root/unittests/Driver/MultilibTest.cpp
diff options
context:
space:
mode:
authorJordan Rupprecht <rupprecht@google.com>2019-05-14 21:58:59 +0000
committerJordan Rupprecht <rupprecht@google.com>2019-05-14 21:58:59 +0000
commitb35a2aa71f76a334a9c98c0a3c3995b5d902d2b9 (patch)
treecdff4a5d1a715d4ad622fd8f190128b54bebe440 /unittests/Driver/MultilibTest.cpp
parent3748d41833787fcbf59cc5624e8d2b042a8991bc (diff)
parent741e05796da92b46d4f7bcbee00702ff37df6489 (diff)
Creating branches/google/stable and tags/google/stable/2019-05-14 from r360103upstream/google/stable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/stable@360714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Driver/MultilibTest.cpp')
-rw-r--r--unittests/Driver/MultilibTest.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/unittests/Driver/MultilibTest.cpp b/unittests/Driver/MultilibTest.cpp
index c5e8e0970d..0731c81d9f 100644
--- a/unittests/Driver/MultilibTest.cpp
+++ b/unittests/Driver/MultilibTest.cpp
@@ -1,9 +1,8 @@
//===- unittests/Driver/MultilibTest.cpp --- Multilib tests ---------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -350,3 +349,27 @@ TEST(MultilibTest, SetCombineWith) {
Latte.combineWith(Milk);
ASSERT_EQ(Latte.size(), (unsigned)2);
}
+
+TEST(MultilibTest, SetPriority) {
+ MultilibSet MS;
+ MS.push_back(Multilib("foo", {}, {}, 1).flag("+foo"));
+ MS.push_back(Multilib("bar", {}, {}, 2).flag("+bar"));
+
+ Multilib::flags_list Flags1;
+ Flags1.push_back("+foo");
+ Flags1.push_back("-bar");
+ Multilib Selection1;
+ ASSERT_TRUE(MS.select(Flags1, Selection1))
+ << "Flag set was {\"+foo\"}, but selection not found";
+ ASSERT_TRUE(Selection1.gccSuffix() == "/foo")
+ << "Selection picked " << Selection1 << " which was not expected";
+
+ Multilib::flags_list Flags2;
+ Flags2.push_back("+foo");
+ Flags2.push_back("+bar");
+ Multilib Selection2;
+ ASSERT_TRUE(MS.select(Flags2, Selection2))
+ << "Flag set was {\"+bar\"}, but selection not found";
+ ASSERT_TRUE(Selection2.gccSuffix() == "/bar")
+ << "Selection picked " << Selection2 << " which was not expected";
+}