Skip to content

runtests: support multi-target cmake, drop workarounds from CI - #16452

Closed
vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:runtests-multi
Closed

vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:runtests-multi

Conversation

@vszakats

@vszakats vszakats commented Feb 24, 2025 •

Copy link
Copy Markdown
Member

Support multi-target cmake builds via CURL_DIRSUFFIX env. For example:
export CURL_DIRSUFFIX=Debug/.

Multi-target generators place their output to src/<subdir>/,
lib/<subdir>/, tests/server/<subdir>, tests/libtest/<subdir> and
tests/unit/<subdir>/ by default. Before this patch, runtests.pl
couldn't run on such builds because it expected the binaries under the
their <subdir>-less directories. This patch allows to set such subdir
and make runtests.pl find the binaries. In CI we use multi-target
builds with tests for MSVC. It also helps Xcode-generator builds, though
in CI we don't have such job running tests.

There may be better solutions to configure this, but passing a custom
value to runtests.pl including its subprocesses is somewhat tricky.
The reason the configuration value expects the slash at the end is
because MSYS is automagically expanding the env to a (wrong) absolute
path if the slash is in the front.

Also:

  • drop the -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*= workaround from CI.
  • replace resolve references in tests with a new %RESOLVE variable.
    It didn't use a filename extension before. After this patch it uses
    exe_ext('TOOL'). I'm not sure if this is the correct choice vs.
    exe_ext('SRV').
  • fix -c option format in manual.
  • fix some whitespace.

Note, in CI we still tweak CMAKE_RUNTIME_OUTPUT_DIRECTORY_* in jobs
which share steps between ./configure and cmake. It's easier that way.

Ref: #15000
Cherry-picked from #16394

Support multi-target cmake builds via `CURL_DIRSUFFIX` env. Drop using
using `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` as a workaround in CI.

Also:
- replace `resolve` references in tests with a new `%RESOLVE` variable.
- fix `-c` option format in manual.
- fix some whitespace.

Ref: curl#15000
Cherry-picked from curl#16394
@github-actions github-actions Bot added the CI Continuous Integration label Feb 24, 2025
@vszakats vszakats changed the title runtests: support multi-target cmake builds, drop workarounds from CI runtests: support multi-target cmake, drop workarounds from CI Feb 24, 2025
@vszakats vszakats closed this in 3585796 Feb 24, 2025
@vszakats
vszakats deleted the runtests-multi branch February 24, 2025 20:01
vszakats added a commit that referenced this pull request Feb 24, 2025
icing pushed a commit to icing/curl that referenced this pull request Feb 25, 2025
Support multi-target cmake builds via `CURL_DIRSUFFIX` env. For example:
`export CURL_DIRSUFFIX=Debug/`.

Multi-target generators place their output to `src/<subdir>/`,
`lib/<subdir>/`, `tests/server/<subdir>`, `tests/libtest/<subdir>` and
`tests/unit/<subdir>/` by default. Before this patch, `runtests.pl`
couldn't run on such builds because it expected the binaries under the
their `<subdir>`-less directories. This patch allows to set such subdir
and make `runtests.pl` find the binaries. In CI we use multi-target
builds with tests for MSVC. It also helps Xcode-generator builds, though
in CI we don't have such job running tests.

There may be better solutions to configure this, but passing a custom
value to `runtests.pl` including its subprocesses is somewhat tricky.
The reason the configuration value expects the slash at the end is
because MSYS is automagically expanding the env to a (wrong) absolute
path if the slash is in the front.

Also:
- drop the `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` workaround from CI.
- replace `resolve` references in tests with a new `%RESOLVE` variable.
  It didn't use a filename extension before. After this patch it uses
  `exe_ext('TOOL')`. I'm not sure if this is the correct choice vs.
  `exe_ext('SRV')`.
- fix `-c` option format in manual.
- fix some whitespace.

Note, in CI we still tweak `CMAKE_RUNTIME_OUTPUT_DIRECTORY_*` in jobs
which share steps between `./configure` and cmake. It's easier that way.

Ref: curl#15000
Cherry-picked from curl#16394

Closes curl#16452
icing pushed a commit to icing/curl that referenced this pull request Feb 25, 2025
Comment thread tests/runner.pm
my $GDBW = ($gdbxwin) ? "-w" : "";
runclient("$gdb --directory $LIBDIR " . shell_quote($DBGCURL) . " $GDBW -x $LOGDIR/gdbcmd");
runclient("$gdb --directory $LIBDIR " . shell_quote($DBGCURL) . " $GDBW -x $LOGDIR" . "gdbcmd");
$cmdres=0; # makes it always continue after a debugged run

@bagder bagder Feb 26, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vszakats what's the thinking here? What's this change for? This completely breaks runtests -g.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made #16495 in the mean time, but there might be something I don't understand here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made $LIBDIR extendable with extra subdirs (for multi-target) via an env. That env should have started with a slash. Eg /Debug. MSYS automagically "corrects" such values to an abs path. So my solution (also to avoid MSYS specific tricks) was to make $LIBPATH end with a slash by default, and pass Debug/ with an ending slash via the env.

But there seem to be cases where LIBDIR is missing an ending slash!

I can do another round to robustify this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, touching $LOGDIR was totally unnecessary here, I'm guessing that breaks it.

bagder added a commit that referenced this pull request Feb 26, 2025
bagder added a commit that referenced this pull request Feb 26, 2025
vszakats added a commit that referenced this pull request Feb 27, 2025
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Support multi-target cmake builds via `CURL_DIRSUFFIX` env. For example:
`export CURL_DIRSUFFIX=Debug/`.

Multi-target generators place their output to `src/<subdir>/`,
`lib/<subdir>/`, `tests/server/<subdir>`, `tests/libtest/<subdir>` and
`tests/unit/<subdir>/` by default. Before this patch, `runtests.pl`
couldn't run on such builds because it expected the binaries under the
their `<subdir>`-less directories. This patch allows to set such subdir
and make `runtests.pl` find the binaries. In CI we use multi-target
builds with tests for MSVC. It also helps Xcode-generator builds, though
in CI we don't have such job running tests.

There may be better solutions to configure this, but passing a custom
value to `runtests.pl` including its subprocesses is somewhat tricky.
The reason the configuration value expects the slash at the end is
because MSYS is automagically expanding the env to a (wrong) absolute
path if the slash is in the front.

Also:
- drop the `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` workaround from CI.
- replace `resolve` references in tests with a new `%RESOLVE` variable.
  It didn't use a filename extension before. After this patch it uses
  `exe_ext('TOOL')`. I'm not sure if this is the correct choice vs.
  `exe_ext('SRV')`.
- fix `-c` option format in manual.
- fix some whitespace.

Note, in CI we still tweak `CMAKE_RUNTIME_OUTPUT_DIRECTORY_*` in jobs
which share steps between `./configure` and cmake. It's easier that way.

Ref: curl#15000
Cherry-picked from curl#16394

Closes curl#16452
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration cmake tests

Development

Successfully merging this pull request may close these issues.

2 participants