Merge branch 'develop' into contrib/lwm2m-queue-mode
This commit is contained in:
commit
fd4d398f95
@ -65,7 +65,7 @@ static void coap_request_callback(void *callback_data, coap_message_t *response)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
static int
|
||||
progress_request(coap_request_state_t *state) {
|
||||
coap_message_t *request = state->request;
|
||||
request->mid = coap_get_mid();
|
||||
@ -83,7 +83,9 @@ progress_request(coap_request_state_t *state) {
|
||||
|
||||
coap_send_transaction(state->transaction);
|
||||
LOG_DBG("Requested #%"PRIu32" (MID %u)\n", state->block_num, request->mid);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -134,7 +136,7 @@ coap_request_callback(void *callback_data, coap_message_t *response)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
int
|
||||
coap_send_request(coap_request_state_t *state, coap_endpoint_t *endpoint,
|
||||
coap_message_t *request,
|
||||
void (*callback)(coap_request_state_t *state))
|
||||
@ -151,7 +153,7 @@ coap_send_request(coap_request_state_t *state, coap_endpoint_t *endpoint,
|
||||
state->remote_endpoint = endpoint;
|
||||
state->callback = callback;
|
||||
|
||||
progress_request(state);
|
||||
return progress_request(state);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -65,7 +65,15 @@ struct coap_request_state {
|
||||
void (*callback)(coap_request_state_t *state);
|
||||
};
|
||||
|
||||
void coap_send_request(coap_request_state_t *state, coap_endpoint_t *endpoint,
|
||||
/**
|
||||
* \brief Send a CoAP request to a remote endpoint
|
||||
* \param state The state to handle the CoAP request
|
||||
* \param endpoint The destination endpoint
|
||||
* \param request The request to be sent
|
||||
* \param callback callback to execute when the response arrives or the timeout expires
|
||||
* \return 1 if there is a transaction available to send, 0 otherwise
|
||||
*/
|
||||
int coap_send_request(coap_request_state_t *state, coap_endpoint_t *endpoint,
|
||||
coap_message_t *request,
|
||||
void (*callback)(coap_request_state_t *state));
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
source ../utils.sh
|
||||
|
||||
# Contiki directory
|
||||
CONTIKI=$1
|
||||
@ -16,7 +17,7 @@ sleep 2
|
||||
|
||||
echo "Closing native node"
|
||||
sleep 2
|
||||
pgrep $CODE | xargs kill -9
|
||||
kill_bg $CPID
|
||||
|
||||
if grep -q "=check-me= FAILED" $CODE.log ; then
|
||||
echo "==== make.log ====" ; cat make.log;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
source ../utils.sh
|
||||
|
||||
# Contiki directory
|
||||
CONTIKI=$1
|
||||
@ -38,8 +39,8 @@ HOPS=`wc $BASENAME.scriptlog -l | cut -f 1 -d ' '`
|
||||
|
||||
echo "Closing simulation and tunslip6"
|
||||
sleep 1
|
||||
kill -9 $JPID
|
||||
kill -9 $MPID
|
||||
kill_bg $JPID
|
||||
kill_bg $MPID
|
||||
sleep 1
|
||||
rm COOJA.testlog
|
||||
rm COOJA.log
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
source ../utils.sh
|
||||
|
||||
# Contiki directory
|
||||
CONTIKI=$1
|
||||
@ -22,7 +23,7 @@ STATUS=${PIPESTATUS[0]}
|
||||
|
||||
echo "Closing native node"
|
||||
sleep 2
|
||||
pgrep hello-world | sudo xargs kill -9
|
||||
kill_bg $CPID
|
||||
|
||||
if [ $STATUS -eq 0 ] ; then
|
||||
cp $BASENAME.log $BASENAME.testlog
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
source ../utils.sh
|
||||
|
||||
# Contiki directory
|
||||
CONTIKI=$1
|
||||
@ -38,7 +39,7 @@ done
|
||||
|
||||
echo "Closing native node"
|
||||
sleep 2
|
||||
pgrep coap-example | sudo xargs kill -9
|
||||
kill_bg $CPID
|
||||
|
||||
if [ $TESTCOUNT -eq $OKCOUNT ] ; then
|
||||
printf "%-32s TEST OK %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" | tee $BASENAME.testlog;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
source ../utils.sh
|
||||
|
||||
# Contiki directory
|
||||
CONTIKI=$1
|
||||
@ -44,8 +45,8 @@ REPLIES=`grep -c 'icmp_seq=' $BASENAME.scriptlog`
|
||||
|
||||
echo "Closing simulation and tunslip6"
|
||||
sleep 1
|
||||
kill -9 $JPID
|
||||
kill -9 $MPID
|
||||
kill_bg $JPID
|
||||
kill_bg $MPID
|
||||
sleep 1
|
||||
rm COOJA.testlog
|
||||
rm COOJA.log
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
source ../utils.sh
|
||||
|
||||
# Contiki directory
|
||||
CONTIKI=$1
|
||||
@ -43,8 +44,8 @@ REPLIES=`grep -c 'icmp_seq=' $BASENAME.scriptlog`
|
||||
|
||||
echo "Closing simulation and nbr"
|
||||
sleep 1
|
||||
kill -9 $JPID
|
||||
kill -9 $MPID
|
||||
kill_bg $JPID
|
||||
kill_bg $MPID
|
||||
sleep 1
|
||||
rm COOJA.testlog
|
||||
rm COOJA.log
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
source ../utils.sh
|
||||
|
||||
# Contiki directory
|
||||
CONTIKI=$1
|
||||
@ -32,11 +33,11 @@ done
|
||||
|
||||
echo "Closing native node"
|
||||
sleep 1
|
||||
pgrep ipso | sudo xargs kill -9
|
||||
kill_bg $CPID
|
||||
|
||||
echo "Closing leshan"
|
||||
sleep 1
|
||||
pgrep java | sudo xargs kill -9
|
||||
kill_bg $LESHID
|
||||
|
||||
|
||||
if grep -q 'OK' leshan.err ; then
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
source ../utils.sh
|
||||
|
||||
# Contiki directory
|
||||
CONTIKI=$1
|
||||
@ -33,11 +34,11 @@ done
|
||||
|
||||
echo "Closing standalone example"
|
||||
sleep 1
|
||||
pgrep lwm2m-example | sudo xargs kill -9
|
||||
kill_bg $CPID
|
||||
|
||||
echo "Closing leshan"
|
||||
sleep 1
|
||||
pgrep java | sudo xargs kill -9
|
||||
kill_bg $LESHID
|
||||
|
||||
|
||||
if grep -q 'OK' leshan.err ; then
|
||||
|
20
tests/utils.sh
Executable file
20
tests/utils.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
function echo_run( )
|
||||
{
|
||||
echo $@
|
||||
$@
|
||||
}
|
||||
|
||||
function kill_bg( )
|
||||
{
|
||||
PID=$1
|
||||
CMD=$(ps -p $PID -o cmd=)
|
||||
SUDO=
|
||||
TOKILL=$PID
|
||||
if [[ ${CMD:0:5} == "sudo " ]] ; then
|
||||
SUDO="sudo "
|
||||
TOKILL=$(ps --ppid $PID -o pid=)
|
||||
fi
|
||||
echo_run ${SUDO}kill -9 $TOKILL
|
||||
}
|
Loading…
Reference in New Issue
Block a user