diff options
Diffstat (limited to 'unittests/Driver/MultilibTest.cpp')
-rw-r--r-- | unittests/Driver/MultilibTest.cpp | 31 |
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"; +} |