Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: don't cd to git root dir in lit #3953

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

superlopuh
Copy link
Member

This change in configuration was motivated by the lack of detection of missing __init__.py files in the project. We now have a ruff check for this (#3945), but in my changing the config, I found a number of other issues stemming from the cd ../.. in the preamble to the tests. One is that for some reason files with no RUN lines aren't detected with the preamble. I fixed the broken tests that weren't run in a separate PR (#3944), so this is just about making the config change and making minor fixes to remaining files.

@superlopuh superlopuh added the testing PRs that modify tests label Feb 24, 2025
@superlopuh superlopuh self-assigned this Feb 24, 2025
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -19,7 +21,9 @@
ctx.register_dialect(n, f)

# Open the IRDL description of cmath, parse it
f = open("tests/filecheck/dialects/irdl/cmath.irdl.mlir")

file_path = Path(__file__).parent / "cmath.irdl.mlir"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit more resilient to where this is called from, just do relative paths

@superlopuh
Copy link
Member Author

I'm a bit stumped by this, it looks like coverage becomes flaky, and occasionally doesn't print anything to either of stdout or stderr, about once per test run. I can reproduce this locally, but it's a different file every time.

@compor
Copy link
Collaborator

compor commented Feb 24, 2025

coverage has a debug option, maybe it's worth a try? this sounds like a lock or ordering issue due to the parallel runs (might be off though)

@superlopuh superlopuh marked this pull request as draft February 24, 2025 18:06
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.04%. Comparing base (2946e2b) to head (d80789a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3953   +/-   ##
=======================================
  Coverage   89.04%   89.04%           
=======================================
  Files         317      317           
  Lines       43332    43332           
  Branches     5402     5402           
=======================================
  Hits        38584    38584           
  Misses       3406     3406           
  Partials     1342     1342           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@superlopuh superlopuh marked this pull request as ready for review March 12, 2025 16:24
Comment on lines 19 to +31
if "COVERAGE" in lit_config.params:
config.substitutions.append(('xdsl-opt', f"coverage run {xdsl_opt}"))
config.substitutions.append(('xdsl-run', f"coverage run {xdsl_run}"))
config.substitutions.append(('irdl-to-pyrdl', f"coverage run {irdl_to_pyrdl}"))
config.substitutions.append(('python', f"coverage run"))
coverage_cmd = f"coverage run"
config.test_format = lit.formats.ShTest(preamble_commands=[f"cd {xdsl_src}"])
else:
rc_file = xdsl_src / "pyproject.toml"
data_file = xdsl_src / ".coverage.filecheck"
coverage_cmd = f"coverage run --source={xdsl_src} --rcfile={rc_file} --data-file={data_file}"
config.test_format = lit.formats.ShTest()

config.substitutions.append(('xdsl-opt', f"{coverage_cmd} {xdsl_opt}"))
config.substitutions.append(('xdsl-run', f"{coverage_cmd} {xdsl_run}"))
config.substitutions.append(('irdl-to-pyrdl', f"{coverage_cmd} {irdl_to_pyrdl}"))
config.substitutions.append(('python', f"{coverage_cmd}"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically I couldn't hack making the change work with coverage enabled, so we now have a bit more logic that depends on whether or not we collect code coverage metrics, such as where the tests are run from, and what the paths to the commands are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing PRs that modify tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants