Skip to content

dasLLVM tests delete only their own cache folder; SETUP_CPP11 adds its flags once; jit_runtime.cpp include - #4756

Merged
borisbat merged 4 commits into
masterfrom
bbatkin/cxx-flags-jit-guard-4699
Nov 23, 2026
Merged

borisbat merged 4 commits into
masterfrom
bbatkin/cxx-flags-jit-guard-4699

Conversation

@borisbat

Copy link
Copy Markdown
Collaborator

Nothing changes for daslang users: a test cleanup that can no longer delete outside its own folders, shorter compile lines from CMake, and one include a build without DAS_ENABLE_DYN_INCLUDES needs.

Why. Three leftovers. The dasLLVM JIT cache tests deleted dir_name(output_path), and a failed run leaves that path empty (closes #4699). SETUP_CPP11 appended the language standard to CMAKE_CXX_FLAGS on every call. jit_runtime.cpp called a function whose header it included only under a define.

What changes.

  • The JIT cache tests delete through remove_round_cache: only a script's own folder under .cache/daslang, and a round with no such folder fails the test.
  • The sweep and the tests share is_jit_cache_folder_name.
  • modules/dasLLVM/tests/REVIEW.md gains a rule on what a test's recursive delete may name.
  • SETUP_CPP11 appends each flag group once (DAS_CXX_FLAGS_ONCE).
  • jit_runtime.cpp includes dyn_modules.h on every build.
  • The module digest gains the one line it was missing on master.

Observable behavior.

  • Code model of a Visual Studio tree: 43 to 97 copies of /std:c++17 per C++ compile group -> 1.
  • A failed JIT round in these tests: a test failure, nothing deleted.

Where to look. round_cache_folder in modules/dasLLVM/tests/_llvm_cache_common.das; cmake/das_cxx_flags_once.cmake.

Validation, claims, ledger

Validation

  • Local full preflight on the tip before the digest commit, Windows x64: 27 gates and lanes passed, 1 failed - docs/digest, stale on master too (the digest lacked get_builtin_function_link_name). The last commit regenerates it; the docs gate was run again after it and passes.
  • modules/dasLLVM/tests/llvm_jit_cache.das under -jit: 33 tests, 33 passed, with the split-module, object-cache and AST round-trip tests run, not skipped. Each of them now asserts that the delete of its cache folder succeeded.
  • The flag count, read from the CMake code model of a tree made by the Visual Studio 18 2026 generator: before, the 129 C++ compile groups carried 43 to 97 copies of /std:c++17 (72 groups had 59, 24 had 97); after a configure with this change, each carries one. Every group still names the standard.
  • The new ctest case cmake_cxx_flags_once (label small, so every per-PR lane runs it). Configuration that executes it: cmake -S . -B build with default flags, then ctest --test-dir build -C Release -R cmake_cxx_flags_once.
  • Negative controls (test audit, in a worktree): 10 branches, 6 held by a test that fails without them. The macro: always append, never append, and each side of the whole-flag match fail the script (the suffix side got its case after the audit). round_cache_folder: each of its three conditions forced true fails test_round_cache_folder. is_jit_cache_folder_name forced either way fails the sweep tests and the cache tests.
  • External review (codex, one round): one finding, the macro had no test. The ctest case above is the answer.
  • Audits: eight checklists (REVIEW.md, modules/REVIEW.md, modules/dasLLVM/REVIEW.md, modules/dasLLVM/tests/REVIEW.md, src/REVIEW.md, src/builtin/REVIEW.md by auditors; tests-cpp/REVIEW.md and tests-cpp/small/REVIEW.md read by hand after the test was added), style, duplicates, and one review pass over the new checklist rule. No rule violated; the findings on this diff are fixed here, except the ones under Not done.

Claims - stated, not tested

  • jit_runtime.cpp: the CMake build defines DAS_ENABLE_DYN_INCLUDES for every libDaScript target, so no lane compiles the file without it. The evidence is the file itself: the call sat outside the guard its declaration's include was under.
  • The three SETUP_CPP11 call sites of the macro have no automated test (the ctest case includes the macro file alone). The code-model count above is their evidence.
  • A Ninja or Makefile tree on Windows and an Xcode or Makefile tree on macOS were not configured. There the repeated flags were on the real compile line; on a Visual Studio tree the generator folds /std:c++17 into one project property, so the build after this change compiled only the files of this diff.
  • The arm of remove_round_cache that fails the test on a round with no cache folder is test-helper code and no test drives it; round_cache_folder, which decides it, is tested.

Not done

  • SETUP_CPP11 still adds the standard beside CMAKE_CXX_STANDARD 17, which the root CMakeLists.txt already sets: each compile group names it twice, once in each spelling. Dropping the macro's copy can change which dialect a macOS or mingw compile line ends with, and was not tried.
  • No lint rule for rmdir_rec(dir_name(<expr>)), the idea at the end of dasLLVM tests: a failed in-process JIT run makes llvm_jit_cache.das delete the working directory #4699. rmdir_rec itself refuses an empty path, a root and a . or .. tail since 0448fc7, and the new checklist rule covers this folder.
  • module_jit.cpp keeps two includes under the same define; it uses nothing from them, so it compiles either way.
  • Wording defects the audits found in the checklists themselves (REVIEW.md, modules/REVIEW.md, modules/dasLLVM/REVIEW.md, src/REVIEW.md, src/builtin/REVIEW.md, and three older rules of modules/dasLLVM/tests/REVIEW.md) are not edited here.

borisbat and others added 4 commits November 22, 2026 18:11
The include sat under DAS_ENABLE_DYN_INCLUDES while the call to
describe_pending_dynamic_modules() did not, so a build without the
define failed to compile the file. The header reads no build switch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The macro appended the language standard to CMAKE_CXX_FLAGS on every
call, and a directory's targets compile with the value the directory
ends with: one copy per call made there and in its parents. The code
model of a Visual Studio tree carried 43 to 97 copies of /std:c++17 per
C++ compile group, and the preflight C++ pass handed them all to clang.
The macro now appends only what is not there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The JIT cache tests deleted dir_name(output_path). A failed run leaves
output_path empty, and that delete once named the working directory and
emptied a worktree; rmdir_rec refuses such a path now. The tests no
longer lean on that refusal: the cleanup deletes only a script's own
folder under .cache/daslang, and a round whose output_path lies outside
one fails the test. The sweep and the tests share one check of a cache
folder's name.

Fixes #4699

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The builtin landed without a digest regeneration, so the docs digest
gate was red on master.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@borisbat
borisbat merged commit d38cb40 into master Nov 23, 2026
66 checks passed
@borisbat
borisbat deleted the bbatkin/cxx-flags-jit-guard-4699 branch November 23, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dasLLVM tests: a failed in-process JIT run makes llvm_jit_cache.das delete the working directory

1 participant