Build the server with --dbg=on --opt=off, for example:
buildscripts/scons.py -j256 --ssl --build-tools=next --variables-files=etc/scons/developer_versions.vars --variables-files=etc/scons/mongodbtoolchain_stable_clang.vars CCACHE=ccache ICECC=icecc VARIANT_DIR=ninja DESTDIR=build/install --link-model=dynamic --dbg=on --opt=off --use-libunwind=off LINKFLAGS=-rdynamic --ninja generate-ninja ninja -j256 ./build/install/bin/db_storage_test
Then run the CollectionMarkersTest/SamplingAutoYieldingWorks unit-test:
./build/install/bin/db_storage_test --suite CollectionMarkersTest
The test will fail with:
2023-06-27T13:19:45.220Z I TEST [main] Totals {"totals":{"name":"TOTALS","tests":8,"fails":2,"asserts":0,"time":{"durationMillis":4889},"failures":[{"test":"ScanningAutoYieldingWorks","type":"TestAssertionFailureException","error":"Expected CurOp::get(opCtx.get())->numYields() == kNumElements / internalQueryExecYieldIterations.load() (6 == 5) @src/mongo/db/storage/collection_truncate_markers_test.cpp:500"}]}} 2023-06-27T13:19:45.221Z I TEST [main] Test Failed {"testName":"CollectionMarkersTest/ScanningAutoYieldingWorks","exception":"TestAssertionFailureException","error":"Expected CurOp::get(opCtx.get())->numYields() == kNumElements / internalQueryExecYieldIterations.load() (6 == 5) @src/mongo/db/storage/collection_truncate_markers_test.cpp:500"} 2023-06-27T13:19:45.221Z I TEST [main] Test Failed {"testName":"CollectionMarkersTest/SamplingAutoYieldingWorks","exception":"TestAssertionFailureException","error":"Expected CurOp::get(opCtx.get())->numYields() == kNumElementsToSample / internalQueryExecYieldIterations.load() (6 == 3) @src/mongo/db/storage/collection_truncate_markers_test.cpp:562"} 2023-06-27T13:19:45.222Z I TEST [main] FAILURE {"failedTestsCount":2,"failedSuitesCount":1,"failedTests":["CollectionMarkersTest/ScanningAutoYieldingWorks","CollectionMarkersTest/SamplingAutoYieldingWorks"]}