Skip to content

Commit

Permalink
Fix testsuite with singlethreaded
Browse files Browse the repository at this point in the history
  • Loading branch information
embhorn committed Jul 1, 2024
1 parent 4dabe1c commit dbe2d58
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 10 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/singlethread-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Single-thread Check Test

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
WOLFSSL_REF: v5.7.0-stable

jobs:
build_wolfssl:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
name: Build wolfssl
runs-on: ${{ matrix.os }}
timeout-minutes: 4
steps:
- name: Checking cache for wolfssl
uses: actions/cache@v4
id: cache-wolfssl
with:
path: build-dir/
key: wolfssh-singlethread-check-wolfssl-${{ env.WOLFSSL_REF }}-${{ matrix.os }}
lookup-only: true

- name: Checkout, build, and install wolfssl
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
uses: wolfSSL/actions-build-autotools-project@v1
with:
repository: wolfssl/wolfssl
ref: ${{ env.WOLFSSL_REF }}
path: wolfssl
configure: --enable-wolfssh --enable-singlethreaded --enable-keygen
check: false
install: true

build_wolfssh:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
config: [
'',
'--enable-all',
'--enable-sftp',
'--enable-scp',
'--enable-shell',
]
name: Build wolfssh
runs-on: ${{ matrix.os }}
timeout-minutes: 4
needs: build_wolfssl
steps:
- name: Checking cache for wolfssl
uses: actions/cache@v4
with:
path: build-dir/
key: wolfssh-singlethread-check-wolfssl-${{ env.WOLFSSL_REF }}-${{ matrix.os }}
fail-on-cache-miss: true

- name: Checkout, build, and test wolfssh
uses: wolfSSL/actions-build-autotools-project@v1
with:
repository: wolfssl/wolfssh
path: wolfssh
configure: ${{ matrix.config }} LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include"
check: true
4 changes: 2 additions & 2 deletions apps/wolfssh/wolfssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,14 +1023,14 @@ static THREAD_RETURN WOLFSSH_THREAD wolfSSH_Client(void* args)
if (ret != WS_SUCCESS)
err_sys("Couldn't connect SSH stream.");

MODES_CLEAR();

#if !defined(SINGLE_THREADED) && !defined(WOLFSSL_NUCLEUS)
#if 0
if (keepOpen) /* set up for psuedo-terminal */
ClientSetEcho(2);
#endif

MODES_CLEAR();

if (config.command != NULL || keepOpen == 1) {
#if defined(_POSIX_THREADS)
thread_args arg;
Expand Down
5 changes: 3 additions & 2 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@

#ifdef WOLFSSH_SFTP
#define WOLFSSH_TEST_LOCKING
#define WOLFSSH_TEST_THREADING

#ifndef SINGLE_THREADED
#define WOLFSSH_TEST_THREADING
#endif
#define WOLFSSH_TEST_SERVER
#define WOLFSSH_TEST_ECHOSERVER
#endif
Expand Down
5 changes: 5 additions & 0 deletions tests/sftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
#endif

#include <stdio.h>
#ifdef WOLFSSL_USER_SETTINGS
#include <wolfssl/wolfcrypt/settings.h>
#else
#include <wolfssl/options.h>
#endif
#include <wolfssh/settings.h>

#if defined(WOLFSSH_SFTP) && !defined(SINGLE_THREADED)
Expand Down
13 changes: 7 additions & 6 deletions tests/testsuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
#include <config.h>
#endif

#define WOLFSSH_TEST_CLIENT
#define WOLFSSH_TEST_SERVER
#define WOLFSSH_TEST_THREADING
#define WOLFSSH_TEST_LOCKING


#include <stdio.h>

#ifdef WOLFSSL_USER_SETTINGS
Expand All @@ -36,6 +30,13 @@
#include <wolfssl/options.h>
#endif

#define WOLFSSH_TEST_CLIENT
#define WOLFSSH_TEST_SERVER
#ifndef SINGLE_THREADED
#define WOLFSSH_TEST_THREADING
#endif
#define WOLFSSH_TEST_LOCKING

#include <wolfssh/settings.h>
#include <wolfssh/ssh.h>
#include <wolfssh/test.h>
Expand Down

0 comments on commit dbe2d58

Please sign in to comment.