[all-commits] [llvm/llvm-project] a417ee: [libc] Remove use of 'assert' from the string tests

Joseph Huber via All-commits all-commits at lists.llvm.org
Tue May 2 16:51:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a417ee9ccfbc59ac8910e77d3138985240d78e28
      https://github.com/llvm/llvm-project/commit/a417ee9ccfbc59ac8910e77d3138985240d78e28
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-05-02 (Tue, 02 May 2023)

  Changed paths:
    M libc/test/src/string/bzero_test.cpp
    M libc/test/src/string/memory_utils/memory_check_utils.h
    M libc/test/src/string/memory_utils/op_tests.cpp

  Log Message:
  -----------
  [libc] Remove use of 'assert' from the string tests

Currently we use `assert` as a stand-in for the typical test assertions.
This is because these functions exist outside of the base test class so
we can't use the typical assertion methods. The presence of these
asserts makes it difficult to compile these tests in a standalone
format. This patch removes all occurrences.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149656


  Commit: 9a20e024a25ce1e20556dc4e567a9d943bff4c7e
      https://github.com/llvm/llvm-project/commit/9a20e024a25ce1e20556dc4e567a9d943bff4c7e
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-05-02 (Tue, 02 May 2023)

  Changed paths:
    M libc/test/UnitTest/CMakeLists.txt
    M libc/test/src/string/CMakeLists.txt
    M libc/test/src/string/memory_utils/CMakeLists.txt

  Log Message:
  -----------
  [libc] Enable the 'string' unit tests to be hermetic

This changes over the string unit tests to the new `add_libc_test`
framework. The one test that wasn't changes was the memory utils because
it overran the static buffer used for the hermetic test's bump pointer.

Depends on D149656

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149662


  Commit: 644b63bd31f55aaaf1ebafc7df7cd7cea2aa26a8
      https://github.com/llvm/llvm-project/commit/644b63bd31f55aaaf1ebafc7df7cd7cea2aa26a8
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-05-02 (Tue, 02 May 2023)

  Changed paths:
    M libc/cmake/modules/LLVMLibCTestRules.cmake
    M libc/test/src/string/memory_utils/CMakeLists.txt

  Log Message:
  -----------
  [libc] Add 'UNIT_TEST_ONLY' and 'HERMETIC_TEST_ONLY' to 'add_libc_test'

The `add_libc_test` option allows us to enable both kinds of tests in a
single option. However, some tests cannot be made hermetic with the
current approach. Such as tests that rely on system utilities or
libraries. This patch adds two options `UNIT_TEST_ONLY` and
`HERMETIC_TEST_ONLY` to offer more fine-grained control over which
version gets built. This makes it explicit which version a test supports
and why.

Depends on D149662

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149691


Compare: https://github.com/llvm/llvm-project/compare/6ea1a0d4fc38...644b63bd31f5


More information about the All-commits mailing list