Details
- Reviewers
courbet
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/test/src/string/memory_utils/memory_check_utils.h | ||
---|---|---|
111 | I did not look enough to see if the logging parts are runtime code or test only code. If it is test only, may be add a comment saying that? If not, then a better approach is to use LIBC_ASSERT: https://github.com/llvm/llvm-project/blob/main/libc/src/__support/libc_assert.h |
libc/test/src/string/memory_utils/memory_check_utils.h | ||
---|---|---|
111 |
testing::tlog is the logging infrastructure that is used in LibUnitTest and this file is used in unit tests only (libc/*test*/src/string/memory_utils/memory_check_utils.h) so I think this is OK. Are you suggesting that I comment all testing::log lines in this file? |
libc/test/src/string/memory_utils/memory_check_utils.h | ||
---|---|---|
111 | Sorry, I did not compose my comment correctly. I should have said: ... if the logging parts are **for testing runtime code**... What I meant was, if these messages are for catching test failures, then they should be in some EXPECT_* as the raw log messages do not come with line numbers. Or, if they are only providing assert like protection, using a real assert like LIBC_ASSERT is better because they also come with line numbers. About comments, if you do not want to use EXPECT_* macros, add comments why. |
libc/test/src/string/memcmp_test.cpp | ||
---|---|---|
54 | ASSERT_TRUE(CheckMemcmp<Impl>(span1, span2, size)) << "size=" << size; ? |
libc/test/src/string/memcmp_test.cpp | ||
---|---|---|
54 | The libc version of ASSERT_* and EXPECT_* do not allow logging yet. | |
libc/test/src/string/memory_utils/memory_check_utils.h | ||
111 | Ha ok : ) Now I understand. So this is indeed to catch test failures. I did not use EXPECT_* for several reasons:
Now another solution could be to use EXPECT_* here, to return false and to ASSERT_TRUE at the call site. But we would still need to log additional information. Currently, EXPECT_* and ASSERT_* do not allow logging. I think the solution here is to create custom matchers. |
ASSERT_TRUE(CheckMemcmp<Impl>(span1, span2, size)) << "size=" << size; ?