diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2025-03-29 14:10:58 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-29 14:10:58 +0700 |
commit | e87bec622c0d10ae736e160a9335055d466d76ab (patch) | |
tree | 6ac0c24e72c2c6b8afa3d5b8873ecc6c82222ee2 | |
parent | 1e62a3505fa0d0ef1f706549ce62f645f3091cfa (diff) | |
download | llvm-e87bec622c0d10ae736e160a9335055d466d76ab.zip llvm-e87bec622c0d10ae736e160a9335055d466d76ab.tar.gz llvm-e87bec622c0d10ae736e160a9335055d466d76ab.tar.bz2 |
llvm-reduce: Make some error messages more consistent (#133563)
The coding standards states that error messages should start with
a lowercase. Also use WithColor, and add missing test coverage for
the failed to write to output file case.
-rw-r--r-- | llvm/test/tools/llvm-reduce/fail-execute-test.test | 2 | ||||
-rw-r--r-- | llvm/test/tools/llvm-reduce/fail-output-file.test | 7 | ||||
-rw-r--r-- | llvm/tools/llvm-reduce/TestRunner.cpp | 8 |
3 files changed, 12 insertions, 5 deletions
diff --git a/llvm/test/tools/llvm-reduce/fail-execute-test.test b/llvm/test/tools/llvm-reduce/fail-execute-test.test index f60107f..1b3266e 100644 --- a/llvm/test/tools/llvm-reduce/fail-execute-test.test +++ b/llvm/test/tools/llvm-reduce/fail-execute-test.test @@ -1,4 +1,4 @@ # RUN: export LSAN_OPTIONS=detect_leaks=0 # RUN: not llvm-reduce --test=%s.NotAFileInTestingDir %p/Inputs/test-output-format.ll 2>&1 | FileCheck -DFILENAME=%s.NotAFileInTestingDir --strict-whitespace %s -# CHECK: Error running interesting-ness test: {{(Executable "[[FILENAME]]" doesn't exist$)?(program not executable$)?}} +# CHECK: error: running interesting-ness test: {{(Executable "[[FILENAME]]" doesn't exist$)?(program not executable$)?}} diff --git a/llvm/test/tools/llvm-reduce/fail-output-file.test b/llvm/test/tools/llvm-reduce/fail-output-file.test new file mode 100644 index 0000000..7696570 --- /dev/null +++ b/llvm/test/tools/llvm-reduce/fail-output-file.test @@ -0,0 +1,7 @@ +# Python on an empty file will always succeed as interesting +# RUN: touch %t + +# Fail on attempt to write output to a directory +# RUN: not llvm-reduce --delta-passes=instructions -o %p/Inputs --test %python --test-arg %t %p/Inputs/test-output-format.ll 2>&1 | FileCheck -DMSG=%errc_EISDIR %s + +# CHECK: error: opening output file: [[MSG]] diff --git a/llvm/tools/llvm-reduce/TestRunner.cpp b/llvm/tools/llvm-reduce/TestRunner.cpp index aac5c4a..ad9f925 100644 --- a/llvm/tools/llvm-reduce/TestRunner.cpp +++ b/llvm/tools/llvm-reduce/TestRunner.cpp @@ -45,9 +45,8 @@ int TestRunner::run(StringRef Filename) const { /*SecondsToWait=*/0, /*MemoryLimit=*/0, &ErrMsg); if (Result < 0) { - Error E = make_error<StringError>("Error running interesting-ness test: " + - ErrMsg, - inconvertibleErrorCode()); + Error E = make_error<StringError>( + "running interesting-ness test: " + ErrMsg, inconvertibleErrorCode()); WithColor::error(errs(), ToolName) << toString(std::move(E)) << '\n'; exit(1); } @@ -61,7 +60,8 @@ void TestRunner::writeOutput(StringRef Message) { EmitBitcode && !Program->isMIR() ? sys::fs::OF_None : sys::fs::OF_Text); if (EC) { - errs() << "Error opening output file: " << EC.message() << "!\n"; + WithColor::error(errs(), ToolName) + << "opening output file: " << EC.message() << '\n'; exit(1); } |