Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix testsuite with singlethreaded #716

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
19 changes: 9 additions & 10 deletions apps/wolfssh/wolfssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ static const char* caCert = NULL;
#endif


#if defined(WOLFSSH_AGENT)
static inline void ato32(const byte* c, word32* u32)
{
*u32 = (c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
}
#endif


static int NonBlockSSH_connect(WOLFSSH* ssh)
{
int ret;
Expand Down Expand Up @@ -215,6 +207,13 @@ static void modes_reset(void)

#if !defined(SINGLE_THREADED) && !defined(WOLFSSL_NUCLEUS)

#if defined(WOLFSSH_AGENT)
static inline void ato32(const byte* c, word32* u32)
{
*u32 = (c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
}
#endif

typedef struct thread_args {
WOLFSSH* ssh;
wolfSSL_Mutex lock;
Expand Down Expand Up @@ -1023,14 +1022,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
Loading