• 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
..
deploy-config Loading commit data...
deployments Loading commit data...
invariant-docs Loading commit data...
lib Loading commit data...
periphery-deploy-config Loading commit data...
scripts Loading commit data...
snapshots Loading commit data...
src Loading commit data...
test Loading commit data...
.eslintignore Loading commit data...
.eslintrc.js Loading commit data...
.gas-snapshot Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
STYLE_GUIDE.md Loading commit data...
foundry.toml Loading commit data...
package.json Loading commit data...
semver-lock.json Loading commit data...
slither-report.json Loading commit data...
slither.config.json Loading commit data...
tsconfig.build.json Loading commit data...
tsconfig.json Loading commit data...