tests: fix test-runner for osx. Closes #4708

Use the more portable $$ rather than $BASHPID