Repository navigation
Conversation
vszakats
marked this pull request as draft
May 5, 2023 01:29
vszakats
force-pushed
the
reduce-srcdir-tricks
branch
2 times, most recently
from
May 5, 2023 14:47
9f233c9 to
7b2fffb
Compare
Hopefully Xcode doesn't break envvars. Added in 54bef4c libssh2#198 libssh2@10a5cbf
This should be unnecessary after 4c9ed51 libssh2#801, that prefixes referenced input filenames with the `srcdir` envvar. The `srcdir` envvar was already exported by autotools, and now we're also setting it from CMake.
`WORKING_DIRECTORY` is no longer necessary, after passing `srcdir` to all tests, so they can find our source tree and keys/etc in it regardless of the current directory. Also this past commit hints that `WORKING_DIRECTORY` wasn't always working for this purpose as expected: "tests: Xcode doesn't obey CMake's test working directory" Ref: libssh2@10a5cbf
Added in 13f8add (2015-07-02) automake documents `srcdir` as exported to the test environment: https://github.com/autotools-mirror/automake/blob/c04c4e8856e3c933239959ce18e16599fcc04a8b/doc/automake.texi#L9302-L9304 It's mentioned in the docs back in 1997 and got its first regression test in 2012. We can safely assume it to be available without setting it ourselves. Rendered docs: https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html
Added in Added in 13f8add (2015-07-02) It seems this wasn't necessary to make the above fix work, and `mansyntax.sh` is able to figure out the build workdir by reading $PWD. Our out-of-tree and `make distcheck` CI builds also work without it. Let us know if there is a scenario we're missing and needs this.
vszakats
force-pushed
the
reduce-srcdir-tricks
branch
from
May 5, 2023 17:27
f24dfa7 to
cce84a0
Compare
vszakats
marked this pull request as ready for review
May 5, 2023 17:32
srcdir to tests
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
After deleting the `bcrypt.h` check, no check remained. Restore a `WIN32` check here to ensure WinCNG is not enabled outside Windows. Follow-up to 1289033 Tested-in libssh2#1032
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Before this patch libssh2 used a variety of solutions to pass the source directory to tests: `FIXTURE_WORKDIR` build-time macro (cmake), `FIXTURE_WORKDIR` envvar (unused), setting `srcdir` manually (autotools), setting current directory (cmake), and also `builddir` envvar (autotools) for passing current working dir to `mansyntax.sh`. This patch reduces this to using existing `srcdir` with autotools and setting it ourselves in CMake. This was mostly enabled by this recent patch: 4c9ed51 Details: - cmake: replace baked-in `FIXTURE_WORKDIR` macro with env. Added in 54bef4c libssh2#198 (2018-03-21) - rename `FIXTURE_WORKDIR` to `srcdir`, to match autotools. - cmake: add missing `srcdir` for algo and sshd tests. - session_fixture: stop `chdir()`-ing, rely on prefixing with `srcdir`. Changing current directory should be unnecessary after 4c9ed51 libssh2#801 (2023-02-24), that prefixes referenced input filenames with the `srcdir` envvar. The `srcdir` envvar was already exported by autotools, and now we're also setting it from CMake. - cmake: stop setting `WORKING_DIRECTORY`, rely on `srcdir` env. `WORKING_DIRECTORY` is no longer necessary, after passing `srcdir` to all tests, so they can find our source tree and keys/etc in it regardless of the current directory. Also this past commit hints that `WORKING_DIRECTORY` wasn't always working for this purpose as expected: "tests: Xcode doesn't obey CMake's test working directory" Ref: libssh2@10a5cbf - autotools: delete explicit `srcdir` for test env. Added in 13f8add (2015-07-02) automake documents `srcdir` as exported to the test environment: https://github.com/autotools-mirror/automake/blob/c04c4e8856e3c933239959ce18e16599fcc04a8b/doc/automake.texi#L9302-L9304 https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html It's mentioned in the docs back in 1997 and got a regression test in 2012. We can safely assume it to be available without setting it ourselves. - autotools: delete explicit `builddir`. Added in 13f8add (2015-07-02) It seems this wasn't necessary to make the above fix work, and `mansyntax.sh` is able to figure out the build workdir by reading `$PWD`. Our out-of-tree and `make distcheck` CI builds also work without it. Let us know if there is a scenario we're missing and needs this. Closes libssh2#1032
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this patch libssh2 used a variety of solutions to pass the source
directory to tests:
FIXTURE_WORKDIRbuild-time macro (cmake),FIXTURE_WORKDIRenvvar (unused), settingsrcdirmanually(autotools), setting current directory (cmake), and also
builddirenvvar (autotools) for passing current working dir to
mansyntax.sh.This patch reduces this to using existing
srcdirwith autotools andsetting it ourselves in CMake. This was mostly enabled by this recent
patch: 4c9ed51
Details:
cmake: replace baked-in
FIXTURE_WORKDIRmacro with env.Added in 54bef4c A collection of small fixes #198 (2018-03-21)
rename
FIXTURE_WORKDIRtosrcdir, to match autotools.cmake: add missing
srcdirfor algo and sshd tests.session_fixture: stop
chdir()-ing, rely on prefixing withsrcdir.Changing current directory should be unnecessary after
4c9ed51 Support running tests in out-of-tree builds & fix some warnings #801 (2023-02-24),
that prefixes referenced input filenames with the
srcdirenvvar.The
srcdirenvvar was already exported by autotools, and now we'realso setting it from CMake.
cmake: stop setting
WORKING_DIRECTORY, rely onsrcdirenv.WORKING_DIRECTORYis no longer necessary, after passingsrcdirtoall tests, so they can find our source tree and keys/etc in it
regardless of the current directory.
Also this past commit hints that
WORKING_DIRECTORYwasn't alwaysworking for this purpose as expected:
"tests: Xcode doesn't obey CMake's test working directory"
Ref: 10a5cbf
autotools: delete explicit
srcdirfor test env.Added in 13f8add (2015-07-02)
automake documents
srcdiras exported to the test environment:https://github.com/autotools-mirror/automake/blob/c04c4e8856e3c933239959ce18e16599fcc04a8b/doc/automake.texi#L9302-L9304
https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html
It's mentioned in the docs back in 1997 and got a regression test in
2012. We can safely assume it to be available without setting it
ourselves.
autotools: delete explicit
builddir.Added in 13f8add (2015-07-02)
It seems this wasn't necessary to make the above fix work, and
mansyntax.shis able to figure out the build workdir by reading$PWD. Our out-of-tree andmake distcheckCI builds also workwithout it.
Let us know if there is a scenario we're missing and needs this.
Closes #1032