DeterministicRandom() can use a boost::random::mt19937_64
to take a 64-bit seed and return 64-bit random values,
and this simplifies things because fdb always wants 64 bits.
Performance should be slightly better because the 32-bit
mt19937 was always called twice to get 64 bits.
* Add --reseed-time option to reset random seed during simulation
Adds a new command line option --reseed-time that allows resetting the
deterministic random seed at a random time during simulation. When
provided with a time value (e.g., 100), the simulator will reset the
random seed to a truly random value at a random time between [0, time].
This feature enables testing different execution paths from the same
initial simulation state while maintaining determinism up to the reset
point.
Changes:
- Add resetSeed() method to IRandom interface with default no-op implementation
- Implement resetSeed() in DeterministicRandom class to reinitialize RNG
- Add --reseed-time command line option to fdbserver
- Add reseedTime parameter to simulationSetupAndRun()
- Add reseedRandomAtTime() actor to schedule seed reset
- Use platform::getRandomSeed() for truly random new seed value
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* TestHarness2: Add support for running tests from argument file
This commit adds the ability to run specific tests with predefined
parameters by passing an argument file to TestHarness2. This is useful
for reproducing specific test failures or running tests with exact
configurations.
Changes:
- Added --test-args-file option to config.py
- Implemented parse_test_args_file() to parse argument files containing
test parameters in the format:
'-f fast/CycleTest.toml -s 315315 -b off --reseed-time 100'
- Modified TestRun to accept and forward extra_args to fdbserver
- Modified TestRunner.run_tests() to:
* Accept extra_args and override_buggify parameters
* Skip test statistics tracking when running from args file
* Forward all unrecognized arguments to fdbserver command line
- Added example_test_args.txt demonstrating the format
The track_stats parameter prevents assertion failures when the specified
test is not in the test_picker's dictionary (which happens when running
a specific test that may not match the configured filters).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Joshua: Support test_args.txt file for reproducing specific test runs
Modified correctnessTest.sh to automatically detect and use test_args.txt
file if present in the working directory. This enables easy reproduction of
specific test failures in Joshua by simply including a test_args.txt file
with the test parameters.
When test_args.txt exists, the script passes --test-args-file option to
TestHarness2, which will run the specific test with the exact parameters
specified in the file instead of randomly selecting a test.
Example test_args.txt content:
-f tests/fast/CycleTest.toml -s 315315 -b off --reseed-time 100
This allows developers to reproduce simulation test failures by copying
the exact test parameters from Joshua logs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* CMake: Optionally include test_args.txt in correctness package
Modified create_correctness_package() to automatically include test_args.txt
in the correctness tarball if it exists in the source directory at CMake
configuration time.
This allows developers to create reproducible test packages by:
1. Creating test_args.txt in the source root with specific test parameters
(e.g., '-f tests/fast/CycleTest.toml -s 315315 -b off --reseed-time 100')
2. Running cmake to reconfigure
3. Running ninja package_tests to build the package
When the package is extracted and run in Joshua, correctnessTest.sh will
automatically detect test_args.txt and run the specific test instead of
randomly selecting one.
If test_args.txt doesn't exist, the package is built normally without it,
maintaining backward compatibility.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* TestHarness2: Disable determinism check when using test_args_file
Modified run_tests() to skip the unseed mismatch (determinism) check when
running tests from test_args.txt file. The determinism check now requires
track_stats=True, which means it only runs during normal random test
selection, not when running specific tests via --test-args-file.
Rationale:
- When reproducing a specific test failure via test_args.txt, users want to
run that exact test configuration once, not have it randomly run twice
- The determinism check adds overhead and complexity that isn't needed for
reproduction scenarios
- The check uses config.random which would make reproduction less predictable
This change makes test_args.txt behavior more focused and predictable for
debugging and reproduction workflows.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* TestHarness2: Include ResettingRandomSeed events in test output
Added a handler for ResettingRandomSeed trace events to include them in
the test summary output. This makes random seed reset operations visible
in Joshua logs and test results.
The handler captures:
- NewSeed: The new random seed value
- Time: Simulation time when the reset occurred
This is particularly useful when debugging tests that use --reseed-time
option, as it provides visibility into when and how the random seed was
changed during the test run.
Example output:
<ResettingRandomSeed NewSeed="67890" Time="100.5"/>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Use non-deterministic random for reseed time
To truly randomize the seed reset time.
* clang-format fix
* Address review comments
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* Increase determinism in DeterministicRandom::gen64() by not making output
dependent on unspecified order of execution of arguments to the ^ operator.
Also, rename the member previously known as `random` to `rng`, as `random` is a
C library function.
* DeterministicRandom: use `boost::random::mt19937` for rng repeatability
Currently it invokes pow(10, uniform_rand(log_e(range_begin), log_e(range_end))),
which may overflow beyond UINT32_MAX.
Fix it by preventing log_e(0) case and change pow base to M_E
/home/anoyes/workspace/foundationdb/flow/DeterministicRandom.cpp:72:29: runtime error: negation of -9223372036854775808 cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself
This will allow me to recompile faster after making changes, and should
(slightly) speed up overall compilation.
I manually verified that the unseed matched for one test before and
after this change, so I probably didn't screw up the refactor