-
Notifications
You must be signed in to change notification settings - Fork 84
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
I'm a bit stumped by this, it looks like |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 New features to boost your workflow:
|
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}")) |
There was a problem hiding this comment.
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.
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 thecd ../..
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.