git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/5] t/unit-tests: improve clar platform compatibility

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 21, 2024, 10:56 UTC
Message-ID
<cover.1729506329.git.ps@pks.im>
In-Reply-To
<CAOO-Oz3KsyeSjxbRpU-SdPgU5K+mPDcntT6Y4s46Mg_0ko9e_w@mail.gmail.com>
Hi,

this is the second version of my patch series that addresses some platform compatibility issues with clar. Changes compared to v1:

  - I've merged the CMake fixes at [1] into this patch series to avoid
    conflicts. @Taylor, please drop that other series, which is
    "ps/cmake-clar".
  - I've fixed up the "generate-clar-decls.h" script.
  - I've updated the clar such that it includes upstreamed changes for
    improved uClibc support when we lack support for `wchar_t`.
Thanks!
Patrick
[1]: <cover.1728914219.git.ps@pks.im>
Alejandro R. Sedeño (1):
  Makefile: adjust sed command for generating "clar-decls.h"
Patrick Steinhardt (4):
  t/unit-tests: update clar to 206accb
  Makefile: extract script to generate clar declarations
  cmake: fix compilation of clar-based unit tests
  cmake: set up proper dependencies for generated clar headers
 Makefile                                   |   4 +-
 contrib/buildsystems/CMakeLists.txt        |  52 +++------
 t/unit-tests/clar/.editorconfig            |  13 +++
 t/unit-tests/clar/.github/workflows/ci.yml |  20 +++-
 t/unit-tests/clar/.gitignore               |   1 +
 t/unit-tests/clar/CMakeLists.txt           |  28 +++++
 t/unit-tests/clar/clar.c                   | 127 ++++++++++++---------
 t/unit-tests/clar/clar/print.h             |  11 +-
 t/unit-tests/clar/clar/sandbox.h           |  17 ++-
 t/unit-tests/clar/clar/summary.h           |  14 +--
 t/unit-tests/clar/test/.gitignore          |   4 -
 t/unit-tests/clar/test/CMakeLists.txt      |  39 +++++++
 t/unit-tests/clar/test/Makefile            |  39 -------
 t/unit-tests/generate-clar-decls.sh        |  16 +++
 14 files changed, 219 insertions(+), 166 deletions(-)
 create mode 100644 t/unit-tests/clar/.editorconfig
 create mode 100644 t/unit-tests/clar/.gitignore
 create mode 100644 t/unit-tests/clar/CMakeLists.txt
 delete mode 100644 t/unit-tests/clar/test/.gitignore
 create mode 100644 t/unit-tests/clar/test/CMakeLists.txt
 delete mode 100644 t/unit-tests/clar/test/Makefile
 create mode 100755 t/unit-tests/generate-clar-decls.sh
Range-diff against v1:
1:  a96fbdbb5f9 ! 1:  06145a141dd t/unit-tests: update clar to 0810a36
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    t/unit-tests: update clar to 0810a36
    +    t/unit-tests: update clar to 206accb
     
         Update clar from:
     
    @@ Commit message
     
         To:
     
    -        - 0810a36 (Merge pull request #107 from pks-t/pks-sunos-compatibility, 2024-10-14)
    +        - 206accb (Merge pull request #108 from pks-t/pks-uclibc-without-wchar, 2024-10-21)
     
         This update includes a bunch of fixes and improvements that we have
         discussed in Git when initial support for clar was merged:
    @@ Commit message
           - We now use the combination of mktemp(3) and mkdir(3) on SunOS, same
             as we do on NonStop.
     
    +      - We now support uClibc without support for <wchar.h>.
    +
         The most important bits here are the improved platform compatibility
    -    with Windows, OpenSUSE and SunOS.
    +    with Windows, OpenSUSE, SunOS and uClibc.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ t/unit-tests/clar/clar.c
      
      /* required for sandboxing */
      #include <sys/types.h>
    + #include <sys/stat.h>
    + 
    ++#if defined(__UCLIBC__) && ! defined(__UCLIBC_HAS_WCHAR__)
    ++	/*
    ++	 * uClibc can optionally be built without wchar support, in which case
    ++	 * the installed <wchar.h> is a stub that only defines the `whar_t`
    ++	 * type but none of the functions typically declared by it.
    ++	 */
    ++#else
    ++#	define CLAR_HAVE_WCHAR
    ++#endif
    ++
    + #ifdef _WIN32
    + #	define WIN32_LEAN_AND_MEAN
    + #	include <windows.h>
     @@
      
      #	ifndef stat
    @@ t/unit-tests/clar/clar.c: void clar__assert_equal(
      			}
      		}
      	}
    ++#ifdef CLAR_HAVE_WCHAR
    + 	else if (!strcmp("%ls", fmt)) {
    + 		const wchar_t *wcs1 = va_arg(args, const wchar_t *);
    + 		const wchar_t *wcs2 = va_arg(args, const wchar_t *);
    +@@ t/unit-tests/clar/clar.c: void clar__assert_equal(
    + 			}
    + 		}
    + 	}
     -	else if (!strcmp("%"PRIuZ, fmt) || !strcmp("%"PRIxZ, fmt)) {
     -		size_t sz1 = va_arg(args, size_t), sz2 = va_arg(args, size_t);
    ++#endif /* CLAR_HAVE_WCHAR */
     +	else if (!strcmp("%"PRIuMAX, fmt) || !strcmp("%"PRIxMAX, fmt)) {
     +		uintmax_t sz1 = va_arg(args, uintmax_t), sz2 = va_arg(args, uintmax_t);
      		is_equal = (sz1 == sz2);
2:  dda9b8e033c = 2:  17d77f36d41 Makefile: adjust sed command for generating "clar-decls.h"
-:  ----------- > 3:  c2e3fbcd853 Makefile: extract script to generate clar declarations
-:  ----------- > 4:  a30017a4d89 cmake: fix compilation of clar-based unit tests
-:  ----------- > 5:  bb005979e7e cmake: set up proper dependencies for generated clar headers
base-commit: 3a0677f8601d8937562ba14665d773fd8f2d71da
-- 
2.47.0.72.gef8ce8f3d4.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 15 of 30 in “git no longer builds on SunOS 5.10, a report”
  1. Alejandro R. SedeñoOct 12, 2024
  2. Patrick SteinhardtOct 12, 2024
  3. Alejandro R. SedeñoOct 12, 2024
  4. Makefile: adjust sed command for generating "clar-decls.h"Alejandro R. Sedeño, Oct 12, 2024
  5. Alejandro R. SedeñoOct 12, 2024
  6. Patrick SteinhardtOct 13, 2024
  7. Alejandro R. SedeñoOct 13, 2024
  8. Patrick SteinhardtOct 14, 2024
  9. 0/2 t/unit-tests: improve clar platform compatibilityPatrick Steinhardt, Oct 14, 2024
  10. 1/2 t/unit-tests: update clar to 0810a36Patrick Steinhardt, Oct 14, 2024
  11. 2/2 Makefile: adjust sed command for generating "clar-decls.h"Patrick Steinhardt, Oct 14, 2024
  12. Toon ClaesOct 18, 2024
  13. Taylor BlauOct 18, 2024
  14. Patrick SteinhardtOct 21, 2024
  15. 0/5 t/unit-tests: improve clar platform compatibilityPatrick Steinhardt, Oct 21, 2024
  16. 1/5 t/unit-tests: update clar to 206accbPatrick Steinhardt, Oct 21, 2024
  17. 2/5 Makefile: adjust sed command for generating "clar-decls.h"Patrick Steinhardt, Oct 21, 2024
  18. Kristoffer HaugsbakkOct 21, 2024
  19. Patrick SteinhardtOct 21, 2024
  20. 3/5 Makefile: extract script to generate clar declarationsPatrick Steinhardt, Oct 21, 2024
  21. 4/5 cmake: fix compilation of clar-based unit testsPatrick Steinhardt, Oct 21, 2024
  22. 5/5 cmake: set up proper dependencies for generated clar headersPatrick Steinhardt, Oct 21, 2024
  23. Johannes SchindelinNov 5, 2024
  24. Phillip WoodNov 6, 2024
  25. Patrick SteinhardtNov 8, 2024
  26. Taylor BlauOct 21, 2024
  27. karthik nayakOct 25, 2024
  28. Bagas SanjayaOct 26, 2024
  29. Patrick SteinhardtOct 27, 2024
  30. Taylor BlauOct 27, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.