diff --git a/.github/workflows/msys2.yml b/.github/workflows/msys2.yml new file mode 100644 index 000000000..0641a3104 --- /dev/null +++ b/.github/workflows/msys2.yml @@ -0,0 +1,41 @@ +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: + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + strategy: + fail-fast: false + matrix: + include: + - { sys: ucrt64, compiler: mingw-w64-ucrt-x86_64-gcc } + - { sys: mingw64, compiler: mingw-w64-x86_64-gcc } + - { sys: msys, compiler: gcc } + steps: + - uses: actions/checkout@v3 + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.sys }} + update: true + install: git ${{matrix.compiler}} autotools base-devel autoconf netcat + - name: configure wolfSSL + run: ./autogen.sh && ./configure CFLAGS="-DUSE_CERT_BUFFERS_2048 -DUSE_CERT_BUFFERS_256 -DNO_WRITE_TEMP_FILES" + - name: build wolfSSL + run: make check + - name: Display log + if: always() + run: cat test-suite.log diff --git a/scripts/ocsp-stapling.test b/scripts/ocsp-stapling.test index 8065ac2c6..2d544da1b 100755 --- a/scripts/ocsp-stapling.test +++ b/scripts/ocsp-stapling.test @@ -448,7 +448,8 @@ generate_port() { # Generate a random port number #-------------------------------------------------------------------------# - if [[ "$OSTYPE" == "linux"* ]]; then + if [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "msys" + || "$OSTYPE" == "cygwin"* ]]; then port=$(($(od -An -N2 /dev/urandom) % (65535-49512) + 49512)) elif [[ "$OSTYPE" == "darwin"* ]]; then port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) diff --git a/scripts/ocsp-stapling2.test b/scripts/ocsp-stapling2.test index dea1af61b..c5664b37a 100755 --- a/scripts/ocsp-stapling2.test +++ b/scripts/ocsp-stapling2.test @@ -467,7 +467,8 @@ generate_port() { # Generate a random port number #-------------------------------------------------------------------------# - if [[ "$OSTYPE" == "linux"* ]]; then + if [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "msys" + || "$OSTYPE" == "cygwin" ]]; then port=$(($(od -An -N2 /dev/urandom) % (65535-49512) + 49512)) elif [[ "$OSTYPE" == "darwin"* ]]; then port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) diff --git a/tests/api.c b/tests/api.c index 6b6596bcf..5da87ffe1 100644 --- a/tests/api.c +++ b/tests/api.c @@ -8242,7 +8242,7 @@ done: if (!sharedCtx) wolfSSL_CTX_free(ctx); - if (clientfd >= 0) + if (clientfd != SOCKET_INVALID) CloseSocket(clientfd); #ifdef WOLFSSL_TIRTOS @@ -52614,7 +52614,7 @@ static int test_wolfSSL_BIO(void) ExpectIntEQ((int)BIO_set_mem_eof_return(f_bio1, -1), 0); ExpectIntEQ((int)BIO_set_mem_eof_return(NULL, -1), 0); - ExpectTrue((f1 = XFOPEN(svrCertFile, "rwb")) != XBADFILE); + ExpectTrue((f1 = XFOPEN(svrCertFile, "rb+")) != XBADFILE); ExpectIntEQ((int)BIO_set_fp(f_bio1, f1, BIO_CLOSE), WOLFSSL_SUCCESS); ExpectIntEQ(BIO_write_filename(f_bio2, testFile), WOLFSSL_SUCCESS); @@ -52638,7 +52638,7 @@ static int test_wolfSSL_BIO(void) BIO_free(f_bio2); f_bio2 = NULL; - ExpectNotNull(f_bio1 = BIO_new_file(svrCertFile, "rwb")); + ExpectNotNull(f_bio1 = BIO_new_file(svrCertFile, "rb+")); ExpectIntEQ((int)BIO_set_mem_eof_return(f_bio1, -1), 0); ExpectIntEQ(BIO_read(f_bio1, cert, sizeof(cert)), sizeof(cert)); BIO_free(f_bio1); @@ -55290,7 +55290,7 @@ static int test_wc_ERR_print_errors_fp(void) XFILE fp = XBADFILE; WOLFSSL_ERROR(WC_NO_ERR_TRACE(BAD_FUNC_ARG)); - ExpectTrue((fp = XFOPEN("./tests/test-log-dump-to-file.txt", "ar")) != + ExpectTrue((fp = XFOPEN("./tests/test-log-dump-to-file.txt", "a+")) != XBADFILE); wc_ERR_print_errors_fp(fp); #if defined(DEBUG_WOLFSSL) @@ -85971,7 +85971,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;