Re: [PATCH 2/2] t/Makefile: get UNIT_TESTS list from C sources
- From
Jeff King <peff@peff.net>
- Date
- Jan 29, 2024, 17:49 UTC
- Message-ID
- <20240129174918.GA3765717@coredump.intra.peff.net>
- In-Reply-To
- <ZbeLcrjIYd4d7PaB@tanuki>
On Mon, Jan 29, 2024 at 12:26:42PM +0100, Patrick Steinhardt wrote:
Show 7 quoted lines
> > -UNIT_TESTS = $(sort $(filter-out %.pdb unit-tests/bin/t-basic%,$(wildcard unit-tests/bin/t-*))) > > +UNIT_TEST_SOURCES = $(wildcard unit-tests/t-*.c) > > +UNIT_TEST_PROGRAMS = $(patsubst unit-tests/%.c,unit-tests/bin/%,$(UNIT_TEST_SOURCES)) > > +UNIT_TESTS = $(sort $(filter-out unit-tests/bin/t-basic%,$(UNIT_TEST_PROGRAMS))) > > Wouldn't we have to honor `$X` on Windows systems so that the unit tests > have the expected ".exe" suffix here?
Hmm, good point. It seems like the answer should obviously be "yes", but Windows CI seemed to pass all the same (and I checked that it indeed ran the unit tests). Do we only get the $X suffix for MSVC builds or something? Looks like maybe cygwin, as well.
I imagine the solution is just:
diff --git a/t/Makefile b/t/Makefile index c5c6e2ef6b..9b9b30f559 100644 --- a/t/Makefile +++ b/t/Makefile @@ -43,7 +43,7 @@ TINTEROP = $(sort $(wildcard interop/i[0-9][0-9][0-9][0-9]-*.sh)) CHAINLINTTESTS = $(sort $(patsubst chainlint/%.test,%,$(wildcard chainlint/*.test))) CHAINLINT = '$(PERL_PATH_SQ)' chainlint.pl UNIT_TEST_SOURCES = $(wildcard unit-tests/t-*.c) -UNIT_TEST_PROGRAMS = $(patsubst unit-tests/%.c,unit-tests/bin/%,$(UNIT_TEST_SOURCES)) +UNIT_TEST_PROGRAMS = $(patsubst unit-tests/%.c,unit-tests/bin/%$(X),$(UNIT_TEST_SOURCES)) UNIT_TESTS = $(sort $(filter-out unit-tests/bin/t-basic%,$(UNIT_TEST_PROGRAMS))) # `test-chainlint` (which is a dependency of `test-lint`, `test` and `prove`) but it looks like we might need to include config.mak.uname, as well. It would be nice to identify a build that actually needs it so I can confirm that the fix works. -Peff