Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion scripts/pr_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,16 @@ def number(s):
return int(m.group(1)) if m else None


# outside crates/xcl/src but built into xcl.exe: compiled-in data (stubdb.toml), the build script,
# dependency versions and the release profile
RUNTIME_DIRS = ("crates/xcl/src/", "crates/xcl/data/")
RUNTIME_FILES = ("crates/xcl/build.rs", "crates/xcl/Cargo.toml", "Cargo.toml", "Cargo.lock")


def runtime(path):
return path.startswith("crates/xcl/src/") and "/tests" not in path and not path.endswith("tests.rs")
if path in RUNTIME_FILES:
return True
return path.startswith(RUNTIME_DIRS) and "/tests" not in path and not path.endswith("tests.rs")


def check(body, head, files, is_main_ancestor, *, test_only=False):
Expand Down
14 changes: 14 additions & 0 deletions scripts/test_pr_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ def test_test_paths_do_not_need_approval(self):
self.assertEqual([], check(BODY, HEAD, files, lambda _: False))


class RuntimeOutsideSrcTests(unittest.TestCase):
def test_files_built_into_xcl_need_smoke(self):
for path in ("crates/xcl/data/stubdb.toml", "crates/xcl/build.rs", "crates/xcl/Cargo.toml",
"Cargo.toml", "Cargo.lock"):
problems = check(BODY, HEAD, [changed(path)], lambda _: False)
self.assertEqual(2, len(problems), path)
self.assertTrue(all("Regression run" in problem for problem in problems), path)

def test_other_crates_and_scripts_do_not_need_smoke(self):
files = [changed("tests/testtitle/Cargo.toml"), changed("tests/testgamedll/src/lib.rs"),
changed("scripts/smoke.ps1"), changed("README.md")]
self.assertEqual([], check(BODY, HEAD, files, lambda _: False))


class SmokeBlockTests(unittest.TestCase):
def test_two_blocks_in_one_fence_are_two_blocks(self):
body = ("```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: G\nseconds: 60\n\n"
Expand Down
Loading