Repository navigation
Conversation
To apply to all test apps. Replacing the macro set for fixtures only. Ref: libssh2#2408 (comment)
LIBSSH2_TESTS macro for testsLIBSSH2_TESTS macro for all tests
There was a problem hiding this comment.
Pull request overview
This PR moves the LIBSSH2_TESTS preprocessor macro from a single fixture header to the build system so it is applied consistently across test compilation units, aligning test builds across autotools and CMake.
Changes:
- Remove the
#define LIBSSH2_TESTSfromtests/session_fixture.h. - Define
LIBSSH2_TESTSglobally for autotools-built tests viatests/Makefile.am. - Define
LIBSSH2_TESTSfor CMake-built tests via a directory-level compile definition intests/CMakeLists.txt.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/session_fixture.h | Stops defining LIBSSH2_TESTS in the fixture header so the macro is controlled by the build system. |
| tests/Makefile.am | Adds -DLIBSSH2_TESTS to AM_CPPFLAGS so autotools-built tests all see the macro. |
| tests/CMakeLists.txt | Adds a directory-level LIBSSH2_TESTS definition for CMake-built tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vszakats
added a commit
that referenced
this pull request
Jul 23, 2026
Fixing:
```
tests/test_simple.c:84:56: error: operand of ? changes signedness: 'int' to 'unsigned long' [clang-diagnostic-sign-conversion]
84 | gcry_mpi_t f = gcry_mpi_set_ui(NULL, fi >= 0 ? fi : -fi);
| ~~~~~~~~~~~~~~~ ^~
tests/test_simple.c:84:61: error: operand of ? changes signedness: 'int' to 'unsigned long' [clang-diagnostic-sign-conversion]
84 | gcry_mpi_t f = gcry_mpi_set_ui(NULL, fi >= 0 ? fi : -fi);
| ~~~~~~~~~~~~~~~ ^~~
tests/test_simple.c:85:46: error: implicit conversion changes signedness: 'int' to 'unsigned long' [clang-diagnostic-sign-conversion]
85 | gcry_mpi_t p = gcry_mpi_set_ui(NULL, atoi(tests[i].p));
| ~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
```
Ref: https://github.com/libssh2/libssh2/actions/runs/30043871895/job/89330114459#step:24:124
Also add intermediate current test holder var to keep code readable.
Follow-up to 76d30e5 #2417
Follow-up to fcf8307 #2239
Closes #2418
SebTardif
added a commit
to SebTardif/libssh2
that referenced
this pull request
Jul 23, 2026
- Parse buffer as const char * (fewer casts at call sites / tests) - Check snprintf return before filling the long-name fixture - Single-line memset for the basename fill - Drop local LIBSSH2_TESTS define (build sets it for all tests after libssh2#2417) Signed-off-by: Sebastien Tardif <[email protected]>
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.
To apply to all test apps. Prior to this patch it was set for fixtures only.
Ref: #2408 (comment)