Run two processes. The first changes the input file as fast as possible. The second one runs the test until an error occurs. If you get the right error, then the test passes; otherwise the test fails. Running more copies of the test at once should increase the chances of hitting the race condition.
But why have the race condition at all? Opening the input file provides the needed feedback about the parameter.
Are you sure you also don’t have a race condition the directory and output checks?