Clean up $pid1 and $pid2 global variables in tests.

(also, use Integer() instead of #to_i)