This is an archive of the discontinued LLVM Phabricator instance.

[ELF][test] Fix several LLD ICF tests
ClosedPublic

Authored by andrewng on Sep 23 2021, 11:00 AM.

Details

Summary

A number of the ICF tests were not updated to use --print-icf-sections
instead of --verbose and various '-NOT' checks were not updated to the
latest output format of --print-icf-sections. Because these are all
'negative' tests, these issues have gone unnoticed.

Diff Detail

Event Timeline

andrewng created this revision.Sep 23 2021, 11:00 AM
andrewng requested review of this revision.Sep 23 2021, 11:00 AM
MaskRay added inline comments.Sep 23 2021, 11:12 AM
lld/test/ELF/icf-non-mergeable.s
11

If the number of sections is small, prefer positive tests.

CHECK:
CHECK-NEXT:
CHECK-NOT: {{.}}

If necessary, add a comment explaining that we don't want to see some sections.

andrewng updated this revision to Diff 375207.Sep 27 2021, 5:11 AM

Added comments to tests.

andrewng marked an inline comment as done.Sep 27 2021, 5:16 AM
andrewng added inline comments.
lld/test/ELF/icf-non-mergeable.s
11

These tests are checking that no merging has occurred due to ICF, so there are no positive checks as far as the ICF output is concerned. This is the same pattern used in some of the other ICF tests. It's just that these tests were somehow not updated correctly for the ICF related changes and that's what I'm trying to correct.

andrewng marked an inline comment as done.Sep 27 2021, 10:41 AM

Looking at some of the other ICF tests, another approach to checking for no merging is: ... --print-icf-sections | count 0. Would this be preferable to using CHECK-NOT: patterns?

MaskRay accepted this revision.Sep 29 2021, 9:14 AM

Consider moving some similar tests together, possibly using split-file or assembly macros (search .ifdef)

lld/test/ELF/icf-none.s
4

Use ## for non-RUN non-CHECK lines in newer tests

Replace FileCheck --allow-empty with count 0

lld/test/ELF/icf3.s
5

ditto

lld/test/ELF/icf4.s
5

ditto

This revision is now accepted and ready to land.Sep 29 2021, 9:14 AM
andrewng updated this revision to Diff 376137.Sep 30 2021, 2:23 AM

Replaced negative checks with checking that there is no output from --print-icf-sections using count.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2021, 3:11 AM