Improvements to the tests. MacOS local broker. Improve `WOLFMQTT_TEST_NONBLOCK`.

pull/369/head
David Garske 2023-11-21 13:50:49 -08:00
parent acead5b7f1
commit bffe15c839
9 changed files with 38 additions and 24 deletions

View File

@ -64,28 +64,28 @@ jobs:
run: make check
- name: configure without TLS
run: ./configure --enable-all --disable-tls
run: ./configure CC="gcc -fsanitize=address" --enable-all --disable-tls CFLAGS="-DWOLFMQTT_TEST_NONBLOCK"
- name: make
run: make
- name: make check
run: make check
- name: configure with SN Enabled
run: ./configure --enable-sn CC="gcc -fsanitize=address"
run: ./configure CC="gcc -fsanitize=address" --enable-sn
- name: make
run: make
- name: make check
run: make check
- name: configure with Non-Block
run: ./configure --enable-nonblock CFLAGS="-DWOLFMQTT_TEST_NONBLOCK" CC="gcc -fsanitize=address"
run: ./configure CC="gcc -fsanitize=address" --enable-nonblock CFLAGS="-DWOLFMQTT_TEST_NONBLOCK"
- name: make
run: make
- name: make check
run: make check
- name: configure with Non-Block and Multi-threading
run: ./configure --enable-mt --enable-nonblock CFLAGS="-DWOLFMQTT_TEST_NONBLOCK" CC="gcc -fsanitize=address"
run: ./configure CC="gcc -fsanitize=address" --enable-mt --enable-nonblock CFLAGS="-DWOLFMQTT_TEST_NONBLOCK"
- name: make
run: make
- name: make check

View File

@ -6,6 +6,9 @@ on:
pull_request:
branches: [ '*' ]
env:
WOLFMQTT_NO_EXTERNAL_BROKER_TESTS: 1
jobs:
build:
@ -17,7 +20,10 @@ jobs:
repository: wolfssl/wolfssl
path: wolfssl
- name: brew
run: brew install automake libtool md5sha1sum
run: |
brew install automake libtool md5sha1sum mosquitto
echo "/usr/local/sbin/" >> $GITHUB_PATH
echo "/usr/local/opt/mosquitto/sbin/" >> $GITHUB_PATH
- name: wolfssl autogen
working-directory: ./wolfssl
@ -44,17 +50,13 @@ jobs:
run: make check
- name: configure without TLS
env:
WOLFMQTT_NO_EXTERNAL_BROKER_TESTS: 1
run: ./configure --enable-all --disable-tls
run: ./configure --enable-all --disable-tls CFLAGS="-DWOLFMQTT_TEST_NONBLOCK"
- name: make
run: make
- name: make check
run: make check
- name: configure with SN Enabled
env:
WOLFMQTT_NO_EXTERNAL_BROKER_TESTS: 1
run: ./configure --enable-sn
- name: make
run: make
@ -62,8 +64,6 @@ jobs:
run: make check
- name: configure with Non-Block
env:
WOLFMQTT_NO_EXTERNAL_BROKER_TESTS: 1
run: ./configure --enable-nonblock CFLAGS="-DWOLFMQTT_TEST_NONBLOCK"
- name: make
run: make
@ -71,8 +71,6 @@ jobs:
run: make check
- name: configure with Non-Block and Multi-threading
env:
WOLFMQTT_NO_EXTERNAL_BROKER_TESTS: 1
run: ./configure --enable-mt --enable-nonblock CFLAGS="-DWOLFMQTT_TEST_NONBLOCK"
- name: make
run: make

View File

@ -66,7 +66,7 @@ jobs:
- name: wolfmqtt configure without TLS
env:
WOLFMQTT_NO_EXTERNAL_BROKER_TESTS: 1
run: ./configure --enable-all --disable-tls
run: ./configure --enable-all --disable-tls CFLAGS="-DWOLFMQTT_TEST_NONBLOCK"
- name: wolfmqtt make
run: make
- name: wolfmqtt make check

View File

@ -54,6 +54,8 @@ then
ecc_mutual_auth_args="-c certs/client-ecc-cert.pem -K certs/ecc-client-key.pem"
fi
echo -e "Base args: $def_args $port_args"
# Run without TLS and QoS 0-2
./examples/mqttclient/mqttclient $def_args $port_args -q 0 $1
RESULT=$?

View File

@ -66,6 +66,8 @@ fi
grep -F -e 'ENABLE_MQTT_TLS' ./wolfmqtt/options.h
ENABLE_MQTT_TLS=$?
echo -e "Base args: $def_args"
# Start firmware client
./examples/firmware/fwclient $def_args -f $fileout $1 &
client_result=$?

View File

@ -52,6 +52,7 @@ then
port_args="-p 11883"
fi
echo -e "Base args: $def_args $port_args"
# Run without TLS and QoS 0-2
./examples/multithread/multithread $def_args $port_args -q 0 $1

View File

@ -54,6 +54,8 @@ then
port_args="-p 11883"
fi
echo -e "Base args: $def_args $port_args"
# Run without TLS and QoS 0-2
./examples/nbclient/nbclient $def_args $port_args -q 0 $1
RESULT=$?

View File

@ -7,14 +7,25 @@
# Check for application
[ ! -x ./examples/wiot/wiot ] && echo -e "\n\nWatson IoT MQTT Client doesn't exist" && exit 1
# Check for TLS support
has_tls=no
./examples/azure/azureiothub -? 2>&1 | grep -- 'Enable TLS'
if [ $? -eq 0 ]; then
has_tls=yes
fi
def_args="-T -C 2000"
# Run
if test -n "$WOLFMQTT_NO_EXTERNAL_BROKER_TESTS" && test $has_tls == yes; then
echo "WOLFMQTT_NO_EXTERNAL_BROKER_TESTS set or no TLS, won't run"
else
# Run
./examples/wiot/wiot $def_args $1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nWatson IoT MQTT Client failed! TLS=On, QoS=0" && exit 1
./examples/wiot/wiot $def_args $1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nWatson IoT MQTT Client failed! TLS=On, QoS=0" && exit 1
echo -e "\n\nWatson IoT MQTT Client Tests Passed"
echo -e "\n\nWatson IoT MQTT Client Tests Passed"
fi
exit 0

View File

@ -173,9 +173,8 @@ static int MqttSocket_WriteDo(MqttClient *client, const byte* buf, int buf_len,
#if defined(WOLFMQTT_NONBLOCK) && defined(WOLFMQTT_TEST_NONBLOCK)
static int testSmallerWrite = 0;
if (!testSmallerWrite) {
if (buf_len > 100) {
if (buf_len > 1)
buf_len /= 2;
}
testSmallerWrite = 1;
}
else {
@ -300,9 +299,8 @@ static int MqttSocket_ReadDo(MqttClient *client, byte* buf, int buf_len,
#if defined(WOLFMQTT_NONBLOCK) && defined(WOLFMQTT_TEST_NONBLOCK)
static int testSmallerRead = 0;
if (!testSmallerRead) {
if (buf_len > 100) {
if (buf_len > 1)
buf_len /= 2;
}
testSmallerRead = 1;
}
else {