Skip to content

Commit

Permalink
Merge pull request wolfSSL#385 from embhorn/check_broker
Browse files Browse the repository at this point in the history
Add broker check to scripts
  • Loading branch information
bandi13 authored Dec 21, 2023
2 parents d5ba84d + ef9c6e3 commit 9b143c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion scripts/client.test
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ generate_port() { # function to produce a random port number
echo -e "Using port $port"
}

check_broker() {
timeout 10 sh -c 'until nc -v -z $0 $1; do sleep 1; done' localhost $port
}


# Check for application
[ ! -x ./examples/mqttclient/mqttclient ] && echo -e "\n\nMQTT Client doesn't exist" && exit 1
Expand Down Expand Up @@ -68,8 +72,9 @@ then
mosquitto $broker_args &
broker_pid=$!
echo "Broker PID is $broker_pid"
sleep 0.1

check_broker

def_args="${def_args} -h localhost"
tls_port_args="-p 18883"
port_args="-p ${port}"
Expand Down
8 changes: 6 additions & 2 deletions scripts/firmware.test
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ generate_port() { # function to produce a random port number
echo -e "Using port $port"
}

check_broker() {
timeout 10 sh -c 'until nc -v -z $0 $1; do sleep 1; done' localhost $port
}

# Check for application
[ ! -x ./examples/firmware/fwpush ] && echo -e "\n\nMQTT Example fwpush doesn't exist" && exit 1
Expand Down Expand Up @@ -80,8 +83,9 @@ then
mosquitto $broker_args &
broker_pid=$!
echo "Broker PID is $broker_pid"
sleep 0.1


check_broker

def_args="${def_args} -h localhost -p ${port}"
fi

Expand Down
7 changes: 6 additions & 1 deletion scripts/nbclient.test
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ generate_port() { # function to produce a random port number
echo -e "Using port $port"
}

check_broker() {
timeout 10 sh -c 'until nc -v -z $0 $1; do sleep 1; done' localhost $port
}

# Check for application
[ ! -x ./examples/nbclient/nbclient ] && echo -e "\n\nNon-blocking Client doesn't exist" && exit 1

Expand Down Expand Up @@ -69,8 +73,9 @@ then
mosquitto $broker_args &
broker_pid=$!
echo "Broker PID is $broker_pid"
sleep 0.1

check_broker

def_args="${def_args} -h localhost"
tls_port_args="-p 18883"
port_args="-p ${port}"
Expand Down

0 comments on commit 9b143c3

Please sign in to comment.