We did not properly handle using CREATETHIN in an MRI script and attempting to use ADDLIB to add the contents of a regular archive. This fix outputs a meaningful error message in this case and provides some more testing.
Details
Diff Detail
Unit Tests
Event Timeline
An alternative way organizing MRI tests is to place them into regular-to-thin-archive.test and thin-to-regular-archive.test , but a dedicated test file for MRI & Thin looks fine, too.
llvm/test/tools/llvm-ar/mri-thin-archive.test | ||
---|---|---|
1–3 | My personal feeling is that placing rm, split-file, mkdir on one line is fine (many tests do this). It's still clear. | |
1–3 | # UNSUPPORTED: system-aix AIX doesn't use <arch>, and I am unsure how thin archives work for them. | |
9–10 | ditto below | |
llvm/tools/llvm-ar/llvm-ar.cpp | ||
1068 | grammar mistakes in "a regular archives contents" I'd suggest cannot merge a regular archive into a thin archive, but happy to use one @jhenderson prefers. |
llvm/test/tools/llvm-ar/mri-thin-archive.test | ||
---|---|---|
1–3 | Alternatively, use a --format option in the llvm-ar invocations, but it's probably simpler to use the # UNSUPPORTED as @MaskRay suggests. | |
13 | I'd give this check an explicit prefix, rather than relying on the default, since you have other prefixes elsewhere. | |
18 | This will only show that delete.o is not the last member of the archive. It would probably be more advisable to use FileCheck --implicit-check-not=delete.o (I know that this was here before, but since you're basically rewriting the test, you might as well improve it whilst here). | |
23 | What is the purpose of this line? All it does is show that elf.o appears somewhere in the archive, and doesn't confirm whether or not a) there are any other members and b) whether the name is a full path (because FileCheck looks for substrings unless told to do otherwise). | |
llvm/tools/llvm-ar/llvm-ar.cpp | ||
1068 | I'm not a fan of the word "merge" here, because it has implications around the old regular archive no longer existing. I think the original is closer to being correct, but missing an apostrophe: "cannot add a regular archive's contents to a thin archive". |
Fixed whitespace, added UNSUPPORTED: system-aix, placed rm, split-file, mkdir on one line, added explicit prefix and improved error message.
llvm/test/tools/llvm-ar/mri-thin-archive.test | ||
---|---|---|
16 | Perhaps worth adding --match-full-lines to the FileCheck output, to ensure your path is as expected here? (e.g. this will also match addlib/elf.o/ or myelf.other.o etc as things stand) |
My personal feeling is that placing rm, split-file, mkdir on one line is fine (many tests do this). It's still clear.