lamikr created this revision.
lamikr added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, aemerson.
- add Mageia definition and IsMageia method
- add Mageia name for triples arrays used for x86, x86_64 and 32-bit ARM soft
and hard floating point toolchains
- --hash-style=gnu enabled just like for RedHat and OpenSUSE
- --no-add-needed enabled
- added the detection of Mageia distro to unittests (tested on upcoming mageia
6)
https://reviews.llvm.org/D28144
Files:
include/clang/Driver/Distro.h
lib/Driver/Distro.cpp
lib/Driver/ToolChains.cpp
unittests/Driver/DistroTest.cpp
Index: unittests/Driver/DistroTest.cpp
===
--- unittests/Driver/DistroTest.cpp
+++ unittests/Driver/DistroTest.cpp
@@ -51,6 +51,7 @@
ASSERT_FALSE(UbuntuTrusty.IsRedhat());
ASSERT_FALSE(UbuntuTrusty.IsOpenSUSE());
ASSERT_FALSE(UbuntuTrusty.IsDebian());
+ ASSERT_FALSE(UbuntuTrusty.IsMageia());
vfs::InMemoryFileSystem UbuntuYakketyFileSystem;
UbuntuYakketyFileSystem.addFile("/etc/debian_version", 0,
@@ -80,6 +81,7 @@
ASSERT_FALSE(UbuntuYakkety.IsRedhat());
ASSERT_FALSE(UbuntuYakkety.IsOpenSUSE());
ASSERT_FALSE(UbuntuYakkety.IsDebian());
+ ASSERT_FALSE(UbuntuYakkety.IsMageia());
}
TEST(DistroTest, DetectRedhat) {
@@ -114,6 +116,7 @@
ASSERT_TRUE(Fedora25.IsRedhat());
ASSERT_FALSE(Fedora25.IsOpenSUSE());
ASSERT_FALSE(Fedora25.IsDebian());
+ ASSERT_FALSE(Fedora25.IsMageia());
vfs::InMemoryFileSystem CentOS7FileSystem;
CentOS7FileSystem.addFile("/etc/system-release-cpe", 0,
@@ -150,6 +153,7 @@
ASSERT_TRUE(CentOS7.IsRedhat());
ASSERT_FALSE(CentOS7.IsOpenSUSE());
ASSERT_FALSE(CentOS7.IsDebian());
+ ASSERT_FALSE(CentOS7.IsMageia());
}
TEST(DistroTest, DetectOpenSUSE) {
@@ -177,6 +181,7 @@
ASSERT_FALSE(OpenSUSELeap421.IsRedhat());
ASSERT_TRUE(OpenSUSELeap421.IsOpenSUSE());
ASSERT_FALSE(OpenSUSELeap421.IsDebian());
+ ASSERT_FALSE(OpenSUSELeap421.IsMageia());
vfs::InMemoryFileSystem OpenSUSE132FileSystem;
OpenSUSE132FileSystem.addFile("/etc/SuSE-release", 0,
@@ -202,6 +207,7 @@
ASSERT_FALSE(OpenSUSE132.IsRedhat());
ASSERT_TRUE(OpenSUSE132.IsOpenSUSE());
ASSERT_FALSE(OpenSUSE132.IsDebian());
+ ASSERT_FALSE(OpenSUSE132.IsMageia());
vfs::InMemoryFileSystem SLES10FileSystem;
SLES10FileSystem.addFile("/etc/SuSE-release", 0,
@@ -218,6 +224,7 @@
ASSERT_FALSE(SLES10.IsRedhat());
ASSERT_FALSE(SLES10.IsOpenSUSE());
ASSERT_FALSE(SLES10.IsDebian());
+ ASSERT_FALSE(SLES10.IsMageia());
}
TEST(DistroTest, DetectDebian) {
@@ -240,6 +247,7 @@
ASSERT_FALSE(DebianJessie.IsRedhat());
ASSERT_FALSE(DebianJessie.IsOpenSUSE());
ASSERT_TRUE(DebianJessie.IsDebian());
+ ASSERT_FALSE(DebianJessie.IsMageia());
vfs::InMemoryFileSystem DebianStretchSidFileSystem;
DebianStretchSidFileSystem.addFile("/etc/debian_version", 0,
@@ -258,6 +266,7 @@
ASSERT_FALSE(DebianStretchSid.IsRedhat());
ASSERT_FALSE(DebianStretchSid.IsOpenSUSE());
ASSERT_TRUE(DebianStretchSid.IsDebian());
+ ASSERT_FALSE(DebianStretchSid.IsMageia());
}
TEST(DistroTest, DetectExherbo) {
@@ -279,6 +288,7 @@
ASSERT_FALSE(Exherbo.IsRedhat());
ASSERT_FALSE(Exherbo.IsOpenSUSE());
ASSERT_FALSE(Exherbo.IsDebian());
+ ASSERT_FALSE(Exherbo.IsMageia());
}
TEST(DistroTest, DetectArchLinux) {
@@ -300,6 +310,32 @@
ASSERT_FALSE(ArchLinux.IsRedhat());
ASSERT_FALSE(ArchLinux.IsOpenSUSE());
ASSERT_FALSE(ArchLinux.IsDebian());
+ ASSERT_FALSE(ArchLinux.IsMageia());
}
+TEST(DistroTest, DetectMageia) {
+ vfs::InMemoryFileSystem curDistroFS;
+ curDistroFS.addFile("/etc/mageia-release", 0, // (empty)
+ llvm::MemoryBuffer::getMemBuffer(""));
+ curDistroFS.addFile("/etc/os-release", 0,
+ llvm::MemoryBuffer::getMemBuffer("NAME=\"Mageia\"\n"
+ "VERSION=\"6\"\n"
+ "ID=mageia\n"
+ "VERSION_ID=6\n"
+ "ID_LIKE=\"mandriva fedora\"\n"
+ "PRETTY_NAME=\"Mageia 6\"\n"
+ "ANSI_COLOR=\"1;36\"\n"
+ "HOME_URL=\"http://www.mageia.org/\"\n";
+ "SUPPORT_URL=\"http://www.mageia.org/support/\"\n";
+ "BUG_REPORT_URL=\"https://bugs.mageia.org/\"\n";
+ "PRIVACY_POLICY_URL=\"https://wiki.mageia.org/en/Privacy_policy\"\n";));
+ Distro curDistro{curDistroFS};
+ ASSERT_EQ(Distro(Distro::Mageia), curDistro);
+ ASSERT_FALSE(curDistro.IsUbuntu());
+ ASSERT_FALSE(curDistro.IsRedhat());
+ ASSERT_FALSE(curDistro.IsOpenSUSE());
+ ASSERT_FALSE(curDistro.IsDebian());
+ ASSERT_TRUE(curDistro.IsMageia());
+}
+
} // end anonymous namespace
Index: lib/Driver/ToolChains.cpp
==