This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf][test] - Refine the merged.test
ClosedPublic

Authored by grimar on Aug 20 2020, 5:48 AM.

Details

Summary

The testing in merged.test is not ideal.
It uses the following set of flags: -aeWhSrnudlVgIs
and the precompiled object trivial.obj.elf-i386.

In fact, this object, for example, does not contain versioning stuff,
so specifying -V does not make much sense for it, so it is not really tested.
Also, we want to avoid using precompiled objects, ideally we want to use a YAML that
triggers any output for each of the short options in use:

-a: --all
-e: --headers
-W: --wide
-h: --file-headers, --file-header
-S: --section-headers, --sections
-r: --relocations
-n: --notes
-u: --unwind
-d: --dynamic-table
-l: --program-headers
-V: --version-info
-g: --elf-section-groups
-I: --elf-hash-histogram
-s: --symbols

Note that, for example, we do not need to have groups to test -g, because for a
object with no groups llvm-readelf still prints "There are no section groups in this file.",
but that is not always the case. E.g. for -d we don't print anything when we have
no dynamic table, so we have to describe it in a YAML to test -d properly.

Also, we probably want to test cases with and without -a(-all) option separatelly
to be sure that we handle all options and not only the first one in the sequence.
(or, perhaps, we could move -a from the first place to somewhere in the middle,
though testing it separatelly looks a bit safer to me probably).

Diff Detail

Event Timeline

grimar created this revision.Aug 20 2020, 5:48 AM
Herald added a project: Restricted Project. · View Herald Transcript
grimar requested review of this revision.Aug 20 2020, 5:48 AM
jhenderson added inline comments.Aug 20 2020, 6:17 AM
llvm/test/tools/llvm-readobj/ELF/merged.test
10–14

We probably want similar testing for -e, since that is the same as specifying -hlS, I believe.

grimar updated this revision to Diff 286979.Aug 21 2020, 2:50 AM
grimar marked an inline comment as done.
  • Addressed review comment.
llvm/test/tools/llvm-readobj/ELF/merged.test
10–14

Done.

This revision is now accepted and ready to land.Aug 21 2020, 3:24 AM
This revision was automatically updated to reflect the committed changes.