Merge pull request #107 from ejohnstown/fix-no-inline

Fix disable-inline option.
pull/110/head
JacobBarthelmeh 2018-09-24 09:54:35 -06:00 committed by GitHub
commit 1524c73438
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 95 additions and 54 deletions

View File

@ -18,6 +18,8 @@
* along with wolfSSH. If not, see <http://www.gnu.org/licenses/>. * along with wolfSSH. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define WOLFSSH_TEST_CLIENT
#include <wolfssh/ssh.h> #include <wolfssh/ssh.h>
#include <wolfssh/test.h> #include <wolfssh/test.h>

View File

@ -18,6 +18,8 @@
* along with wolfSSH. If not, see <http://www.gnu.org/licenses/>. * along with wolfSSH. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define WOLFSSH_TEST_SERVER
#ifdef WOLFSSL_USER_SETTINGS #ifdef WOLFSSL_USER_SETTINGS
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>

View File

@ -18,6 +18,9 @@
* along with wolfSSH. If not, see <http://www.gnu.org/licenses/>. * along with wolfSSH. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define WOLFSSH_TEST_SERVER
#define WOLFSSH_TEST_THREADING
#ifdef WOLFSSL_USER_SETTINGS #ifdef WOLFSSL_USER_SETTINGS
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>

View File

@ -18,6 +18,9 @@
* along with wolfSSH. If not, see <http://www.gnu.org/licenses/>. * along with wolfSSH. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define WOLFSSH_TEST_CLIENT
#define WOLFSSH_TEST_SERVER
#include <stdio.h> #include <stdio.h>
#include <termios.h> #include <termios.h>

View File

@ -29,9 +29,11 @@
#include <config.h> #include <config.h>
#endif #endif
#ifdef WOLFSSL_USER_SETTINGS
#include <wolfssh/settings.h> #include <wolfssl/wolfcrypt/settings.h>
#else
#include <wolfssl/options.h>
#endif
#ifndef WOLFSSH_MISC_C #ifndef WOLFSSH_MISC_C
#define WOLFSSH_MISC_C #define WOLFSSH_MISC_C

View File

@ -18,6 +18,11 @@
* along with wolfSSH. If not, see <http://www.gnu.org/licenses/>. * along with wolfSSH. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define WOLFSSH_TEST_CLIENT
#define WOLFSSH_TEST_SERVER
#define WOLFSSH_TEST_THREADING
#define WOLFSSH_TEST_LOCKING
#include <stdio.h> #include <stdio.h>

View File

@ -18,6 +18,8 @@
* along with wolfSSH. If not, see <http://www.gnu.org/licenses/>. * along with wolfSSH. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define WOLFSSH_TEST_CLIENT
#include <wolfssh/ssh.h> #include <wolfssh/ssh.h>
#include <wolfssh/wolfsftp.h> #include <wolfssh/wolfsftp.h>
#include <wolfssh/test.h> #include <wolfssh/test.h>

View File

@ -29,6 +29,8 @@
#endif #endif
#include <wolfssl/wolfcrypt/types.h>
#include <wolfssh/settings.h>
#include <wolfssh/port.h> #include <wolfssh/port.h>

View File

@ -149,56 +149,6 @@
#define serverKeyRsaPemFile "./keys/server-key-rsa.pem" #define serverKeyRsaPemFile "./keys/server-key-rsa.pem"
typedef struct tcp_ready {
word16 ready; /* predicate */
word16 port;
char* srfName; /* server ready file name */
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_t mutex;
pthread_cond_t cond;
#endif
} tcp_ready;
static INLINE void InitTcpReady(tcp_ready* ready)
{
ready->ready = 0;
ready->port = 0;
ready->srfName = NULL;
#ifdef SINGLE_THREADED
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_init(&ready->mutex, 0);
pthread_cond_init(&ready->cond, 0);
#endif
}
static INLINE void FreeTcpReady(tcp_ready* ready)
{
#ifdef SINGLE_THREADED
(void)ready;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_destroy(&ready->mutex);
pthread_cond_destroy(&ready->cond);
#else
(void)ready;
#endif
}
typedef struct func_args {
int argc;
char** argv;
int return_code;
tcp_ready* signal;
WS_CallbackUserAuth user_auth;
} func_args;
typedef THREAD_RETURN WOLFSSH_THREAD THREAD_FUNC(void*);
void WaitTcpReady(func_args*);
#ifndef TEST_IPV6 #ifndef TEST_IPV6
static const char* const wolfSshIp = "127.0.0.1"; static const char* const wolfSshIp = "127.0.0.1";
#else /* TEST_IPV6 */ #else /* TEST_IPV6 */
@ -312,6 +262,8 @@ static INLINE int mygetopt(int argc, char** argv, const char* optstring)
* - 4996: deprecated function */ * - 4996: deprecated function */
#endif #endif
#if defined(WOLFSSH_TEST_CLIENT) || defined(WOLFSSH_TEST_SERVER)
#ifdef WOLFSSL_NUCLEUS #ifdef WOLFSSL_NUCLEUS
static INLINE void build_addr(struct addr_struct* addr, const char* peer, static INLINE void build_addr(struct addr_struct* addr, const char* peer,
word16 port) word16 port)
@ -447,7 +399,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer,
} }
#endif #endif
} }
#endif /* WOLFSSL_NUCLEUS */ #endif /* WOLFSSH_NUCLEUS */
#ifdef USE_WINDOWS_API #ifdef USE_WINDOWS_API
#pragma warning(pop) #pragma warning(pop)
@ -513,11 +465,16 @@ static INLINE void tcp_socket(SOCKET_T* sockFd)
#endif /* USE_WINDOWS_API */ #endif /* USE_WINDOWS_API */
} }
#endif /* WOLFSSH_TEST_CLIENT || WOLFSSH_TEST_SERVER */
#ifndef XNTOHS #ifndef XNTOHS
#define XNTOHS(a) ntohs((a)) #define XNTOHS(a) ntohs((a))
#endif #endif
#ifdef WOLFSSH_TEST_SERVER
static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr) static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr)
{ {
#ifdef MICROCHIP_MPLAB_HARMONY #ifdef MICROCHIP_MPLAB_HARMONY
@ -580,6 +537,8 @@ static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr)
#endif /* MICROCHIP_MPLAB_HARMONY */ #endif /* MICROCHIP_MPLAB_HARMONY */
} }
#endif /* WOLFSSH_TEST_SERVER */
/* Wolf Root Directory Helper */ /* Wolf Root Directory Helper */
/* KEIL-RL File System does not support relative directory */ /* KEIL-RL File System does not support relative directory */
#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOLFSSL_TIRTOS) \ #if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOLFSSL_TIRTOS) \
@ -617,6 +576,65 @@ static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr)
#endif /* !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOL #endif /* !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOL
FSSL_TIRTOS) */ FSSL_TIRTOS) */
typedef struct tcp_ready {
word16 ready; /* predicate */
word16 port;
char* srfName; /* server ready file name */
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_t mutex;
pthread_cond_t cond;
#endif
} tcp_ready;
typedef struct func_args {
int argc;
char** argv;
int return_code;
tcp_ready* signal;
WS_CallbackUserAuth user_auth;
} func_args;
#ifdef WOLFSSH_TEST_LOCKING
static INLINE void InitTcpReady(tcp_ready* ready)
{
ready->ready = 0;
ready->port = 0;
ready->srfName = NULL;
#ifdef SINGLE_THREADED
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_init(&ready->mutex, 0);
pthread_cond_init(&ready->cond, 0);
#endif
}
static INLINE void FreeTcpReady(tcp_ready* ready)
{
#ifdef SINGLE_THREADED
(void)ready;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_destroy(&ready->mutex);
pthread_cond_destroy(&ready->cond);
#else
(void)ready;
#endif
}
void WaitTcpReady(func_args*);
#endif /* WOLFSSH_TEST_LOCKING */
#ifdef WOLFSSH_TEST_THREADING
typedef THREAD_RETURN WOLFSSH_THREAD THREAD_FUNC(void*);
static INLINE void ThreadStart(THREAD_FUNC fun, void* args, THREAD_TYPE* thread) static INLINE void ThreadStart(THREAD_FUNC fun, void* args, THREAD_TYPE* thread)
{ {
#ifdef SINGLE_THREADED #ifdef SINGLE_THREADED
@ -690,4 +708,6 @@ static INLINE void ThreadDetach(THREAD_TYPE thread)
#endif #endif
} }
#endif /* WOLFSSH_TEST_THREADING */
#endif /* _WOLFSSH_TEST_H_ */ #endif /* _WOLFSSH_TEST_H_ */