mirror of https://github.com/wolfSSL/wolfMQTT.git
Init zephyr github action test using twister script
parent
d69c7b5a30
commit
67e7603599
|
|
@ -0,0 +1,130 @@
|
||||||
|
name: Zephyr tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ '*' ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ '*' ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run_test:
|
||||||
|
name: Build and run
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
# Don't prompt for anything
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
sudo apt-get update
|
||||||
|
# most of the ci-base zephyr docker image packages
|
||||||
|
sudo apt-get install -y mosquitto mosquitto-clients zip bridge-utils uml-utilities \
|
||||||
|
git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget \
|
||||||
|
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
|
||||||
|
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 \
|
||||||
|
autoconf automake bison build-essential ca-certificates cargo ccache chrpath cmake \
|
||||||
|
cpio device-tree-compiler dfu-util diffstat dos2unix doxygen file flex g++ gawk gcc \
|
||||||
|
gcovr git git-core gnupg gperf gtk-sharp2 help2man iproute2 lcov libcairo2-dev \
|
||||||
|
libglib2.0-dev libgtk2.0-0 liblocale-gettext-perl libncurses5-dev libpcap-dev \
|
||||||
|
libpopt0 libsdl1.2-dev libsdl2-dev libssl-dev libtool libtool-bin locales make \
|
||||||
|
net-tools ninja-build openssh-client parallel pkg-config python3-dev python3-pip \
|
||||||
|
python3-ply python3-setuptools python-is-python3 qemu rsync socat srecord sudo \
|
||||||
|
texinfo unzip wget ovmf xz-utils
|
||||||
|
|
||||||
|
- name: Install west
|
||||||
|
run: sudo pip install west
|
||||||
|
|
||||||
|
- name: Init west workspace
|
||||||
|
run: west init zephyr
|
||||||
|
|
||||||
|
- name: Update west.yml
|
||||||
|
working-directory: zephyr/zephyr
|
||||||
|
run: |
|
||||||
|
REF=$(echo '${{ github.ref }}' | sed -e 's/\//\\\//g')
|
||||||
|
sed -e 's/remotes:/remotes:\n \- name: wolfssl\n url\-base: https:\/\/github.com\/wolfssl/' -i west.yml
|
||||||
|
sed -e "s/remotes:/remotes:\n \- name: wolfmqtt\n url\-base: https:\/\/github.com\/${{ github.repository_owner }}/" -i west.yml
|
||||||
|
sed -e "s/projects:/projects:\n \- name: wolfMQTT\n path: modules\/lib\/wolfmqtt\n remote: wolfmqtt\n revision: $REF/" -i west.yml
|
||||||
|
sed -e 's/projects:/projects:\n \- name: wolfssl\n path: modules\/crypto\/wolfssl\n remote: wolfssl\n revision: master/' -i west.yml
|
||||||
|
|
||||||
|
- name: Update west workspace
|
||||||
|
working-directory: zephyr
|
||||||
|
run: west update -n -o=--depth=1
|
||||||
|
|
||||||
|
- name: Export zephyr
|
||||||
|
working-directory: zephyr
|
||||||
|
run: west zephyr-export
|
||||||
|
|
||||||
|
- name: Install pip dependencies
|
||||||
|
working-directory: zephyr
|
||||||
|
run: sudo pip install -r zephyr/scripts/requirements.txt
|
||||||
|
|
||||||
|
- name: Install zephyr SDK
|
||||||
|
run: |
|
||||||
|
wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/zephyr-sdk-0.16.1_linux-x86_64.tar.xz
|
||||||
|
tar xf zephyr-sdk-0.16.1_linux-x86_64.tar.xz
|
||||||
|
cd zephyr-sdk-0.16.1
|
||||||
|
./setup.sh -h -c
|
||||||
|
|
||||||
|
- name: Setup qemu networking
|
||||||
|
working-directory: zephyr/tools/net-tools
|
||||||
|
run: |
|
||||||
|
make
|
||||||
|
./loop-socat.sh &
|
||||||
|
sleep 1 # let the networks set everything up
|
||||||
|
sudo ./loop-slip-tap.sh -v &
|
||||||
|
sleep 1 # let the networks set everything up
|
||||||
|
|
||||||
|
- name: Setup mosquitto broker and sub
|
||||||
|
working-directory: zephyr/modules/lib/wolfmqtt
|
||||||
|
run: |
|
||||||
|
# Disable default broker daemon
|
||||||
|
sudo service mosquitto stop
|
||||||
|
mosquitto -c scripts/broker_test/mosquitto.conf &> broker.log &
|
||||||
|
sleep 1 # let the broker set everything up
|
||||||
|
mosquitto_sub -t sensors &> sub.log &
|
||||||
|
|
||||||
|
# This is some debug info useful if something goes wrong
|
||||||
|
- name: Show network status
|
||||||
|
run: |
|
||||||
|
sudo ifconfig
|
||||||
|
sudo route
|
||||||
|
sudo netstat -tulpan
|
||||||
|
|
||||||
|
- name: Run client
|
||||||
|
id: client-test
|
||||||
|
working-directory: zephyr
|
||||||
|
run: |
|
||||||
|
./zephyr/scripts/twister --testsuite-root modules/lib/wolfmqtt --test zephyr/samples/client/sample.lib.wolfmqtt_client -vvv
|
||||||
|
rm -rf zephyr/twister-out
|
||||||
|
|
||||||
|
- name: Check output
|
||||||
|
run: |
|
||||||
|
grep test zephyr/modules/lib/wolfmqtt/sub.log
|
||||||
|
> zephyr/modules/lib/wolfmqtt/sub.log # clear file
|
||||||
|
|
||||||
|
- name: Run tls client
|
||||||
|
id: client-tls-test
|
||||||
|
working-directory: zephyr
|
||||||
|
run: |
|
||||||
|
./zephyr/scripts/twister --testsuite-root modules/lib/wolfmqtt --test zephyr/samples/client_tls/sample.lib.wolfmqtt_client_tls -vvv
|
||||||
|
rm -rf zephyr/twister-out
|
||||||
|
|
||||||
|
- name: Check output
|
||||||
|
run: |
|
||||||
|
grep test zephyr/modules/lib/wolfmqtt/sub.log
|
||||||
|
> zephyr/modules/lib/wolfmqtt/sub.log # clear file
|
||||||
|
|
||||||
|
- name: Zip failure logs
|
||||||
|
if: ${{ failure() && (steps.client-test.outcome == 'failure' || steps.client-tls-test.outcome == 'failure') }}
|
||||||
|
run: |
|
||||||
|
zip -9 -r logs.zip zephyr/twister-out
|
||||||
|
zip -9 logs.zip zephyr/modules/lib/wolfmqtt/broker.log \
|
||||||
|
zephyr/modules/lib/wolfmqtt/sub.log
|
||||||
|
|
||||||
|
- name: Upload failure logs
|
||||||
|
if: ${{ failure() && (steps.client-test.outcome == 'failure' || steps.client-tls-test.outcome == 'failure') }}
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: zephyr-client-test-logs
|
||||||
|
path: logs.zip
|
||||||
|
retention-days: 5
|
||||||
|
|
@ -60,7 +60,9 @@
|
||||||
#include "wolfmqtt/vs_settings.h"
|
#include "wolfmqtt/vs_settings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFMQTT_USER_SETTINGS
|
#if defined(WOLFMQTT_ZEPHYR) && defined(CONFIG_WOLFMQTT_SETTINGS_FILE)
|
||||||
|
#include CONFIG_WOLFMQTT_SETTINGS_FILE
|
||||||
|
#elif defined(WOLFMQTT_USER_SETTINGS)
|
||||||
#include "user_settings.h"
|
#include "user_settings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,5 @@ if(CONFIG_WOLFMQTT)
|
||||||
zephyr_library_include_directories(${ZEPHYR_CURRENT_MODULE_DIR})
|
zephyr_library_include_directories(${ZEPHYR_CURRENT_MODULE_DIR})
|
||||||
FILE(GLOB wolfmqtt_sources ${ZEPHYR_CURRENT_MODULE_DIR}/src/*.c)
|
FILE(GLOB wolfmqtt_sources ${ZEPHYR_CURRENT_MODULE_DIR}/src/*.c)
|
||||||
target_sources(app PRIVATE ${wolfmqtt_sources})
|
target_sources(app PRIVATE ${wolfmqtt_sources})
|
||||||
|
add_definitions(-DWOLFMQTT_ZEPHYR)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,14 @@ int main(void)
|
||||||
/* init defaults */
|
/* init defaults */
|
||||||
mqtt_init_ctx(&mqttCtx);
|
mqtt_init_ctx(&mqttCtx);
|
||||||
|
|
||||||
|
mqttCtx.test_mode = 1;
|
||||||
|
|
||||||
rc = mqttclient_test(&mqttCtx);
|
rc = mqttclient_test(&mqttCtx);
|
||||||
|
|
||||||
mqtt_free_ctx(&mqttCtx);
|
mqtt_free_ctx(&mqttCtx);
|
||||||
|
|
||||||
|
if (rc == 0)
|
||||||
|
PRINTF("Zephyr MQTT test passed");
|
||||||
|
|
||||||
return (rc == 0) ? 0 : EXIT_FAILURE;
|
return (rc == 0) ? 0 : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@ project(mqtt_client)
|
||||||
FILE(GLOB app_sources ../../../examples/mqttclient/*.c ../../../examples/*.c ../*.c)
|
FILE(GLOB app_sources ../../../examples/mqttclient/*.c ../../../examples/*.c ../*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
target_include_directories(app PUBLIC ${ZEPHYR_WOLFMQTT_MODULE_DIR}/zephyr/client)
|
target_include_directories(app PUBLIC ${ZEPHYR_WOLFMQTT_MODULE_DIR}/zephyr/client)
|
||||||
|
add_definitions(-DWOLFMQTT_ZEPHYR)
|
||||||
add_definitions(-DWOLFMQTT_USER_SETTINGS)
|
add_definitions(-DWOLFMQTT_USER_SETTINGS)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# General config
|
# General config
|
||||||
CONFIG_MAIN_STACK_SIZE=4096
|
CONFIG_MAIN_STACK_SIZE=4096
|
||||||
CONFIG_MAIN_STACK_SIZE=32768
|
CONFIG_MAIN_STACK_SIZE=32768
|
||||||
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=16384
|
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=16384
|
||||||
|
|
||||||
# Enable the MQTT Lib
|
# Enable the MQTT Lib
|
||||||
CONFIG_WOLFMQTT=y
|
CONFIG_WOLFMQTT=y
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,14 @@ sample:
|
||||||
description: MQTT client sample application
|
description: MQTT client sample application
|
||||||
name: MQTT client
|
name: MQTT client
|
||||||
common:
|
common:
|
||||||
harness: net
|
harness: console
|
||||||
tags: net mqtt
|
harness_config:
|
||||||
|
type: one_line
|
||||||
|
regex:
|
||||||
|
- "Zephyr MQTT test passed"
|
||||||
tests:
|
tests:
|
||||||
test:
|
sample.lib.wolfmqtt_client:
|
||||||
platform_whitelist: qemu_x86
|
timeout: 10
|
||||||
|
platform_allow: qemu_x86
|
||||||
|
integration_platforms:
|
||||||
|
- qemu_x86
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef WOLFMQTT_OPTIONS_H
|
#ifndef WOLFMQTT_ZEPHYR_SAMPLE_SETTINGS_H
|
||||||
#define WOLFMQTT_OPTIONS_H
|
#define WOLFMQTT_ZEPHYR_SAMPLE_SETTINGS_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -21,5 +21,5 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* WOLFMQTT_OPTIONS_H */
|
#endif /* WOLFMQTT_ZEPHYR_SAMPLE_SETTINGS_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,6 @@ project(mqtt_client_tls)
|
||||||
FILE(GLOB app_sources ../../../examples/mqttclient/*.c ../../../examples/*.c ../*.c)
|
FILE(GLOB app_sources ../../../examples/mqttclient/*.c ../../../examples/*.c ../*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
target_include_directories(app PRIVATE ${ZEPHYR_WOLFMQTT_MODULE_DIR}/zephyr/client_tls)
|
target_include_directories(app PRIVATE ${ZEPHYR_WOLFMQTT_MODULE_DIR}/zephyr/client_tls)
|
||||||
|
add_definitions(-DWOLFMQTT_ZEPHYR)
|
||||||
add_definitions(-DWOLFSSL_USER_SETTINGS)
|
add_definitions(-DWOLFSSL_USER_SETTINGS)
|
||||||
add_definitions(-DWOLFMQTT_USER_SETTINGS)
|
add_definitions(-DWOLFMQTT_USER_SETTINGS)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,15 @@ sample:
|
||||||
description: MQTT client sample application with TLS
|
description: MQTT client sample application with TLS
|
||||||
name: MQTT TLS client
|
name: MQTT TLS client
|
||||||
common:
|
common:
|
||||||
harness: crypto
|
harness: console
|
||||||
tags: net mqtt crypto
|
harness_config:
|
||||||
|
type: one_line
|
||||||
|
regex:
|
||||||
|
- "Zephyr MQTT test passed"
|
||||||
tests:
|
tests:
|
||||||
test:
|
sample.lib.wolfmqtt_client_tls:
|
||||||
platform_whitelist: qemu_x86
|
timeout: 10
|
||||||
|
platform_allow: qemu_x86
|
||||||
|
integration_platforms:
|
||||||
|
- qemu_x86
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
#ifndef WOLFMQTT_OPTIONS_H
|
#ifndef WOLFMQTT_ZEPHYR_SAMPLE_SETTINGS_H
|
||||||
#define WOLFMQTT_OPTIONS_H
|
#define WOLFMQTT_ZEPHYR_SAMPLE_SETTINGS_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_WOLFSSL_SETTINGS_FILE
|
||||||
|
#include CONFIG_WOLFSSL_SETTINGS_FILE
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef NO_FILESYSTEM
|
#undef NO_FILESYSTEM
|
||||||
#define NO_FILESYSTEM
|
#define NO_FILESYSTEM
|
||||||
|
|
||||||
|
|
@ -348,5 +352,5 @@ const static unsigned char device_priv_key[] = {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* WOLFMQTT_OPTIONS_H */
|
#endif /* WOLFMQTT_ZEPHYR_SAMPLE_SETTINGS_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#ifndef USER_SETTINGS_H
|
|
||||||
#define USER_SETTINGS_H
|
|
||||||
|
|
||||||
#ifdef CONFIG_WOLFMQTT_SETTINGS_FILE
|
|
||||||
#include CONFIG_WOLFMQTT_SETTINGS_FILE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define WOLFMQTT_ZEPHYR
|
|
||||||
|
|
||||||
#ifdef CONFIG_WOLFSSL_SETTINGS_FILE
|
|
||||||
#include CONFIG_WOLFSSL_SETTINGS_FILE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* USER_SETTINGS_H */
|
|
||||||
Loading…
Reference in New Issue