Skip to content

Commit 10bec78

Browse files
fixes for make distcheck
1 parent bf85bab commit 10bec78

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

scripts/fwd.test

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ then
88
exit 77
99
fi
1010

11-
if [ ! -x ./scripts/fwd.test.expect ]
11+
# Automake sets $srcdir for tests. When building out-of-tree (e.g.
12+
# make distcheck), the expect script only lives in the source tree,
13+
# not the build tree. Fall back to the current directory otherwise.
14+
expect_script="${srcdir:-.}/scripts/fwd.test.expect"
15+
16+
if [ ! -x "$expect_script" ]
1217
then
1318
echo "fail: missing expect script"
1419
exit 1
@@ -46,4 +51,4 @@ fi
4651

4752
# Run the expect script
4853

49-
./scripts/fwd.test.expect
54+
"$expect_script"

tests/regress.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <wolfssh/port.h>
4141
#include <wolfssh/ssh.h>
4242
#include <wolfssh/internal.h>
43+
#include <wolfssh/test.h>
4344
#ifdef WOLFSSH_SFTP
4445
#include <wolfssh/wolfsftp.h>
4546
#endif
@@ -1894,6 +1895,14 @@ int main(int argc, char** argv)
18941895
(void)argc;
18951896
(void)argv;
18961897

1898+
/* Tests load key files via relative paths (e.g. "keys/..."). When invoked
1899+
* from a build directory such as make distcheck's _build/sub, walk up to
1900+
* the source tree before running tests that read those files. */
1901+
#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && \
1902+
!defined(WOLFSSL_TIRTOS) && !defined(WOLFSSL_NUCLEUS)
1903+
ChangeToWolfSshRoot();
1904+
#endif
1905+
18971906
wolfSSH_Init();
18981907

18991908
ctx = wolfSSH_CTX_new(WOLFSSH_ENDPOINT_CLIENT, NULL);

0 commit comments

Comments
 (0)