diff --git a/changelog.d/core649-release-test-followups.changed.md b/changelog.d/core649-release-test-followups.changed.md new file mode 100644 index 000000000..88e52c082 --- /dev/null +++ b/changelog.d/core649-release-test-followups.changed.md @@ -0,0 +1 @@ +The release tests now also fail if the root `Makefile` mentions `.IGNORE`, `.ONESHELL`, `MAKEFLAGS` (also inside a longer name such as `GNUMAKEFLAGS`) or `PYTEST_ADDOPTS`, or assigns `SHELL` or `.SHELLFLAGS` (with any assignment operator, also target-specific). They fail if it holds a conditional (`ifeq` … `endif`), a `define` block, `.RECIPEPREFIX`, a line that ends in `\` or a line break other than a newline (such as a form feed), which their recipe parser can't follow. They fail if a target on any of its rule lines, or a prerequisite that `make test` runs at any depth, lacks exactly one single-colon rule line that starts in the first column with no `;` recipe on it. They fail if a recipe line of `make test` or of a prerequisite it runs at any depth (order-only included) contains `||` or ends in `; true`, `; exit 0` or `; :`. The parser reads past comment-only lines inside a recipe, as make does. The tests also fail if the workflow, the Test job or the push workflow's test step sets `MAKEFLAGS` in `env`. They fail if any workflow job other than `push.yaml`'s Publish declares `environment: pypi` or gets `id-token: write` (from its own `permissions`, the workflow's, or `write-all`). A missing test step's failure message now says how to update the locator. diff --git a/tests/core/test_release_tagging.py b/tests/core/test_release_tagging.py index c8c3a1e5a..a5bffebce 100644 --- a/tests/core/test_release_tagging.py +++ b/tests/core/test_release_tagging.py @@ -405,22 +405,59 @@ def pypi_publishing_actions(actions: Path) -> list[str]: ] +# Make syntax that make_rules does not follow, so recipe lines after it could +# run unread: a conditional or define block, a changed recipe prefix, or a +# backslash at the end of a line. +MAKE_SYNTAX_MAKE_RULES_SKIPS = re.compile( + r"^[ \t\f\v]*((override|export)\s+)*(ifn?eq|ifn?def|else|endif|define|endef)\b" + r"|\.RECIPEPREFIX|\\$", + re.MULTILINE, +) + +# Python ends a line at \r, \v, \f, \x1c to \x1e, \x85, \u2028 and \u2029 +# as well as at \n: read_text turns a lone \r into \n, and splitlines splits +# at the rest. make ends a line only at \n. So make_rules would read a recipe +# line such as `cmd $(if ,