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

Add MSYS2 build CI test #6932

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/msys2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: MSYS2 Build Test

# START OF COMMON SECTION
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# END OF COMMON SECTION

jobs:
msys2-ucrt64:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
path: wolfssl
msystem: UCRT64
update: true
install: git mingw-w64-ucrt-x86_64-gcc autotools base-devel autoconf
- name: configure wolfSSL
run: ./autogen.sh && ./configure --enable-all --disable-crl-monitor
- name: build wolfSSL
run: make check
- name: Display log
if: always()
run: cat test-suite.log
4 changes: 2 additions & 2 deletions examples/benchmark/tls_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ static int SetupSocketAndConnect(info_t* info, const char* host,
/* Setup server address */
XMEMSET(&servAddr, 0, sizeof(servAddr));
servAddr.sin_family = AF_INET;
servAddr.sin_port = htons((u_int16_t)port);
servAddr.sin_port = htons((word16)port);

/* Resolve host */
entry = gethostbyname(host);
Expand Down Expand Up @@ -1224,7 +1224,7 @@ static int SetupSocketAndListen(int* listenFd, word32 port, int doDTLS)
/* Setup server address */
XMEMSET(&servAddr, 0, sizeof(servAddr));
servAddr.sin_family = AF_INET;
servAddr.sin_port = htons((u_int16_t)port);
servAddr.sin_port = htons((word16)port);
servAddr.sin_addr.s_addr = INADDR_ANY;

#ifdef WOLFSSL_DTLS
Expand Down
31 changes: 20 additions & 11 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,12 @@ static int testDevId = INVALID_DEVID;
#define HAVE_SSL_MEMIO_TESTS_DEPENDENCIES
#endif

#ifdef USE_WINDOWS_API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems unnecessary. Either case should be happy with (char*)

#define MESSAGE_TYPE_CAST char*
#else
#define MESSAGE_TYPE_CAST void*
#endif

/*----------------------------------------------------------------------------*
| BIO with fixed read/write size
*----------------------------------------------------------------------------*/
Expand Down Expand Up @@ -7457,7 +7463,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args)
static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
{
SOCKET_T sockfd;
SOCKET_T clientfd = -1;
SOCKET_T clientfd;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we use SOCKET_INVALID.

word16 port;

callback_functions* cbf;
Expand All @@ -7472,6 +7478,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
func_args* opts = (func_args*)args;
int loop_count = opts->argc;
int count = 0;
int freeClientfd = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be required.


#ifdef WOLFSSL_TIRTOS
fdOpenSession(Task_self());
Expand Down Expand Up @@ -7579,6 +7586,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
/* do it here to detect failure */
tcp_accept(&sockfd, &clientfd, (func_args*)args, port, 0, 0, 0, 0, 1, 0,
0);
freeClientfd = 1;
CloseSocket(sockfd);
if (wolfSSL_set_fd(ssl, clientfd) != WOLFSSL_SUCCESS) {
/*err_sys("SSL_set_fd failed");*/
Expand Down Expand Up @@ -7620,7 +7628,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
wolfSSL_shutdown(ssl);
wolfSSL_free(ssl); ssl = NULL;
CloseSocket(clientfd);
clientfd = -1;
freeClientfd = 0;

count++;
}
Expand All @@ -7638,7 +7646,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
if (!sharedCtx)
wolfSSL_CTX_free(ctx);

if (clientfd >= 0)
if (freeClientfd)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clientFd != SOCKET_INVALID

CloseSocket(clientfd);

#ifdef WOLFSSL_TIRTOS
Expand Down Expand Up @@ -63335,10 +63343,10 @@ static void test_wolfSSL_dtls_plaintext_client(WOLFSSL* ssl)

generateDTLSMsg(ch, sizeof(ch), 20, client_hello, 0);
/* Server should ignore this datagram */
AssertIntEQ(send(fd, ch, sizeof(ch), 0), sizeof(ch));
AssertIntEQ(send(fd, (MESSAGE_TYPE_CAST)ch, sizeof(ch), 0), sizeof(ch));
generateDTLSMsg(ch, sizeof(ch), 20, client_hello, 10000);
/* Server should ignore this datagram */
AssertIntEQ(send(fd, ch, sizeof(ch), 0), sizeof(ch));
AssertIntEQ(send(fd, (MESSAGE_TYPE_CAST)ch, sizeof(ch), 0), sizeof(ch));

AssertIntEQ(wolfSSL_write(ssl, msg, sizeof(msg)), sizeof(msg));
AssertIntGT(wolfSSL_read(ssl, reply, sizeof(reply)),0);
Expand Down Expand Up @@ -63448,7 +63456,7 @@ static void test_wolfSSL_dtls12_fragments_spammer(WOLFSSL* ssl)
delay.tv_nsec = 10000000; /* wait 0.01 seconds */
c32toa(seq_number, b + seq_offset);
c16toa(msg_number, b + msg_offset);
ret = (int)send(fd, b, 55, 0);
ret = (int)send(fd, (MESSAGE_TYPE_CAST)b, 55, 0);
nanosleep(&delay, NULL);
}
}
Expand Down Expand Up @@ -63566,7 +63574,7 @@ static void test_wolfSSL_dtls_send_alert(WOLFSSL* ssl)
};

fd = wolfSSL_get_fd(ssl);
ret = (int)send(fd, alert_msg, sizeof(alert_msg), 0);
ret = (int)send(fd, (MESSAGE_TYPE_CAST)alert_msg, sizeof(alert_msg), 0);
AssertIntGT(ret, 0);
}

Expand Down Expand Up @@ -63637,7 +63645,7 @@ static void test_wolfSSL_send_bad_record(WOLFSSL* ssl)

fd = wolfSSL_get_fd(ssl);
AssertIntGE(fd, 0);
ret = (int)send(fd, bad_msg, sizeof(bad_msg), 0);
ret = (int)send(fd, (MESSAGE_TYPE_CAST)bad_msg, sizeof(bad_msg), 0);
AssertIntEQ(ret, sizeof(bad_msg));
ret = wolfSSL_write(ssl, "badrecordtest", sizeof("badrecordtest"));
AssertIntEQ(ret, sizeof("badrecordtest"));
Expand Down Expand Up @@ -63959,10 +63967,10 @@ static void test_wolfSSL_dtls_send_ch(WOLFSSL* ssl)
};

fd = wolfSSL_get_fd(ssl);
ret = (int)send(fd, ch_msg, sizeof(ch_msg), 0);
ret = (int)send(fd, (MESSAGE_TYPE_CAST)ch_msg, sizeof(ch_msg), 0);
AssertIntGT(ret, 0);
/* consume the HRR otherwise handshake will fail */
ret = (int)recv(fd, ch_msg, sizeof(ch_msg), 0);
ret = (int)recv(fd, (MESSAGE_TYPE_CAST)ch_msg, sizeof(ch_msg), 0);
AssertIntGT(ret, 0);
}

Expand Down Expand Up @@ -69529,7 +69537,8 @@ static int test_dtls_msg_from_other_peer(void)
* !defined(SINGLE_THREADED) && !defined(NO_RSA) */
#if defined(WOLFSSL_DTLS) && !defined(WOLFSSL_IPV6) && \
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) && \
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(WOLFSSL_NO_TLS12)
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(WOLFSSL_NO_TLS12) \
&& !defined(USE_WINDOWS_API)
static int test_dtls_ipv6_check(void)
{
EXPECT_DECLS;
Expand Down
Loading