From: Daniel Thornburgh Date: Tue, 8 Nov 2022 17:51:52 +0000 (-0800) Subject: [llvm-debuginfod-find] Fix test/behavior on Windows. X-Git-Tag: upstream/17.0.6~28196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20d6f630c8f19d16f415b3069df0dea3cdb28311;p=platform%2Fupstream%2Fllvm.git [llvm-debuginfod-find] Fix test/behavior on Windows. --- diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp index f20b5bc..3fde873 100644 --- a/llvm/lib/Debuginfod/Debuginfod.cpp +++ b/llvm/lib/Debuginfod/Debuginfod.cpp @@ -195,6 +195,8 @@ static SmallVector 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 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 6fe814d..aaf20d4 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: */*