This is an archive of the discontinued LLVM Phabricator instance.

[flang][test] Amend test_errors.py to test warnings
AbandonedPublic

Authored by ekieri on May 17 2022, 9:23 AM.

Details

Summary

Presently, test_errors.py only checks errors. If Flang fails to emit an
expected error at a particular line, misphrases it, or emits an
unexpected error, test_errors.py makes the test fail. It does however
not take warnings into account. This patch makes test_errors.py check
warnings the same way as errors.

Warnings are accounted separately from errors, but warnings of
different severity are lumped together. That is, if an expected error
comes out as a warning the test fails, but test_errors.py will not care
if the warning is of "warning" or "portability" severity. To expect a
warning, the 'WARNING:' directive is used.

RFC: https://discourse.llvm.org/t/62577

Depends on D126176
Depends on D126459
Depends on D127337
Depends on D131987
Depends on D132403

Diff Detail

Event Timeline

ekieri created this revision.May 17 2022, 9:23 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
ekieri edited the summary of this revision. (Show Details)May 17 2022, 9:27 AM

See flang/test/Evaluate/test_folding.py, which uses "WARN:" and will fail if a warning is not issued or if a new warning appears. Tests for warnings should treat discrepancies from expected warnings as severely as discrepancies from expected errors.

Thanks for suggesting this!

Tests for warnings should treat discrepancies from expected warnings as severely as discrepancies from expected errors.

+1 This would match the behavior in Clang as well (see e.g. https://github.com/llvm/llvm-project/blob/main/clang/test/Sema/attr-alias-elf.c)

ekieri added a comment.EditedMay 18 2022, 12:26 PM

Sure. Would you be OK with proceeding with this one as a first step on the way there? Please see the discussion in the RFC as well.

ekieri edited the summary of this revision. (Show Details)May 18 2022, 12:33 PM

Sure. Would you be OK with proceeding with this one as a first step on the way there? Please see the discussion in the RFC as well.

Nevermind.

ekieri updated this revision to Diff 430757.May 19 2022, 11:36 AM

Disallow unexpected warnings, rebase.

ekieri edited the summary of this revision. (Show Details)May 19 2022, 11:38 AM
ekieri updated this revision to Diff 431171.May 21 2022, 12:50 PM

Add WARNING directive to common-blocks.f90 and data06.f90, whose emitted warnings appear correct.

ekieri edited the summary of this revision. (Show Details)May 21 2022, 12:50 PM
ekieri updated this revision to Diff 437683.Jun 16 2022, 1:31 PM

Add a WARNING directive to resolve35.f90. The warning makes sense and appears to be emitted intentionally.

ekieri edited the summary of this revision. (Show Details)Jun 16 2022, 1:32 PM
ekieri updated this revision to Diff 453093.Aug 16 2022, 12:16 PM

Break out updates to tests to D131987

ekieri edited the summary of this revision. (Show Details)Aug 18 2022, 12:16 PM
ekieri published this revision for review.Aug 22 2022, 11:50 AM
PeteSteinfeld requested changes to this revision.Aug 22 2022, 12:33 PM

When I run "check-flang" after making these changes, I get 21 failures:

Failed Tests (21):
  Flang :: Semantics/associated.f90
  Flang :: Semantics/bindings01.f90
  Flang :: Semantics/block-data01.f90
  Flang :: Semantics/blockconstruct02.f90
  Flang :: Semantics/call03.f90
  Flang :: Semantics/case01.f90
  Flang :: Semantics/common-blocks.f90
  Flang :: Semantics/data06.f90
  Flang :: Semantics/dosemantics02.f90
  Flang :: Semantics/dosemantics12.f90
  Flang :: Semantics/forall01.f90
  Flang :: Semantics/int-literals.f90
  Flang :: Semantics/resolve108.f90
  Flang :: Semantics/resolve11.f90
  Flang :: Semantics/resolve31.f90
  Flang :: Semantics/resolve35.f90
  Flang :: Semantics/resolve37.f90
  Flang :: Semantics/resolve42.f90
  Flang :: Semantics/resolve59.f90
  Flang :: Semantics/resolve60.f90
  Flang :: Semantics/resolve85.f90
This revision now requires changes to proceed.Aug 22 2022, 12:33 PM

When I run "check-flang" after making these changes, I get 21 failures:

Yes, I know. The dependencies intend to make those tests conform to the stricter testing of this patch. I will rebase when the last two dependencies are merged. (The base commit is a little stale. Currently, four tests would still fail if this patch was applied on top of main.)

When I run "check-flang" after making these changes, I get 21 failures:

Yes, I know. The dependencies intend to make those tests conform to the stricter testing of this patch. I will rebase when the last two dependencies are merged. (The base commit is a little stale. Currently, four tests would still fail if this patch was applied on top of main.)

Well the changes look good, but I don't want to approve something that breaks the build.

ekieri abandoned this revision.Apr 24 2023, 10:40 AM

Fixed in D136479.