[clang] 931a3aa - [Driver][test] Fix ClangDriverTest

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 4 22:44:43 PST 2021


Author: Fangrui Song
Date: 2021-03-04T22:44:37-08:00
New Revision: 931a3aa96726ec6d2052e24e9966fe32d98ddd3e

URL: https://github.com/llvm/llvm-project/commit/931a3aa96726ec6d2052e24e9966fe32d98ddd3e
DIFF: https://github.com/llvm/llvm-project/commit/931a3aa96726ec6d2052e24e9966fe32d98ddd3e.diff

LOG: [Driver][test] Fix ClangDriverTest

Added: 
    

Modified: 
    clang/lib/Driver/Distro.cpp
    clang/unittests/Driver/DistroTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
index 785394eefc97..9fc790f17d6c 100644
--- a/clang/lib/Driver/Distro.cpp
+++ b/clang/lib/Driver/Distro.cpp
@@ -36,10 +36,10 @@ static Distro::DistroType DetectOsRelease(llvm::vfs::FileSystem &VFS) {
   for (StringRef Line : Lines)
     if (Version == Distro::UnknownDistro && Line.startswith("ID="))
       Version = llvm::StringSwitch<Distro::DistroType>(Line.substr(3))
+                    .Case("alpine", Distro::AlpineLinux)
                     .Case("fedora", Distro::Fedora)
                     .Case("gentoo", Distro::Gentoo)
                     .Case("arch", Distro::ArchLinux)
-                    .Case("exherbo", Distro::Exherbo)
                     // On SLES, /etc/os-release was introduced in SLES 11.
                     .Case("sles", Distro::OpenSUSE)
                     .Case("opensuse", Distro::OpenSUSE)

diff  --git a/clang/unittests/Driver/DistroTest.cpp b/clang/unittests/Driver/DistroTest.cpp
index 7c00a8f66be8..b6e4ca9be857 100644
--- a/clang/unittests/Driver/DistroTest.cpp
+++ b/clang/unittests/Driver/DistroTest.cpp
@@ -275,12 +275,10 @@ TEST(DistroTest, DetectDebian) {
 
 TEST(DistroTest, DetectExherbo) {
   llvm::vfs::InMemoryFileSystem ExherboFileSystem;
-  ExherboFileSystem.addFile("/etc/exherbo-release", 0, // (ASCII art)
-                                 llvm::MemoryBuffer::getMemBuffer(""));
   ExherboFileSystem.addFile("/etc/os-release", 0,
       llvm::MemoryBuffer::getMemBuffer("NAME=\"Exherbo\"\n"
                                        "PRETTY_NAME=\"Exherbo Linux\"\n"
-                                       "ID=\"exherbo\"\n"
+                                       "ID=exherbo\n"
                                        "ANSI_COLOR=\"0;32\"\n"
                                        "HOME_URL=\"https://www.exherbo.org/\"\n"
                                        "SUPPORT_URL=\"irc://irc.freenode.net/#exherbo\"\n"


        


More information about the cfe-commits mailing list