Skip to content

Commit f2809c5

Browse files
authored
Merge pull request #6586 from julek-wolfssl/zephyr-action
Add zephyr testing github action
2 parents 7213cb3 + c4cbf05 commit f2809c5

14 files changed

Lines changed: 161 additions & 32 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
uses: ./.github/workflows/hostap.yml
2929
nginx:
3030
uses: ./.github/workflows/nginx.yml
31+
zephyr:
32+
uses: ./.github/workflows/zephyr.yml
3133
# TODO: Currently this test fails. Enable it once it becomes passing.
3234
# haproxy:
3335
# uses: ./.github/workflows/haproxy.yml

.github/workflows/zephyr.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Zephyr tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
run_test:
8+
name: Build and run
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 20
11+
steps:
12+
- name: Install dependencies
13+
run: |
14+
# Don't prompt for anything
15+
export DEBIAN_FRONTEND=noninteractive
16+
sudo apt-get update
17+
# most of the ci-base zephyr docker image packages
18+
sudo apt-get install -y zip bridge-utils uml-utilities \
19+
git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget \
20+
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
21+
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 \
22+
autoconf automake bison build-essential ca-certificates cargo ccache chrpath cmake \
23+
cpio device-tree-compiler dfu-util diffstat dos2unix doxygen file flex g++ gawk gcc \
24+
gcovr git git-core gnupg gperf gtk-sharp2 help2man iproute2 lcov libcairo2-dev \
25+
libglib2.0-dev libgtk2.0-0 liblocale-gettext-perl libncurses5-dev libpcap-dev \
26+
libpopt0 libsdl1.2-dev libsdl2-dev libssl-dev libtool libtool-bin locales make \
27+
net-tools ninja-build openssh-client parallel pkg-config python3-dev python3-pip \
28+
python3-ply python3-setuptools python-is-python3 qemu rsync socat srecord sudo \
29+
texinfo unzip wget ovmf xz-utils
30+
31+
- name: Install west
32+
run: sudo pip install west
33+
34+
- name: Init west workspace
35+
run: west init zephyr
36+
37+
- name: Update west.yml
38+
working-directory: zephyr/zephyr
39+
run: |
40+
REF=$(echo '${{ github.ref }}' | sed -e 's/\//\\\//g')
41+
sed -e 's/remotes:/remotes:\n \- name: wolfssl\n url\-base: https:\/\/github.com\/${{ github.repository_owner }}/' -i west.yml
42+
sed -e "s/projects:/projects:\n \- name: wolfssl\n path: modules\/crypto\/wolfssl\n remote: wolfssl\n revision: $REF/" -i west.yml
43+
44+
- name: Update west workspace
45+
working-directory: zephyr
46+
run: west update -n -o=--depth=1
47+
48+
- name: Export zephyr
49+
working-directory: zephyr
50+
run: west zephyr-export
51+
52+
- name: Install pip dependencies
53+
working-directory: zephyr
54+
run: sudo pip install -r zephyr/scripts/requirements.txt
55+
56+
- name: Install zephyr SDK
57+
run: |
58+
wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/zephyr-sdk-0.16.1_linux-x86_64.tar.xz
59+
tar xf zephyr-sdk-0.16.1_linux-x86_64.tar.xz
60+
cd zephyr-sdk-0.16.1
61+
./setup.sh -h -c
62+
63+
- name: Run wolfssl test
64+
id: wolfssl-test
65+
working-directory: zephyr
66+
run: |
67+
./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_test/sample.crypto.wolfssl_test -vvv
68+
rm -rf zephyr/twister-out
69+
70+
- name: Run wolfssl TLS sock test
71+
id: wolfssl-tls-sock
72+
working-directory: zephyr
73+
run: |
74+
./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_tls_sock/sample.crypto.wolfssl_tls_sock -vvv
75+
rm -rf zephyr/twister-out
76+
77+
- name: Run wolfssl TLS thread test
78+
id: wolfssl-tls-thread
79+
working-directory: zephyr
80+
run: |
81+
./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_tls_thread/sample.crypto.wolfssl_tls_thread -vvv
82+
rm -rf zephyr/twister-out
83+
84+
- name: Zip failure logs
85+
if: ${{ failure() && (steps.wolfssl-test.outcome == 'failure' || steps.wolfssl-tls-sock.outcome == 'failure' || steps.wolfssl-tls-thread.outcome == 'failure') }}
86+
run: |
87+
zip -9 -r logs.zip zephyr/twister-out
88+
89+
- name: Upload failure logs
90+
if: ${{ failure() && (steps.wolfssl-test.outcome == 'failure' || steps.wolfssl-tls-sock.outcome == 'failure' || steps.wolfssl-tls-thread.outcome == 'failure') }}
91+
uses: actions/upload-artifact@v3
92+
with:
93+
name: zephyr-client-test-logs
94+
path: logs.zip
95+
retention-days: 5

wolfcrypt/benchmark/benchmark.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,6 @@
253253
#include <esp_log.h>
254254
#endif /* WOLFSSL_ESPIDF */
255255

256-
#ifdef HAVE_PTHREAD
257-
#include <pthread.h>
258-
#endif
259-
260256
#if defined(HAVE_PTHREAD) || \
261257
(!defined(NO_CRYPT_BENCHMARK) && !defined(NO_STDIO_FILESYSTEM) && \
262258
!defined(NO_ERROR_STRINGS) && !defined(NO_MAIN_DRIVER) && \

zephyr/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ then "Open Terminal".
6060

6161
## Build and Run wolfCrypt Test Application
6262

63+
If you want to run build apps without running `west zephyr-export` then it is
64+
possible by setting the `CMAKE_PREFIX_PATH` variable to the location of the
65+
zephyr sdk and building from the `zephyr` directory. For example:
66+
67+
```
68+
CMAKE_PREFIX_PATH=/path/to/zephyr-sdk-<VERSION> west build -p always -b qemu_x86 ../modules/crypto/wolfssl/zephyr/samples/wolfssl_test/
69+
```
70+
6371
build and execute `wolfssl_test`
6472

6573
```

zephyr/samples/wolfssl_benchmark/prj.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
21
# Configure stack and heap sizes
32
CONFIG_MAIN_STACK_SIZE=32768
4-
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=16384
53

64
# Pthreads
75
CONFIG_PTHREAD_IPC=y

zephyr/samples/wolfssl_benchmark/sample.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ sample:
22
description: wolfCrypt benchmark sample app
33
name: wolfCrypt benchmark
44
common:
5-
min_flash: 65
6-
min_ram: 36
75
tags: crypto wolfssl userspace random
6+
harness: console
7+
harness_config:
8+
type: one_line
9+
regex:
10+
- "Benchmark complete"
811
tests:
9-
crypto.wolfssl_benchmark:
10-
platform_allow: qemu_x86 nrf5340dk_nrf5340_cpuapp_ns nrf5340dk_nrf5340_cpuapp
12+
sample.crypto.wolfssl_benchmark:
13+
platform_allow: qemu_x86
14+
integration_platforms:
15+
- qemu_x86

zephyr/samples/wolfssl_test/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Configure stack and heap sizes
33
CONFIG_MAIN_STACK_SIZE=32768
4-
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=16384
4+
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=16384
55

66
# Pthreads
77
CONFIG_PTHREAD_IPC=y

zephyr/samples/wolfssl_test/sample.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ sample:
22
description: wolfCrypt test sample app
33
name: wolfCrypt test
44
common:
5-
min_flash: 65
6-
min_ram: 36
7-
tags: crypto wolfssl userspace random
5+
harness: console
6+
harness_config:
7+
type: one_line
8+
regex:
9+
- "Exiting main with return code: 0"
810
tests:
9-
crypto.wolfssl_test:
10-
platform_allow: qemu_x86 nrf5340dk_nrf5340_cpuapp_ns nrf5340dk_nrf5340_cpuapp
11+
sample.crypto.wolfssl_test:
12+
timeout: 120
13+
platform_allow: qemu_x86
14+
integration_platforms:
15+
- qemu_x86

zephyr/samples/wolfssl_tls_sock/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CONFIG_MAIN_STACK_SIZE=16384
33
CONFIG_ENTROPY_GENERATOR=y
44
CONFIG_INIT_STACKS=y
5-
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192
5+
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192
66

77
# General config
88
CONFIG_NEWLIB_LIBC=y
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
common:
2-
harness: crypto
3-
tags: crypto
41
sample:
52
description: wolfSSL TLS test application
63
name: wolfSSL TLS Test
4+
common:
5+
harness: console
6+
harness_config:
7+
type: multi_line
8+
regex:
9+
- "Server Return: 0"
10+
- "Client Return: 0"
711
tests:
8-
test:
9-
platform_whitelist: qemu_x86
12+
sample.crypto.wolfssl_tls_sock:
13+
timeout: 60
14+
platform_allow: qemu_x86
15+
integration_platforms:
16+
- qemu_x86

0 commit comments

Comments
 (0)