• Matthew Slipper's avatar
    ctb: Fix multithreaded test race · f1ec8e63
    Matthew Slipper authored
    `generate-l2-genesis.sh` is causing spurious test failures. The `.testdata/genesis.json` file comes up as zero-length in tests, even when the script checks for its length before exiting. I believe this is because multiple processes are executing the `generate-l2-genesis.sh` file at once, which causes a race condition where different invocations of the script cause the genesis file to be truncated.
    
    This PR attempts to fix the issue by using a temporary directory as a lock to prevent multiple invocations of the `generate-l2-genesis.sh` script from running at the same time. Directory creations are atomic in Bash, so we can use this technique to create a mutex. If the directory can't be created, then the script will assume that another script is writing the genesis file and wait up to 5 minutes for it to be created. The script uses `trap` to delete the mutex directory when it's done.
    f1ec8e63
Name
Last commit
Last update
..
getting-started Loading commit data...
go-ffi Loading commit data...
interfaces Loading commit data...
libraries Loading commit data...
universal Loading commit data...
ChainAssertions.sol Loading commit data...
Chains.sol Loading commit data...
Deploy.s.sol Loading commit data...
DeployConfig.s.sol Loading commit data...
DeployL2.s.sol Loading commit data...
DeployPeriphery.s.sol Loading commit data...
Deployer.sol Loading commit data...
Executables.sol Loading commit data...
FaultDisputeGameViz.s.sol Loading commit data...
FeeVaultWithdrawal.s.sol Loading commit data...
PeripheryDeployConfig.s.sol Loading commit data...
SemverLock.s.sol Loading commit data...
Types.sol Loading commit data...
check-deploy-configs.sh Loading commit data...
check-snapshots.sh Loading commit data...
dag-viz.py Loading commit data...
deploy.sh Loading commit data...
forge-test-names.ts Loading commit data...
generate-l2-genesis.sh Loading commit data...
generate-snapshots.ts Loading commit data...
invariant-doc-gen.ts Loading commit data...
restructure_tests.py Loading commit data...
slither.sh Loading commit data...
statediff.sh Loading commit data...
validate-spacers.ts Loading commit data...
verify-foundry-install.sh Loading commit data...