[llvm] 20d6f63 - [llvm-debuginfod-find] Fix test/behavior on Windows.

Daniel Thornburgh via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 09:53:56 PST 2022


Author: Daniel Thornburgh
Date: 2022-11-08T09:52:33-08:00
New Revision: 20d6f630c8f19d16f415b3069df0dea3cdb28311

URL: https://github.com/llvm/llvm-project/commit/20d6f630c8f19d16f415b3069df0dea3cdb28311
DIFF: https://github.com/llvm/llvm-project/commit/20d6f630c8f19d16f415b3069df0dea3cdb28311.diff

LOG: [llvm-debuginfod-find] Fix test/behavior on Windows.

Added: 
    

Modified: 
    llvm/lib/Debuginfod/Debuginfod.cpp
    llvm/test/tools/llvm-debuginfod-find/headers.test

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index f20b5bc677e00..3fde8730239f5 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -195,6 +195,8 @@ static SmallVector<std::string, 0> getHeaders() {
   uint64_t LineNumber = 0;
   for (StringRef Line : llvm::split((*HeadersFile)->getBuffer(), '\n')) {
     LineNumber++;
+    if (!Line.empty() && Line.back() == '\r')
+      Line = Line.drop_back();
     if (!isHeader(Line)) {
       if (!all_of(Line, llvm::isSpace))
         WithColor::warning()
@@ -202,8 +204,6 @@ static SmallVector<std::string, 0> getHeaders() {
             << LineNumber << '\n';
       continue;
     }
-    if (Line.back() == '\r')
-      Line = Line.drop_back();
     Headers.emplace_back(Line);
   }
   return Headers;

diff  --git a/llvm/test/tools/llvm-debuginfod-find/headers.test b/llvm/test/tools/llvm-debuginfod-find/headers.test
index 6fe814db51799..aaf20d44e3179 100644
--- a/llvm/test/tools/llvm-debuginfod-find/headers.test
+++ b/llvm/test/tools/llvm-debuginfod-find/headers.test
@@ -2,13 +2,13 @@ REQUIRES: curl
 
 RUN: %python %S/Inputs/capture_req.py llvm-debuginfod-find --debuginfo 0 \
 RUN:   | FileCheck --check-prefix NO-HEADERS %s
-RUN: DEBUGINFOD_HEADERS_FILE=bad %python %S/Inputs/capture_req.py \
+RUN: env DEBUGINFOD_HEADERS_FILE=bad %python %S/Inputs/capture_req.py \
 RUN:   llvm-debuginfod-find --debuginfo 0 \
 RUN:   | FileCheck --check-prefix NO-HEADERS %s
-RUN: DEBUGINFOD_HEADERS_FILE=%S/Inputs/headers %python %S/Inputs/capture_req.py \
+RUN: env DEBUGINFOD_HEADERS_FILE=%S/Inputs/headers %python %S/Inputs/capture_req.py \
 RUN:   llvm-debuginfod-find --debuginfo 0 \
 RUN:   | FileCheck --check-prefix HEADERS %s
-RUN: DEBUGINFOD_HEADERS_FILE=%S/Inputs/headers DEBUGINFOD_URLS=fake not llvm-debuginfod-find --debuginfo 0 2>&1 \
+RUN: env DEBUGINFOD_HEADERS_FILE=%S/Inputs/headers DEBUGINFOD_URLS=fake not llvm-debuginfod-find --debuginfo 0 2>&1 \
 RUN:   | FileCheck --check-prefix ERR -DHEADER_FILE=%S/Inputs/headers %s
 
 NO-HEADERS: Accept: */*


        


More information about the llvm-commits mailing list