Fix running of basic client tests.
This commit is contained in:
parent
79028bcb14
commit
c6b94f6266
10
test/client/Makefile
Normal file
10
test/client/Makefile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.PHONY: all check test ptest clean
|
||||||
|
|
||||||
|
all :
|
||||||
|
|
||||||
|
check : test
|
||||||
|
ptest : test
|
||||||
|
test :
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
clean:
|
@ -5,12 +5,13 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
export LD_LIBRARY_PATH=../lib
|
export BASE_PATH=../../
|
||||||
|
export LD_LIBRARY_PATH=${BASE_PATH}/lib
|
||||||
export PORT=1888
|
export PORT=1888
|
||||||
export SUB_TIMEOUT=1
|
export SUB_TIMEOUT=1
|
||||||
|
|
||||||
# Start broker
|
# Start broker
|
||||||
../src/mosquitto -p ${PORT} 2>/dev/null &
|
../../src/mosquitto -p ${PORT} 2>/dev/null &
|
||||||
export MOSQ_PID=$!
|
export MOSQ_PID=$!
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
|
|
||||||
@ -19,28 +20,28 @@ trap "kill $MOSQ_PID" EXIT
|
|||||||
|
|
||||||
|
|
||||||
# Simple subscribe test - single message from $SYS
|
# Simple subscribe test - single message from $SYS
|
||||||
./mosquitto_sub -p ${PORT} -W ${SUB_TIMEOUT} -C 1 -t '$SYS/broker/uptime' >/dev/null
|
${BASE_PATH}/client/mosquitto_sub -p ${PORT} -W ${SUB_TIMEOUT} -C 1 -t '$SYS/broker/uptime' >/dev/null
|
||||||
echo "Simple subscribe ok"
|
echo "Simple subscribe ok"
|
||||||
|
|
||||||
# Simple publish/subscribe test - single message from mosquitto_pub
|
# Simple publish/subscribe test - single message from mosquitto_pub
|
||||||
./mosquitto_sub -p ${PORT} -W ${SUB_TIMEOUT} -C 1 -t 'single/test' >/dev/null &
|
${BASE_PATH}/client/mosquitto_sub -p ${PORT} -W ${SUB_TIMEOUT} -C 1 -t 'single/test' >/dev/null &
|
||||||
export SUB_PID=$!
|
export SUB_PID=$!
|
||||||
./mosquitto_pub -p ${PORT} -t 'single/test' -m 'single-test'
|
${BASE_PATH}/client/mosquitto_pub -p ${PORT} -t 'single/test' -m 'single-test'
|
||||||
kill ${SUB_PID} 2>/dev/null || true
|
kill ${SUB_PID} 2>/dev/null || true
|
||||||
echo "Simple publish/subscribe ok"
|
echo "Simple publish/subscribe ok"
|
||||||
|
|
||||||
# Publish a file and subscribe, do we get at least that many lines?
|
# Publish a file and subscribe, do we get at least that many lines?
|
||||||
export TEST_LINES=$(wc -l test.sh | cut -d' ' -f1)
|
export TEST_LINES=$(wc -l test.sh | cut -d' ' -f1)
|
||||||
./mosquitto_sub -p ${PORT} -W ${SUB_TIMEOUT} -C ${TEST_LINES} -t 'file-publish' >/dev/null &
|
${BASE_PATH}/client/mosquitto_sub -p ${PORT} -W ${SUB_TIMEOUT} -C ${TEST_LINES} -t 'file-publish' >/dev/null &
|
||||||
export SUB_PID=$!
|
export SUB_PID=$!
|
||||||
./mosquitto_pub -p ${PORT} -t 'file-publish' -f ./test.sh
|
${BASE_PATH}/client/mosquitto_pub -p ${PORT} -t 'file-publish' -f ./test.sh
|
||||||
kill ${SUB_PID} 2>/dev/null || true
|
kill ${SUB_PID} 2>/dev/null || true
|
||||||
echo "File publish ok"
|
echo "File publish ok"
|
||||||
|
|
||||||
# Publish a file from stdin and subscribe, do we get at least that many lines?
|
# Publish a file from stdin and subscribe, do we get at least that many lines?
|
||||||
export TEST_LINES=$(wc -l test.sh | cut -d' ' -f1)
|
export TEST_LINES=$(wc -l test.sh | cut -d' ' -f1)
|
||||||
./mosquitto_sub -p ${PORT} -W ${SUB_TIMEOUT} -C ${TEST_LINES} -t 'file-publish' >/dev/null &
|
${BASE_PATH}/client/mosquitto_sub -p ${PORT} -W ${SUB_TIMEOUT} -C ${TEST_LINES} -t 'file-publish' >/dev/null &
|
||||||
export SUB_PID=$!
|
export SUB_PID=$!
|
||||||
./mosquitto_pub -p ${PORT} -t 'file-publish' -l < ./test.sh
|
${BASE_PATH}/client/mosquitto_pub -p ${PORT} -t 'file-publish' -l < ./test.sh
|
||||||
kill ${SUB_PID} 2>/dev/null || true
|
kill ${SUB_PID} 2>/dev/null || true
|
||||||
echo "stdin publish ok"
|
echo "stdin publish ok"
|
||||||
|
Loading…
Reference in New Issue
Block a user