Fix race condition in tests/run-tests.sh.