Skip to content

cmake: make test_read runs cross-build-friendly - #814

Closed
vszakats wants to merge 11 commits into
libssh2:masterfrom
vszakats:tests-crossbuildable
Closed

vszakats wants to merge 11 commits into
libssh2:masterfrom
vszakats:tests-crossbuildable

Conversation

@vszakats

@vszakats vszakats commented Mar 4, 2023 •

Copy link
Copy Markdown
Member

Improve tests added in 7487dcf by
running test_read commands directly. This makes external shell/batch
files unnecessary, and is friendlier with cross-builds and when run
from non-default shells, like MSYS2.

Also extend CRYPT/MAC test error messages with the CRYPT/MAC name.

Closes #814


NOTE: After this, new test will have to be re-applied in pending PR #655. Sorry about this.

@vszakats vszakats changed the title make new tests more friendly to cross-builds make test_read tests cross-build-friendly Mar 4, 2023
@vszakats
vszakats marked this pull request as draft March 4, 2023 22:08

@dfandrich dfandrich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm glad someone who knows cmake is looking at this!

Comment thread tests/CMakeLists.txt Resolved
@vszakats
vszakats force-pushed the tests-crossbuildable branch 2 times, most recently from 4fe17d1 to 4c76a2a Compare March 4, 2023 23:23
@vszakats
vszakats marked this pull request as ready for review March 4, 2023 23:25
@vszakats
vszakats requested a review from dfandrich March 5, 2023 00:20
@vszakats vszakats changed the title make test_read tests cross-build-friendly make test_read tests cross-build-friendly Mar 5, 2023
@vszakats vszakats changed the title make test_read tests cross-build-friendly make test_read runs cross-build-friendly Mar 5, 2023
@vszakats vszakats changed the title make test_read runs cross-build-friendly tests: make test_read runs cross-build-friendly Mar 5, 2023
@vszakats
vszakats force-pushed the tests-crossbuildable branch 2 times, most recently from edb4eea to ee89c75 Compare March 5, 2023 02:50
Also include failed CRYPT/MAC name in error message.
@vszakats
vszakats force-pushed the tests-crossbuildable branch from ee89c75 to 5649204 Compare March 5, 2023 02:52
@dfandrich

Copy link
Copy Markdown
Contributor

I should mention that the other reason I created a file per test is that on autoconf builds, there's no other way to easily run the crypt & hash tests since they're not integrated into automake yet. I'm not sure if automake allows the kind of environment variable override that this PR is doing in the cmake builds. If not, then we should keep the test script stubs so that we can run the tests in automake as well.

@vszakats

vszakats commented Mar 5, 2023

Copy link
Copy Markdown
Member Author

For autotools, could a single script work instead of one per test? Since autotools needs a unixy shell anyway, do we also need the batch files?

@dfandrich

dfandrich commented Mar 5, 2023 via email

Copy link
Copy Markdown
Contributor

@vszakats

vszakats commented Mar 6, 2023

Copy link
Copy Markdown
Member Author

Autotools never executed these new tests 1, so this feels out of scope for this PR.

For the heck of it, I've made a single script (easier to read, extend, and reuse with any build tool). Appended it to autotools' TESTS to get it run. Bear in mind this is the first time I'm dealing with make check.

UPDATE 1: It run successfully on Linux 2, failed on MSYS2 3. autotools stdout helpfully says: "See tests/test-suite.log". The actual test output is in that file. Some research turned up a thread with a solution: make check VERBOSE=1.

UPDATE 2: Solution works 4, with the output visible for each individual test. MSYS2 fails because "Failed to build docker image", so we now have another problem.

Footnotes

  1. https://github.com/libssh2/libssh2/actions/runs/4307684403/jobs/7513053415 ↩

  2. https://github.com/libssh2/libssh2/actions/runs/4338492263/jobs/7575227478 ↩

  3. https://github.com/libssh2/libssh2/actions/runs/4338492263/jobs/7575226145 ↩

  4. https://github.com/libssh2/libssh2/actions/runs/4338656472/jobs/7575506729 ↩

@dfandrich

dfandrich commented Mar 6, 2023 via email

Copy link
Copy Markdown
Contributor

@vszakats
vszakats force-pushed the tests-crossbuildable branch from ecb96c1 to f7698a5 Compare March 6, 2023 10:12
@vszakats

vszakats commented Mar 6, 2023

Copy link
Copy Markdown
Member Author

Shell scripts restored.

@vszakats
vszakats dismissed dfandrich’s stale review March 6, 2023 11:44

This seems stuck from the first resolved review. Please reopen if I missed something pending.

@vszakats vszakats changed the title tests: make test_read runs cross-build-friendly cmake: make test_read runs cross-build-friendly Mar 6, 2023
@vszakats
vszakats removed the request for review from dfandrich March 7, 2023 14:16
@vszakats vszakats closed this in 23a21aa Mar 7, 2023
@vszakats
vszakats deleted the tests-crossbuildable branch March 7, 2023 14:30
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
Improve tests added in 7487dcf by
running `test_read` commands directly. This makes external shell/batch
files unnecessary, and is friendlier with cross-builds and when run
from non-default shells, like MSYS2.

Also extend CRYPT/MAC test error messages with the CRYPT/MAC name.

External runner shell scripts kept for future use.

Closes libssh2#814
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.

2 participants