create separate lock testing script

Avoids single-line syntax errors on Windows by saving test script into a
file and executing that.