Update tests to avoid printf to stdout/stderr when running as test cases.