t/test-lib.sh: fix running tests with --valgrind