-
Notifications
You must be signed in to change notification settings - Fork 589
A collection of small fixes #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Rebased, anyone ? |
The AppVeyor builds are failing, could you look into why? Other than that, the actual refactoring looks good to me. |
Should be fixed. I fixup-ed some defines for missing headers on MSVC, and it's starting to come back green 🤞. |
14116a2
to
c6f3d84
Compare
Taking more of a look at this, some of the formatting needs to be updated/reverted to match the formatting guidelines. For example, no spaces after if/for and before ( and the else bracket formatting. That will cut down on the churn as well. After that's fixed, I'm ready to take these changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do, I'm just confused, I haven't seen anything wrong per-se style-wise (apart from the things I commented on). Care to elaborate ?
From what I can see, the syntax is something like :
if/while(expr) {
/* spaces */
}
else {
}
Right ?
src/openssl.h
Outdated
ENGINE_register_all_complete() | ||
#endif | ||
|
||
#define libssh2_crypto_init() _libssh2_openssl_crypto_init() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a typedef.
tests/openssh_fixture.c
Outdated
else { | ||
return rc; | ||
} | ||
return run_command(NULL, "docker stop %s", container_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent
tests/session_fixture.c
Outdated
#endif | ||
if(!wd) { | ||
#ifdef WIN32 | ||
char wd_buf[_MAX_PATH]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent
tests/session_fixture.c
Outdated
} | ||
int rc; | ||
|
||
setup_fixture_workdir(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent
Oh that's my bad; I was diff'ing against an old branch accidentally so it was showing incorrect changes. Your changes looks good. |
Should be ready now, I took care of the issues I saw. Glad the style is OK 😉. |
On my machine I have libssh2 1.6 installed, which was actually used instead of libssh2, so I got an error because of a missing LIBSSH2_ERROR_CHANNEL_WINDOW_FULL
* tests: Remove if-pyramids * tests: Switch run_command arguments * tests: Make run_command a vararg function * tests: Xcode doesn't obey CMake's test working directory * openssl: move manual AES-CTR cipher into crypto init * cmake: Move our include dir before all other include paths
* tests: Remove if-pyramids * tests: Switch run_command arguments * tests: Make run_command a vararg function * tests: Xcode doesn't obey CMake's test working directory * openssl: move manual AES-CTR cipher into crypto init * cmake: Move our include dir before all other include paths
Hopefully Xcode doesn't ignore this one. For sshd tests the runner script already changes current directory into the script's. Ref: 54bef4c libssh2#198 libssh2@10a5cbf
Hopefully Xcode doesn't ignore this one. For sshd tests the runner script already changes current directory into the script's. Ref: 54bef4c libssh2#198 libssh2@10a5cbf
Hopefully Xcode doesn't ignore this one. For sshd tests the runner script already changes current directory into the script's. Ref: 54bef4c libssh2#198 libssh2@10a5cbf
Hopefully Xcode doesn't break envvars. Added in 54bef4c libssh2#198 libssh2@10a5cbf
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 #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 #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: 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 #1032
`MAXPATHLEN` is not present in some systems, e.g. GNU Hurd. Co-authored-by: Viktor Szakats Ref: 54bef4c libssh2#198 Fixes libssh2#1414 Closes libssh2#1415
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
`MAXPATHLEN` is not present in some systems, e.g. GNU Hurd. Co-authored-by: Viktor Szakats Ref: 54bef4c libssh2#198 Fixes libssh2#1414 Closes libssh2#1415
This is a handful of small test-harness tweaks I collected while trying to have Xcode run the test cases (for the record, you need to set your PATH env-var correctly so Xcode finds
docker
, for each separate test case you need to debug).The second commit moves our headers first in the list, so Xcode wouldn't try to use the ones from "system" locations (ie. Homebrew's
/usr/local
).The last one hides OpenSSL's AES-CTR thingy inside its own initialization so it doesn't force other backends to
NOP
it.