Skip to content

[CN-Testing] Allow fixing of base allocation address#536

Open
ZippeyKeys12 wants to merge 2 commits intorems-project:mainfrom
ZippeyKeys12:allow-fix-alloc-addr
Open

[CN-Testing] Allow fixing of base allocation address#536
ZippeyKeys12 wants to merge 2 commits intorems-project:mainfrom
ZippeyKeys12:allow-fix-alloc-addr

Conversation

@ZippeyKeys12
Copy link
Copy Markdown
Collaborator

For pointer generation, we allocate a large buffer and generate addresses inside it (depending on ownership and size required).

This PR adds --fixed-alloc-base=<ADDR> which allows setting the address of this buffer.

@ZippeyKeys12 ZippeyKeys12 self-assigned this Apr 15, 2026
@ZippeyKeys12 ZippeyKeys12 added enhancement New feature or request CN spec testing Related to Bennet, Darcy, or the shared infrastructure for running spec-based random testing. labels Apr 15, 2026
@ZippeyKeys12 ZippeyKeys12 requested a review from Copilot April 15, 2026 01:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new test-generation/runtime flag to pin the random input allocator’s backing buffer to a fixed virtual address, enabling reproducible pointer values across runs (especially when combined with a fixed --seed).

Changes:

  • Add --fixed-alloc-base=<ADDR> CLI flag to cn-testing runner and OCaml test command.
  • Implement fixed-address allocation via mmap (with MAP_FIXED_NOREPLACE where available) in bennet random allocator.
  • Plumb the new option through test-generation config and build script generators (bash/make).

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
runtime/libcn/src/cn-testing/test.c Parses and forwards --fixed-alloc-base to the random allocator.
runtime/libcn/src/bennet/state/rand_alloc.c Implements fixed-base buffer mapping (mmap) and exposes a setter API.
runtime/libcn/include/bennet/state/rand_alloc.h Documents and declares bennet_rand_alloc_set_fixed_base.
lib/testGeneration/testGenConfig.mli Adds fixed_alloc_base to config interface.
lib/testGeneration/testGenConfig.ml Stores fixed_alloc_base in config + accessor.
lib/testGeneration/buildScripts/make.ml Emits --fixed-alloc-base into generated Make-based runners.
lib/testGeneration/buildScripts/bash.ml Emits --fixed-alloc-base into generated Bash runners.
bin/test.ml Adds --fixed-alloc-base CLI flag and threads it into TestGeneration config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread runtime/libcn/src/bennet/state/rand_alloc.c
Comment thread runtime/libcn/src/bennet/state/rand_alloc.c
Comment thread runtime/libcn/src/bennet/state/rand_alloc.c
Comment thread runtime/libcn/src/bennet/state/rand_alloc.c
@ZippeyKeys12 ZippeyKeys12 force-pushed the allow-fix-alloc-addr branch from b38d6ad to 1975406 Compare April 16, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CN spec testing Related to Bennet, Darcy, or the shared infrastructure for running spec-based random testing. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants