From 27794c4b7e1d16422ad2e5652d71236ea6fe4cc1 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Thu, 30 Mar 2023 19:33:40 +0200 Subject: [PATCH 1/4] Initial async test with gh action --- .github/workflows/async.yml | 25 +++++++++++++++++++++++++ .github/workflows/main.yml | 2 ++ async-check.sh | 13 +++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/async.yml diff --git a/.github/workflows/async.yml b/.github/workflows/async.yml new file mode 100644 index 0000000000..59d5a6f63a --- /dev/null +++ b/.github/workflows/async.yml @@ -0,0 +1,25 @@ +name: Async Tests + +on: + workflow_call: + +jobs: + make_check: + strategy: + matrix: + config: [ + # Add new configs here + '--enable-asynccrypt --enable-all --enable-dtls13', + ] + name: make check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + name: Checkout wolfSSL + + - name: Test wolfSSL async + run: | + bash -e async-check.sh keep # this step already tests the basic config + ./configure ${{ matrix.config }} + make check + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7eb9b9d05b..a7944f9dcb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,8 @@ jobs: uses: ./.github/workflows/docker-OpenWrt.yml os-check: uses: ./.github/workflows/os-check.yml + async: + uses: ./.github/workflows/async.yml stunnel: uses: ./.github/workflows/stunnel.yml openvpn: diff --git a/async-check.sh b/async-check.sh index 3d70ddee81..95ad35aad3 100755 --- a/async-check.sh +++ b/async-check.sh @@ -19,7 +19,7 @@ function Usage() { printf '%s\n\n' "---------------------------------" } -ASYNC_REPO=git@github.com:wolfSSL/wolfAsyncCrypt.git +ASYNC_REPO=https://github.com/wolfSSL/wolfAsyncCrypt.git #ASYNC_REPO=../wolfAsyncCrypt # Optionally keep async files @@ -40,15 +40,25 @@ fi # link files +rm ./wolfcrypt/src/async.c ln -s -F ../../async/wolfcrypt/src/async.c ./wolfcrypt/src/async.c +rm ./wolfssl/wolfcrypt/async.h ln -s -F ../../async/wolfssl/wolfcrypt/async.h ./wolfssl/wolfcrypt/async.h +rm ./wolfcrypt/src/port/intel/quickassist.c ln -s -F ../../../../async/wolfcrypt/src/port/intel/quickassist.c ./wolfcrypt/src/port/intel/quickassist.c +rm ./wolfcrypt/src/port/intel/quickassist_mem.c ln -s -F ../../../../async/wolfcrypt/src/port/intel/quickassist_mem.c ./wolfcrypt/src/port/intel/quickassist_mem.c +rm ./wolfcrypt/src/port/intel/README.md ln -s -F ../../../../async/wolfcrypt/src/port/intel/README.md ./wolfcrypt/src/port/intel/README.md +rm ./wolfssl/wolfcrypt/port/intel/quickassist.h ln -s -F ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist.h ./wolfssl/wolfcrypt/port/intel/quickassist.h +rm ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h ln -s -F ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist_mem.h ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h +rm ./wolfcrypt/src/port/cavium/cavium_nitrox.c ln -s -F ../../../../async/wolfcrypt/src/port/cavium/cavium_nitrox.c ./wolfcrypt/src/port/cavium/cavium_nitrox.c +rm ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ln -s -F ../../../../async/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h +rm ./wolfcrypt/src/port/cavium/README.md ln -s -F ../../../../async/wolfcrypt/src/port/cavium/README.md ./wolfcrypt/src/port/cavium/README.md @@ -58,7 +68,6 @@ make check # Clean up -popd if [ "x$KEEP" == "xno" ]; then unlink ./wolfcrypt/src/async.c From 4ddc975acacf858259a30f919ae23253cd319aca Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Fri, 31 Mar 2023 11:25:46 +0200 Subject: [PATCH 2/4] Expand asyn-check script --- .github/workflows/async.yml | 2 +- async-check.sh | 150 +++++++++++++++++++++--------------- 2 files changed, 88 insertions(+), 64 deletions(-) diff --git a/.github/workflows/async.yml b/.github/workflows/async.yml index 59d5a6f63a..cb0407538e 100644 --- a/.github/workflows/async.yml +++ b/.github/workflows/async.yml @@ -19,7 +19,7 @@ jobs: - name: Test wolfSSL async run: | - bash -e async-check.sh keep # this step already tests the basic config + ./async-check.sh setup ./configure ${{ matrix.config }} make check diff --git a/async-check.sh b/async-check.sh index 95ad35aad3..91219bbeaf 100755 --- a/async-check.sh +++ b/async-check.sh @@ -5,85 +5,109 @@ # This script creates symbolic links to the required asynchronous # file for using the asynchronous simulator and make check # -# $ ./async-check [keep] +# $ ./async-check [keep|clean|setup] # # - keep: (default off) ./async and links kept around for inspection +# - clean: (default off) only cleanup existing ./async and links +# - setup: (default off) only setup ./async and links but don't run config +# or make # +ASYNC_REPO=https://github.com/wolfSSL/wolfAsyncCrypt.git + function Usage() { - printf '\n%s\n' "Usage: $0 [keep]" - printf '\n%s\n\n' "Where \"keep\" means keep (default off) async files around for inspection" - printf '%s\n' "EXAMPLE:" - printf '%s\n' "---------------------------------" - printf '%s\n' "./async-check.sh keep" - printf '%s\n\n' "---------------------------------" + printf '\n%s\n\n' "Usage: $0 [keep|clean|setup]" + printf '%s\n' "Where \"keep\" means keep (default off) async files around for inspection" + printf '%s\n' "Where \"clean\" means only clean (default off) the async files" + printf '%s\n\n' "Where \"setup\" means only setup (default off) the async files" + printf '%s\n' "EXAMPLE:" + printf '%s\n' "---------------------------------" + printf '%s\n' "./async-check.sh keep" + printf '%s\n' "./async-check.sh clean" + printf '%s\n' "./async-check.sh setup" + printf '%s\n\n' "---------------------------------" } -ASYNC_REPO=https://github.com/wolfSSL/wolfAsyncCrypt.git -#ASYNC_REPO=../wolfAsyncCrypt +function CleanUp() { + unlink ./wolfcrypt/src/async.c + unlink ./wolfssl/wolfcrypt/async.h + unlink ./wolfcrypt/src/port/intel/quickassist.c + unlink ./wolfcrypt/src/port/intel/quickassist_mem.c + unlink ./wolfcrypt/src/port/intel/README.md + unlink ./wolfssl/wolfcrypt/port/intel/quickassist.h + unlink ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h + unlink ./wolfcrypt/src/port/cavium/cavium_nitrox.c + unlink ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h + unlink ./wolfcrypt/src/port/cavium/README.md + + rm -rf ./async + + # restore original README.md files + git checkout -- wolfcrypt/src/port/cavium/README.md + git checkout -- wolfcrypt/src/port/intel/README.md +} -# Optionally keep async files -if [ "x$1" == "xkeep" ]; then KEEP="yes"; else KEEP="no"; fi +function LinkFiles() { + # link files + ln -s -f ../../async/wolfcrypt/src/async.c ./wolfcrypt/src/async.c + ln -s -f ../../async/wolfssl/wolfcrypt/async.h ./wolfssl/wolfcrypt/async.h + ln -s -f ../../../../async/wolfcrypt/src/port/intel/quickassist.c ./wolfcrypt/src/port/intel/quickassist.c + ln -s -f ../../../../async/wolfcrypt/src/port/intel/quickassist_mem.c ./wolfcrypt/src/port/intel/quickassist_mem.c + ln -s -f ../../../../async/wolfcrypt/src/port/intel/README.md ./wolfcrypt/src/port/intel/README.md + ln -s -f ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist.h ./wolfssl/wolfcrypt/port/intel/quickassist.h + ln -s -f ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist_mem.h ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h + ln -s -f ../../../../async/wolfcrypt/src/port/cavium/cavium_nitrox.c ./wolfcrypt/src/port/cavium/cavium_nitrox.c + ln -s -f ../../../../async/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h + ln -s -f ../../../../async/wolfcrypt/src/port/cavium/README.md ./wolfcrypt/src/port/cavium/README.md +} + +if [ "$#" -gt 1 ]; then + Usage + exit 1 +fi +KEEP=no +ONLY_SETUP=no + +case "x$1" in + "xkeep") + KEEP=yes + ;; + "xclean") + CleanUp + exit 0 + ;; + "xsetup") + ONLY_SETUP=yes + ;; + *) + Usage + exit 1 + ;; +esac + +# Fail on any error in script from now on +set -e if [ -d ./async ]; then - echo "\n\nUsing existing async repo\n\n" + echo "\n\nUsing existing async repo\n\n" else - # make a clone of the wolfAsyncCrypt repository - git clone --depth 1 $ASYNC_REPO async - [ $? -ne 0 ] && echo "\n\nCouldn't checkout the wolfAsyncCrypt repository\n\n" && exit 1 + # make a clone of the wolfAsyncCrypt repository + git clone --depth 1 $ASYNC_REPO async fi # setup auto-conf ./autogen.sh - - -# link files -rm ./wolfcrypt/src/async.c -ln -s -F ../../async/wolfcrypt/src/async.c ./wolfcrypt/src/async.c -rm ./wolfssl/wolfcrypt/async.h -ln -s -F ../../async/wolfssl/wolfcrypt/async.h ./wolfssl/wolfcrypt/async.h -rm ./wolfcrypt/src/port/intel/quickassist.c -ln -s -F ../../../../async/wolfcrypt/src/port/intel/quickassist.c ./wolfcrypt/src/port/intel/quickassist.c -rm ./wolfcrypt/src/port/intel/quickassist_mem.c -ln -s -F ../../../../async/wolfcrypt/src/port/intel/quickassist_mem.c ./wolfcrypt/src/port/intel/quickassist_mem.c -rm ./wolfcrypt/src/port/intel/README.md -ln -s -F ../../../../async/wolfcrypt/src/port/intel/README.md ./wolfcrypt/src/port/intel/README.md -rm ./wolfssl/wolfcrypt/port/intel/quickassist.h -ln -s -F ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist.h ./wolfssl/wolfcrypt/port/intel/quickassist.h -rm ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h -ln -s -F ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist_mem.h ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h -rm ./wolfcrypt/src/port/cavium/cavium_nitrox.c -ln -s -F ../../../../async/wolfcrypt/src/port/cavium/cavium_nitrox.c ./wolfcrypt/src/port/cavium/cavium_nitrox.c -rm ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h -ln -s -F ../../../../async/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h -rm ./wolfcrypt/src/port/cavium/README.md -ln -s -F ../../../../async/wolfcrypt/src/port/cavium/README.md ./wolfcrypt/src/port/cavium/README.md - - -./configure --enable-asynccrypt --enable-all -make check -[ $? -ne 0 ] && echo "\n\nMake check failed. Debris left for analysis." && exit 1 - - -# Clean up -if [ "x$KEEP" == "xno" ]; +LinkFiles +if [ "x$ONLY_SETUP" == "xno" ]; then - unlink ./wolfcrypt/src/async.c - unlink ./wolfssl/wolfcrypt/async.h - unlink ./wolfcrypt/src/port/intel/quickassist.c - unlink ./wolfcrypt/src/port/intel/quickassist_mem.c - unlink ./wolfcrypt/src/port/intel/README.md - unlink ./wolfssl/wolfcrypt/port/intel/quickassist.h - unlink ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h - unlink ./wolfcrypt/src/port/cavium/cavium_nitrox.c - unlink ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h - unlink ./wolfcrypt/src/port/cavium/README.md - - rm -rf ./async - - # restore original README.md files - git checkout -- wolfcrypt/src/port/cavium/README.md - git checkout -- wolfcrypt/src/port/intel/README.md + ./configure --enable-asynccrypt --enable-all + make check + # Clean up + if [ "x$KEEP" == "xno" ]; + then + CleanUp + fi fi + From f1a93f524d9b1a638f58601861a19e4317d3d53d Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Fri, 31 Mar 2023 11:51:49 +0200 Subject: [PATCH 3/4] Tabs -> spaces --- async-check.sh | 126 ++++++++++++++++++++++++------------------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/async-check.sh b/async-check.sh index 91219bbeaf..21a699476f 100755 --- a/async-check.sh +++ b/async-check.sh @@ -16,74 +16,74 @@ ASYNC_REPO=https://github.com/wolfSSL/wolfAsyncCrypt.git function Usage() { - printf '\n%s\n\n' "Usage: $0 [keep|clean|setup]" - printf '%s\n' "Where \"keep\" means keep (default off) async files around for inspection" - printf '%s\n' "Where \"clean\" means only clean (default off) the async files" - printf '%s\n\n' "Where \"setup\" means only setup (default off) the async files" - printf '%s\n' "EXAMPLE:" - printf '%s\n' "---------------------------------" - printf '%s\n' "./async-check.sh keep" - printf '%s\n' "./async-check.sh clean" - printf '%s\n' "./async-check.sh setup" - printf '%s\n\n' "---------------------------------" + printf '\n%s\n\n' "Usage: $0 [keep|clean|setup]" + printf '%s\n' "Where \"keep\" means keep (default off) async files around for inspection" + printf '%s\n' "Where \"clean\" means only clean (default off) the async files" + printf '%s\n\n' "Where \"setup\" means only setup (default off) the async files" + printf '%s\n' "EXAMPLE:" + printf '%s\n' "---------------------------------" + printf '%s\n' "./async-check.sh keep" + printf '%s\n' "./async-check.sh clean" + printf '%s\n' "./async-check.sh setup" + printf '%s\n\n' "---------------------------------" } function CleanUp() { - unlink ./wolfcrypt/src/async.c - unlink ./wolfssl/wolfcrypt/async.h - unlink ./wolfcrypt/src/port/intel/quickassist.c - unlink ./wolfcrypt/src/port/intel/quickassist_mem.c - unlink ./wolfcrypt/src/port/intel/README.md - unlink ./wolfssl/wolfcrypt/port/intel/quickassist.h - unlink ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h - unlink ./wolfcrypt/src/port/cavium/cavium_nitrox.c - unlink ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h - unlink ./wolfcrypt/src/port/cavium/README.md - - rm -rf ./async - - # restore original README.md files - git checkout -- wolfcrypt/src/port/cavium/README.md - git checkout -- wolfcrypt/src/port/intel/README.md + unlink ./wolfcrypt/src/async.c + unlink ./wolfssl/wolfcrypt/async.h + unlink ./wolfcrypt/src/port/intel/quickassist.c + unlink ./wolfcrypt/src/port/intel/quickassist_mem.c + unlink ./wolfcrypt/src/port/intel/README.md + unlink ./wolfssl/wolfcrypt/port/intel/quickassist.h + unlink ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h + unlink ./wolfcrypt/src/port/cavium/cavium_nitrox.c + unlink ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h + unlink ./wolfcrypt/src/port/cavium/README.md + + rm -rf ./async + + # restore original README.md files + git checkout -- wolfcrypt/src/port/cavium/README.md + git checkout -- wolfcrypt/src/port/intel/README.md } function LinkFiles() { - # link files - ln -s -f ../../async/wolfcrypt/src/async.c ./wolfcrypt/src/async.c - ln -s -f ../../async/wolfssl/wolfcrypt/async.h ./wolfssl/wolfcrypt/async.h - ln -s -f ../../../../async/wolfcrypt/src/port/intel/quickassist.c ./wolfcrypt/src/port/intel/quickassist.c - ln -s -f ../../../../async/wolfcrypt/src/port/intel/quickassist_mem.c ./wolfcrypt/src/port/intel/quickassist_mem.c - ln -s -f ../../../../async/wolfcrypt/src/port/intel/README.md ./wolfcrypt/src/port/intel/README.md - ln -s -f ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist.h ./wolfssl/wolfcrypt/port/intel/quickassist.h - ln -s -f ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist_mem.h ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h - ln -s -f ../../../../async/wolfcrypt/src/port/cavium/cavium_nitrox.c ./wolfcrypt/src/port/cavium/cavium_nitrox.c - ln -s -f ../../../../async/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h - ln -s -f ../../../../async/wolfcrypt/src/port/cavium/README.md ./wolfcrypt/src/port/cavium/README.md + # link files + ln -s -f ../../async/wolfcrypt/src/async.c ./wolfcrypt/src/async.c + ln -s -f ../../async/wolfssl/wolfcrypt/async.h ./wolfssl/wolfcrypt/async.h + ln -s -f ../../../../async/wolfcrypt/src/port/intel/quickassist.c ./wolfcrypt/src/port/intel/quickassist.c + ln -s -f ../../../../async/wolfcrypt/src/port/intel/quickassist_mem.c ./wolfcrypt/src/port/intel/quickassist_mem.c + ln -s -f ../../../../async/wolfcrypt/src/port/intel/README.md ./wolfcrypt/src/port/intel/README.md + ln -s -f ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist.h ./wolfssl/wolfcrypt/port/intel/quickassist.h + ln -s -f ../../../../async/wolfssl/wolfcrypt/port/intel/quickassist_mem.h ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h + ln -s -f ../../../../async/wolfcrypt/src/port/cavium/cavium_nitrox.c ./wolfcrypt/src/port/cavium/cavium_nitrox.c + ln -s -f ../../../../async/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h + ln -s -f ../../../../async/wolfcrypt/src/port/cavium/README.md ./wolfcrypt/src/port/cavium/README.md } if [ "$#" -gt 1 ]; then - Usage - exit 1 + Usage + exit 1 fi KEEP=no ONLY_SETUP=no case "x$1" in - "xkeep") - KEEP=yes - ;; - "xclean") - CleanUp - exit 0 - ;; - "xsetup") - ONLY_SETUP=yes - ;; - *) - Usage - exit 1 - ;; + "xkeep") + KEEP=yes + ;; + "xclean") + CleanUp + exit 0 + ;; + "xsetup") + ONLY_SETUP=yes + ;; + *) + Usage + exit 1 + ;; esac # Fail on any error in script from now on @@ -91,10 +91,10 @@ set -e if [ -d ./async ]; then - echo "\n\nUsing existing async repo\n\n" + echo "\n\nUsing existing async repo\n\n" else - # make a clone of the wolfAsyncCrypt repository - git clone --depth 1 $ASYNC_REPO async + # make a clone of the wolfAsyncCrypt repository + git clone --depth 1 $ASYNC_REPO async fi # setup auto-conf @@ -102,12 +102,12 @@ fi LinkFiles if [ "x$ONLY_SETUP" == "xno" ]; then - ./configure --enable-asynccrypt --enable-all - make check - # Clean up - if [ "x$KEEP" == "xno" ]; - then - CleanUp - fi + ./configure --enable-asynccrypt --enable-all + make check + # Clean up + if [ "x$KEEP" == "xno" ]; + then + CleanUp + fi fi From 8f8153220b57ba18ed18f6fbf24e5e152d90c5ed Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Fri, 31 Mar 2023 13:29:42 +0200 Subject: [PATCH 4/4] Remove trailing whitespace --- async-check.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/async-check.sh b/async-check.sh index 21a699476f..206fd4ff6b 100755 --- a/async-check.sh +++ b/async-check.sh @@ -39,9 +39,9 @@ function CleanUp() { unlink ./wolfcrypt/src/port/cavium/cavium_nitrox.c unlink ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h unlink ./wolfcrypt/src/port/cavium/README.md - + rm -rf ./async - + # restore original README.md files git checkout -- wolfcrypt/src/port/cavium/README.md git checkout -- wolfcrypt/src/port/intel/README.md