Skip to content

Conversation

tiennou
Copy link
Contributor

@tiennou tiennou commented Jul 11, 2017

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.

@mention-bot
Copy link

@tiennou, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mback2k, @jas4711 and @vszakats to be potential reviewers.

@tiennou
Copy link
Contributor Author

tiennou commented Mar 16, 2018

Rebased, anyone ?

@willco007
Copy link
Member

The AppVeyor builds are failing, could you look into why? Other than that, the actual refactoring looks good to me.

@tiennou
Copy link
Contributor Author

tiennou commented Mar 19, 2018

Should be fixed. I fixup-ed some defines for missing headers on MSVC, and it's starting to come back green 🤞.

@tiennou tiennou force-pushed the fixes branch 2 times, most recently from 14116a2 to c6f3d84 Compare March 19, 2018 21:10
@willco007
Copy link
Member

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.

Copy link
Contributor Author

@tiennou tiennou left a 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()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs a typedef.

else {
return rc;
}
return run_command(NULL, "docker stop %s", container_id);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indent

#endif
if(!wd) {
#ifdef WIN32
char wd_buf[_MAX_PATH];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indent

}
int rc;

setup_fixture_workdir();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indent

@willco007
Copy link
Member

Oh that's my bad; I was diff'ing against an old branch accidentally so it was showing incorrect changes. Your changes looks good.

@tiennou
Copy link
Contributor Author

tiennou commented Mar 20, 2018

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
@willco007 willco007 merged commit 54bef4c into libssh2:master Mar 20, 2018
@tiennou tiennou deleted the fixes branch April 4, 2018 22:12
kbulgrien pushed a commit to kbulgrien/libssh2-1.2.4-sco3.2v5.0.7 that referenced this pull request Dec 14, 2018
* 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
alex-weaver pushed a commit to alex-weaver/libssh2 that referenced this pull request Mar 23, 2023
* 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
vszakats added a commit to vszakats/libssh2 that referenced this pull request May 5, 2023
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
vszakats added a commit to vszakats/libssh2 that referenced this pull request May 5, 2023
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
vszakats added a commit to vszakats/libssh2 that referenced this pull request May 5, 2023
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
vszakats added a commit to vszakats/libssh2 that referenced this pull request May 5, 2023
vszakats added a commit that referenced this pull request May 5, 2023
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
vszakats pushed a commit to vszakats/libssh2 that referenced this pull request Jul 3, 2024
`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
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
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
`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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants