-
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