[libc-commits] [PATCH] D72353: [libc] Add a convenience CMake rule to add testsuites.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jan 7 14:24:58 PST 2020


sivachandra marked an inline comment as done.
sivachandra added a comment.

In D72353#1808713 <https://reviews.llvm.org/D72353#1808713>, @abrachet wrote:

> This patch is fine but my build fails (unrelated to this patch)
>
>   make[3]: *** No rule to make target 'projects/libc/src/errno/CMakeFiles/__errno_location_objects.dir/errno_location.cpp.o', needed by 'projects/libc/src/errno/__errno_location_raw.o'.  Stop.
>
>
> But this happened before applying this patch (and after too). On CMake 3.7 and 3.16. Does it build for you?


I confess I never built with make. I have always tested with Ninja, and it still works. I use CMake 3.13.4.

I tried with make, and indeed it fails in exactly the same fashion. Will dig into this separately. That it works with Ninja seems to indicate a CMake problem.



================
Comment at: libc/test/src/errno/CMakeLists.txt:1
-add_custom_target(libc_errno_unittests)
-add_dependencies(check_libc libc_errno_unittests)
+add_libc_testsuite(libc_errno_unittests)
 
----------------
abrachet wrote:
> It seems like the rest of LLVM would call this LibcErrnoUnittests, but I don't care too much for the formatting just thought I would bring it up.
I picked this naming style from libcxx. It has targets with names `cxx_abi_headers`, `cxx_external_threads`,  etc., and test targets like `libcxx_test_objects`.

TBF, I do not like either of these naming styles. I prefer target names which reflect the source layout. For example, one should not need to list a suites like this at all. Each directory in the `test` subtree should get its own suite automatically. Its fully qualified name should be something like `libc.test.src.errno.all`. Individual targets, like the `errno_test` listed below, will automatically be part of the suite for the directory and have a fully qualified name like `libc.test.src.errno.errno_test`.

It is possible to implement such a system in CMake, and a project where it was implemented successfully is this: https://github.com/google/pytype 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72353/new/

https://reviews.llvm.org/D72353





More information about the libc-commits mailing list