Created struct pipe and associated functions.

Replace one pipe in run_tests() with a struct pipe.