Repository navigation
Conversation
…mutation must break (TEST-MUTATIONS-COST) test_mutations.py is the last file still running in every semantic-tests (windows-latest) run measured for ubiquitarianism#1462, 250-381 s there against 33-46 s on the Linux leg of the same runs, while the rest of the suite took 0.76-1.61 times as long on Windows as on Linux. For each of its 14 runs of test_ps_semantics.py (the baseline and 13 mutations) it copied tools/ (about 330 files) into a new temporary folder, deleted it afterwards, and ran the whole file. test_each_mutation_is_caught now makes one copy for all 13 mutations: each starts from the original translator and writes it back in a finally, so 14 copies become 2. Each mutation runs only the test it must break (test_ps_semantics.TranslatorSemantics.<test>), so its child translates one shader instead of six. failed_tests counts only failures reported for TranslatorSemantics: a name the class does not have fails too, as "ERROR: test_x (unittest.loader._FailedTest.test_x)", and with one test per run the old pattern would have counted a misspelled expected test as caught. What the file checks is unchanged: the whole of test_ps_semantics.py passes on an unmutated copy, each anchor matches exactly once, each mutation makes its test fail, the CRLF anchor test is untouched and the repository's tools/ is never written. The children keep PYTHONDONTWRITEBYTECODE=1, which now also keeps a .pyc of an earlier mutant from being run for a later one of the same size written in the same second; a comment says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
[KEEP]
|
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: TEST-MUTATIONS-COST (#14 (comment))
What and why
tests/semantic/test_mutations.pywas the last file still running in all 23semantic-tests (windows-latest)runs measured for #1462, and in the 14 of them that were cancelled at the 10-minute limit it was the only file still running. For each of its 14 runs oftest_ps_semantics.py(the baseline and 13 mutations) it copiedtools/(332 files, 8.6 MB) into a new temporary folder, deleted it afterwards, and ran the whole file.Now
test_each_mutation_is_caughtmakes one copy for all 13 mutations. Each mutation starts from the original translator and writes it back in afinally, so withtest_baseline_copy_passes's own copy, 14 copies oftools/become 2: about 660 files written and deleted instead of about 4,650. Each mutation runs only the test it must break,test_ps_semantics.TranslatorSemantics.<test>, so the 13 mutation runs translate 13 shaders instead of 78.failed_testsnow counts only failures reported forTranslatorSemantics. A test name the class does not have fails too, asERROR: test_x (unittest.loader._FailedTest.test_x), so with one test per run the old pattern would have counted a misspelled expected test as caught (checked below).What the file checks stays the same: the whole of
test_ps_semantics.pypasses on an unmutated copy, each anchor must match exactly once, each mutation must make its test fail,test_anchors_match_crlf_translator_copiesis untouched, and the repository's owntools/is never written. The children keepPYTHONDONTWRITEBYTECODE=1. Now that the translator is rewritten in place, that also stops a.pycof one mutant being run for a later mutant of the same size written in the same second. A comment says so.Why I expect it to help on Windows (a hypothesis, not measured there)
Per-file times of the two legs of the same run, from the job logs of the 9 runs in #1462's table that ran to their end (the
Ran N tests in X sof each file):test_mutationsWindowsThe rest of the suite took 0.76-1.61 times as long on Windows as on Linux;
test_mutationstook 5.8-11.1 times as long. Most of what its children do is the same CPU work the other files do (compiling and running the translator), so I expect most of the difference to come from what only this file does: writing and deleting about 330 files 14 times, and starting 14 Python processes that each import the translator from a folder created just before. This change removes 12 of the 14 copies. It keeps the 14 processes and their 14 compiles of the 1.1 MB translator, which are the main cost on Linux. Only a Windows run can confirm it. The Windows leg runs on the first push tomainafter this merges; GitHub blocked my fork's Actions on 25 November, so I could not dispatch one.Tested
On Linux (Ryzen 9 7900X, 24 threads, Python 3.14.10; CI uses 3.12), with
mainat f783856 and this change on top of it, each exported to its own folder, alternating between the two in every round:mainrun_semantic_tests.py tests/semantic -p test_mutations.py, median of 8 (load average 6-12)test_each_mutation_is_caught(unittest --durations), median of 6test_anchors_match_crlf_translator_copies(unchanged)test_baseline_copy_passes(unchanged)The gain on Linux is small: copying
tools/takes about 16 ms here, and a child spends about 0.19 s of its 0.25 s import compilingrdna2spirv.py(-X importtime). Most of the time the file still takes goes into 27 compiles of the translator, 14 in the children and 13 in the CRLF test.sext()) changed, run against this branch's file andmain's: a misspelled expected test (test_ps_sdwz), a real test that mutation does not break (test_ps_ops), a replacement that changes nothing, and an anchor that no longer matches. Every one fails on both, with only that subtest failing and the other 12 mutations passing. With the oldfailed_testspattern put back, the misspelled name passes on this branch; that is why the pattern now names the class.test_each_mutation_is_caught. Each of the 13 children saw the original translator with only its own mutation applied (13 different texts), and the copy's translator was byte-identical totools/rdna2spirv.pybefore each mutation and at the end.python -I scripts/run_semantic_tests.py tests/semanticon this branch (onmainat b07b9ec): 487 files, 6,279 tests, 0 files failed in 69 s with 24 jobs.python -I scripts/check_no_game_data.py tests/semantic/test_mutations.py: clean.python -I tests/test_text_write_line_endings.py: passes.GPUs tested: n/a (one test file)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase). No open pull request changestests/semantic/test_mutations.py.docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code