I discovered that when compared to GNU the llvm-ar MRI script parsing of CREATE could lead to some strange behaviour. This fix improves the error message in the case when no archive name is given and will not allow the adding of members until CREATE is called. Along with this change I added more testing of the CREATE command.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/tools/llvm-ar/mri-addlib.test | ||
---|---|---|
27 | Nit: here and below, missing full stop at end of sentence. | |
31 | I believe you should use one of the %errc substitutions (I think %errc_NOENT if memory serves correctly, but look it up!) That way, the message is platform independent. | |
41–42 | FILES2-COUNT-2 along the same lines as above, assuming they are in adjacent lines in the output. | |
llvm/test/tools/llvm-ar/mri-addmod.test | ||
1 | Same comments from me apply to this test. | |
llvm/test/tools/llvm-ar/mri-create.test | ||
11 | Nit: missing full stops. | |
30 | Is CREATE -> SAVE -> CREATE supported? If so, do you need test coverage for that too? | |
llvm/tools/llvm-ar/llvm-ar.cpp | ||
1066 | I prefer "no output archive has been opened" |
Fixed comments, added use of errc_NOENT and COUNT-2, added missing coverage of SAVE between calls to CREATE and improved error message.
There's a potentially relevant pre-merge failure in mri-create.test on debian (see above), which you should look at before landing this (I suspect it's the missing %errc substitution I highlighted inline).
llvm/test/tools/llvm-ar/mri-create.test | ||
---|---|---|
27 | Missing %errc substitution usage here? |
Updated error message check.
llvm/test/tools/llvm-ar/mri-create.test | ||
---|---|---|
27 | Thanks, should be fixed now. |
# RUN: rm -rf %t && split-file %s %t && cd %t
split-file doesn't need mkdir.