[libcxx-commits] [libcxxabi] cc69d21 - [libc++/abi] Clean up uses of <iostream> in the test suite

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 19 01:27:15 PDT 2020


On Tue, 13 Oct 2020, Louis Dionne via libcxx-commits wrote:

>
> Author: Louis Dionne
> Date: 2020-10-13T20:25:33-04:00
> New Revision: cc69d211d0d65d7bf0335fecbc323f784ac3afcc
>
> URL: https://github.com/llvm/llvm-project/commit/cc69d211d0d65d7bf0335fecbc323f784ac3afcc
> DIFF: https://github.com/llvm/llvm-project/commit/cc69d211d0d65d7bf0335fecbc323f784ac3afcc.diff
>
> LOG: [libc++/abi] Clean up uses of <iostream> in the test suite
>
> We used <iostream> in several places where we don't actually need the
> full power of <iostream>, and where using basic `std::printf` is enough.
> This is better, since `std::printf` can be supported on systems that don't
> have a notion of locales, while <iostream> can't.
>

> diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
> index bb0ad1da30c7..c8753b02f7f3 100644
> --- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
> +++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
> @@ -130,11 +127,11 @@ int main(int, char**) {
>     const fs::path output = p.lexically_normal();
>     if (!PathEq(output, TC.expect)) {
>       Failed = true;
> -      std::cerr << "TEST CASE #" << ID << " FAILED: \n";
> -      std::cerr << "  Input: '" << TC.input << "'\n";
> -      std::cerr << "  Expected: '" << TC.expect << "'\n";
> -      std::cerr << "  Output: '" << output.native() << "'";
> -      std::cerr << std::endl;
> +      std::printf("TEST CASE #%d FAILED:\n"
> +                  "  Input: '%s'\n"
> +                  "  Expected: '%s'\n"
> +                  "  Output: '%s'\n",
> +        ID, TC.input.c_str(), TC.expect.c_str(), output.native().c_str());
>     }
>   }
>   return Failed;
>

This change, and a few other of the hunks in this commit, changed the 
tests to print to stdout, where they previously printed to stderr. Would 
you be ok with a patch that changes them back to stderr?

For the cases where a test fails, llvm-lit currently prints the stdout 
output above the stderr output, making it more work to find the relevant 
output of the failing test.

// Martin



More information about the libcxx-commits mailing list