test-lib: Let tests specify commands to be run at end of test