Skip to content

Use %errc to get text for system errors #109852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/test/Driver/cl-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,9 @@
// RUN: /Zm \
// RUN: /Zo \
// RUN: /Zo- \
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
// RUN: -### -- %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=IGNORED %s
// IGNORED-NOT: argument unused during compilation
// IGNORED-NOT: no such file or directory
// IGNORED-NOT: [[MSG]]
// Don't confuse /openmp- with the /o flag:
// IGNORED-NOT: "-o" "penmp-.obj"

Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/cl-zc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
// RUN: /Zc:inline \
// RUN: /Zc:rvalueCast \
// RUN: /Zc:ternary \
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
// RUN: -### -- %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=IGNORED %s
// IGNORED-NOT: argument unused during compilation
// IGNORED-NOT: no such file or directory
// IGNORED-NOT: [[MSG]]

// Negated form warns:
// RUN: %clang_cl /c \
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Driver/config-file-errs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

//--- Argument of '--config' must be existing file, if it is specified by path.
//
// RUN: not %clang --config somewhere/nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NONEXISTENT
// CHECK-NONEXISTENT: configuration file '{{.*}}somewhere{{.}}nonexistent-config-file' cannot be opened: {{[Nn]}}o such file or directory
// RUN: not %clang --config somewhere/nonexistent-config-file 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix CHECK-NONEXISTENT
// CHECK-NONEXISTENT: configuration file '{{.*}}somewhere{{.}}nonexistent-config-file' cannot be opened: [[MSG]]


//--- All '--config' arguments must be existing files.
//
// RUN: not %clang --config %S/Inputs/config-4.cfg --config somewhere/nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NONEXISTENT
// RUN: not %clang --config %S/Inputs/config-4.cfg --config somewhere/nonexistent-config-file 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix CHECK-NONEXISTENT


//--- Argument of '--config' must exist somewhere in well-known directories, if it is specified by bare name.
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/response-file-errs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@

// If file in `@file` is a directory, it is an error.
//
// RUN: not %clang @%S/Inputs -### 2>&1 | FileCheck --check-prefix=DIRECTORY %s
// DIRECTORY: cannot not open file '{{.*}}Inputs': {{[Ii]}}s a directory
// RUN: not %clang @%S/Inputs -### 2>&1 | FileCheck -DMSG=%errc_EISDIR --check-prefix=DIRECTORY %s
// DIRECTORY: cannot not open file '{{.*}}Inputs': [[MSG]]
4 changes: 2 additions & 2 deletions llvm/test/Support/interrupts.test
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Show that SIGINT and similar signals don't cause crash messages to be
## reported.
# RUN: %python %s wrapper llvm-symbolizer 2> %t.err
# RUN: FileCheck --input-file=%t.err %s
# RUN: FileCheck -DMSG=%errc_ENOENT --input-file=%t.err %s

# CHECK: {{.*}} error: 'foo': {{[Nn]}}o such file or directory
# CHECK: {{.*}} error: 'foo': [[MSG]]
# CHECK-NOT: {{.+}}

import os
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/tools/dsymutil/X86/remarks-linking-archive.text
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ RUN: llvm-bcanalyzer -dump %t/basic.macho.remarks.archive.x86_64.dSYM/Contents/R

Check that we don't error if we're missing remark files from an archive, but we warn instead.
Instead of creating a new binary, just remove the remarks prepend path.
RUN: dsymutil -oso-prepend-path=%p/../Inputs %t/basic.macho.remarks.archive.x86_64 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING
RUN: dsymutil -oso-prepend-path=%p/../Inputs %t/basic.macho.remarks.archive.x86_64 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=CHECK-MISSING

RUN: dsymutil --linker parallel -oso-prepend-path=%p/../Inputs %t/basic.macho.remarks.archive.x86_64 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING
RUN: dsymutil --linker parallel -oso-prepend-path=%p/../Inputs %t/basic.macho.remarks.archive.x86_64 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=CHECK-MISSING

CHECK: <Meta
CHECK: <Remark Num
Expand All @@ -42,9 +42,9 @@ CHECK: <Remark Num
CHECK: <Remark Num
CHECK-NOT: <Remark Num

CHECK-MISSING: warning: '/remarks/basic1.macho.remarks.x86_64.opt.bitstream': No such file or directory
CHECK-MISSING: warning: '/remarks/basic1.macho.remarks.x86_64.opt.bitstream': [[MSG]]
CHECK-MISSING-NEXT: note: while processing {{.*}}libbasic.a(basic1.macho.remarks.x86_64.o)
CHECK-MISSING-NEXT: warning: '/remarks/basic2.macho.remarks.x86_64.opt.bitstream': No such file or directory
CHECK-MISSING-NEXT: warning: '/remarks/basic2.macho.remarks.x86_64.opt.bitstream': [[MSG]]
CHECK-MISSING-NEXT: note: while processing {{.*}}libbasic.a(basic2.macho.remarks.x86_64.o)
CHECK-MISSING-NEXT: warning: '/remarks/basic3.macho.remarks.x86_64.opt.bitstream': No such file or directory
CHECK-MISSING-NEXT: warning: '/remarks/basic3.macho.remarks.x86_64.opt.bitstream': [[MSG]]
CHECK-MISSING-NEXT: note: while processing {{.*}}libbasic.a(basic3.macho.remarks.x86_64.o)
4 changes: 2 additions & 2 deletions llvm/test/tools/gold/X86/stats-file-option.ll
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ define i32 @foo() {

; Try to save statistics to an invalid file.
; RUN: not %gold -plugin %llvmshlibdir/LLVMgold%shlibext -plugin-opt=stats-file=%t2/foo.stats \
; RUN: -m elf_x86_64 -r -o %t.o %t.bc 2>&1 | FileCheck --check-prefix=ERROR %s
; ERROR: LLVM gold plugin: No such file or directory
; RUN: -m elf_x86_64 -r -o %t.o %t.bc 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=ERROR %s
; ERROR: LLVM gold plugin: [[MSG]]
6 changes: 3 additions & 3 deletions llvm/test/tools/llvm-ar/read-only-archive.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
# RUN: chmod 444 %t/archive.a

# RUN: not llvm-ar r %t/archive.a %t/3.txt \
# RUN: FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a
# RUN: FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a -DMSG=%errc_ENOENT

# ERROR: error: [[FILE]]: no such file or directory
# ERROR: error: [[FILE]]: [[MSG]]

# RUN: not llvm-ar q %t/archive.a %t/3.txt \
# RUN: FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a
# RUN: FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a -DMSG=%errc_ENOENT

# RUN: not llvm-ar m %t/archive.a t/1.txt \
# RUN: FileCheck %s --check-prefix=ERROR-2 -DFILE=%t/archive.a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; RUN: not llvm-ctxprof-util nofile.json 2>&1 | FileCheck %s --check-prefix=NO_CMD
; RUN: not llvm-ctxprof-util invalidCmd --input nofile.json 2>&1 | FileCheck %s --check-prefix=INVALID_CMD
; RUN: not llvm-ctxprof-util fromJSON nofile.json 2>&1 | FileCheck %s --check-prefix=NO_FLAG
; RUN: not llvm-ctxprof-util fromJSON --input nofile.json 2>&1 | FileCheck %s --check-prefix=NO_FILE
; RUN: not llvm-ctxprof-util fromJSON --input nofile.json 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NO_FILE
; RUN: not llvm-ctxprof-util fromJSON --input %S/Inputs/bad.json 2>&1 | FileCheck %s --check-prefix=BAD_JSON
; RUN: not llvm-ctxprof-util fromJSON --input %S/Inputs/invalid-no-vector.json 2>&1 | FileCheck %s --check-prefix=NO_VECTOR
; RUN: not llvm-ctxprof-util fromJSON --input %S/Inputs/invalid-no-ctx.json 2>&1 | FileCheck %s --check-prefix=NO_CTX
Expand All @@ -15,7 +15,7 @@
; NO_CMD: Unknown subcommand 'nofile.json'
; INVALID_CMD: Unknown subcommand 'invalidCmd'
; NO_FLAG: Unknown command line argument 'nofile.json'.
; NO_FILE: 'nofile.json': No such file or directory
; NO_FILE: 'nofile.json': [[MSG]]
; BAD_JSON: Expected object key
; NO_VECTOR: expected array
; NO_CTX: missing value at (root)[0].Guid
Expand Down
Loading