v29.4-roots.2 · Commit 11: [PATCH 11/21] ci: move full fuzz corpora to nightly
ci/test/test_fuzz_workflows.py
Before: /dev/null · After: ci/test/test_fuzz_workflows.py
File metadata
new file mode 100755 index 0000000000000000000000000000000000000000..e0958bebb713c945e684a6e76f39eb4ce895f6bf
Download original patch · Release notes
Diff rows 1–50 of 50. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
ci/test/test_fuzz_workflows.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# Copyright (c) 2026-present The Bitcoin Roots developers
|
| 3 |
+
# Distributed under the MIT software license, see the accompanying
|
| 4 |
+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
| 5 |
+
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import re
|
| 8 |
+
import unittest
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
ROOT = Path(__file__).resolve().parents[2]
|
| 12 |
+
CI_WORKFLOW = ROOT / ".github/workflows/ci.yml"
|
| 13 |
+
NIGHTLY_WORKFLOW = ROOT / ".github/workflows/nightly.yml"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def job(workflow, name):
|
| 17 |
+
text = workflow.read_text(encoding="utf-8")
|
| 18 |
+
match = re.search(rf"(?ms)^ {re.escape(name)}:\n(.*?)(?=^ [a-z0-9_-]+:\n|\Z)", text)
|
| 19 |
+
if match is None:
|
| 20 |
+
raise AssertionError(f"Job {name!r} does not exist in {workflow}")
|
| 21 |
+
return match.group(1)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class FuzzWorkflowTest(unittest.TestCase):
|
| 25 |
+
def test_full_linux_corpus_is_not_an_ordinary_pr_job(self):
|
| 26 |
+
workflow = CI_WORKFLOW.read_text(encoding="utf-8")
|
| 27 |
+
self.assertNotRegex(workflow, r"(?m)^ fuzz:$")
|
| 28 |
+
self.assertNotIn("steps.classify.outputs.fuzz", workflow)
|
| 29 |
+
|
| 30 |
+
def test_nightly_runs_linux_native_fuzz_corpus(self):
|
| 31 |
+
linux_fuzz = job(NIGHTLY_WORKFLOW, "linux-fuzz")
|
| 32 |
+
self.assertIn("inputs.suite == ''", linux_fuzz)
|
| 33 |
+
self.assertIn("inputs.suite == 'all'", linux_fuzz)
|
| 34 |
+
self.assertIn("inputs.suite == 'fuzz'", linux_fuzz)
|
| 35 |
+
self.assertIn("FILE_ENV: ./ci/test/00_setup_env_native_fuzz.sh", linux_fuzz)
|
| 36 |
+
self.assertIn("run: ./ci/test_run_all.sh", linux_fuzz)
|
| 37 |
+
|
| 38 |
+
def test_ci_fuzz_label_requests_reusable_nightly_suite(self):
|
| 39 |
+
nightly_fuzz = job(CI_WORKFLOW, "nightly-fuzz")
|
| 40 |
+
self.assertIn("needs.classify.outputs.nightly_fuzz == 'true'", nightly_fuzz)
|
| 41 |
+
self.assertIn("uses: ./.github/workflows/nightly.yml", nightly_fuzz)
|
| 42 |
+
self.assertIn("suite: fuzz", nightly_fuzz)
|
| 43 |
+
|
| 44 |
+
required_result = job(CI_WORKFLOW, "required-result")
|
| 45 |
+
self.assertIn("nightly-fuzz", required_result)
|
| 46 |
+
self.assertIn("check_selected \"$NIGHTLY_FUZZ_SELECTED\" \"$NIGHTLY_FUZZ\" nightly-fuzz", required_result)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == "__main__":
|
| 50 |
+
unittest.main()
|