[PATCH] D66425: [llvm-readobj] Prepend argv[0] to error messages

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 02:08:51 PDT 2019


grimar accepted this revision.
grimar added a comment.

LGTM, I can confirm it works now. A minor suggestion is inlined.



================
Comment at: test/tools/llvm-readobj/error-format.test:7
+# READELF: llvm-readelf: error: '{{.*}}':
+# READOBJ: llvm-readobj: error: '{{.*}}':
----------------
MaskRay wrote:
> grimar wrote:
> > grimar wrote:
> > > It fails under windows for me. Because of `.exe` suffix:
> > > 
> > > ```
> > > D:\Work2\llvm\llvm\test\tools\llvm-readobj\error-format.test:6:12: error: READELF: expected string not found in input
> > > # READELF: llvm-readelf: error: '{{.*}}':
> > >            ^
> > > <stdin>:2:1: note: scanning from here
> > > d:\work2\llvm\llvm_build\debug\bin\llvm-readelf.exe: error: 'D:\Work2\llvm\llvm\
> > > test\tools\llvm-readobj/non-existent': no such file or directory
> > > ^
> > > ```
> > The following helps:
> > 
> > ```
> > # READELF: llvm-readelf{{(.exe)?}}: error: '{{.*}}':
> > # READOBJ: llvm-readobj{{(.exe)?}}: error: '{{.*}}':
> > ```
> > 
> > (no more other readelf tests are failing for me, btw).
> > 
> > I see that out other tests sometimes using something like: `llvm-ar{{(.exe|.EXE)?}}`,
> > but I am not sure why handling the uppercase `.EXE` is useful/important.
> Thanks for testing! I was indeed thinking what Windows would do...
> 
> So the error message is ineed OS dependent. On Linux:
> 
> ```
> % errno 2
> ENOENT 2 No such file or directory
> ```
> 
> On Windows it is not capitalized: `no such file or directory`
> 
> I think `.EXE` is probably 8.3 filename remnant from DOS or Windows 95... I think it is not useful unless the basename also follows 8.3, i.e. `LLVM-R~1.EXE` `LLVM-R~2.EXE`
Some of the our tests use: `{{[N|n]}}o such file or directory`.

Perhaps I would do that:

```
# READELF: llvm-readelf{{(\.exe)?}}: error: '{{.*}}': {{[N|n]}}o such file or directory
# READOBJ: llvm-readobj{{(\.exe)?}}: error: '{{.*}}': {{[N|n]}}o such file or directory
```



Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66425/new/

https://reviews.llvm.org/D66425





More information about the llvm-commits mailing list