Merge branch 'develop' into contrib/logging-custom-prefix
This commit is contained in:
commit
646b3bcbe8
@ -544,8 +544,6 @@ coap_parse_message(void *packet, uint8_t *data, uint16_t data_len)
|
|||||||
return BAD_REQUEST_4_00;
|
return BAD_REQUEST_4_00;
|
||||||
}
|
}
|
||||||
|
|
||||||
option_number += option_delta;
|
|
||||||
|
|
||||||
PRINTF("OPTION %u (delta %u, len %zu): ", option_number, option_delta,
|
PRINTF("OPTION %u (delta %u, len %zu): ", option_number, option_delta,
|
||||||
option_length);
|
option_length);
|
||||||
|
|
||||||
|
62
tests/17-tun-rpl-br/06-native-coap.sh
Executable file
62
tests/17-tun-rpl-br/06-native-coap.sh
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Contiki directory
|
||||||
|
CONTIKI=$1
|
||||||
|
# Test basename
|
||||||
|
BASENAME=06-native-coap
|
||||||
|
|
||||||
|
IPADDR=fd00::302:304:506:708
|
||||||
|
|
||||||
|
declare -i OKCOUNT=0
|
||||||
|
declare -i TESTCOUNT=0
|
||||||
|
|
||||||
|
echo "Enabling IPv6"
|
||||||
|
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
||||||
|
|
||||||
|
# Starting Contiki-NG native node
|
||||||
|
echo "Starting native CoAP server"
|
||||||
|
make -C $CONTIKI/examples/coap > make.log 2> make.err
|
||||||
|
sudo $CONTIKI/examples/coap/coap-example-server.native > node.log 2> node.err &
|
||||||
|
CPID=$!
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Send CoAP requests
|
||||||
|
echo "Sending CoAP requests"
|
||||||
|
|
||||||
|
rm -f $BASENAME.log
|
||||||
|
for TARGET in .well-known/core test/push; do
|
||||||
|
echo "Get $TARGET" | tee -a $BASENAME.log
|
||||||
|
coap get coap://[$IPADDR]/$TARGET 2>&1 | tee coap.log
|
||||||
|
cat coap.log >> $BASENAME.log
|
||||||
|
# Fetch coap status code (not $? because this is piped)
|
||||||
|
SUCCESS=`grep -c '(2.05)' coap.log`
|
||||||
|
if [ $SUCCESS == 1 ]; then
|
||||||
|
printf "> OK\n"
|
||||||
|
OKCOUNT+=1
|
||||||
|
else
|
||||||
|
printf "> FAIL\n"
|
||||||
|
fi
|
||||||
|
TESTCOUNT+=1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Closing native node"
|
||||||
|
sleep 2
|
||||||
|
pgrep hello-world | sudo xargs kill -9
|
||||||
|
|
||||||
|
if [ $TESTCOUNT -eq $OKCOUNT ] ; then
|
||||||
|
printf "%-40s TEST OK %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog;
|
||||||
|
else
|
||||||
|
echo "==== make.log ====" ; cat make.log;
|
||||||
|
echo "==== make.err ====" ; cat make.err;
|
||||||
|
echo "==== node.log ====" ; cat node.log;
|
||||||
|
echo "==== node.err ====" ; cat node.err;
|
||||||
|
echo "==== $BASENAME.log ====" ; cat $BASENAME.log;
|
||||||
|
|
||||||
|
printf "%-32s TEST FAIL %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog;
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f make.log make.err node.log node.err coap.log
|
||||||
|
|
||||||
|
# We do not want Make to stop -> Return 0
|
||||||
|
# The Makefile will check if a log contains FAIL at the end
|
||||||
|
exit 0
|
@ -77,6 +77,12 @@ RUN echo "#!/bin/bash\nant -Dbasedir=${COOJA} -f ${COOJA}/build.xml run" > ${HOM
|
|||||||
# Enable IPv6 -- must be done at runtime, not in Dockerfile
|
# Enable IPv6 -- must be done at runtime, not in Dockerfile
|
||||||
#RUN sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
#RUN sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
||||||
|
|
||||||
|
# Install coap-cli
|
||||||
|
RUN sudo apt-get install -y npm \
|
||||||
|
&& sudo apt-get clean \
|
||||||
|
&& sudo npm install coap-cli -g \
|
||||||
|
&& sudo ln -s /usr/bin/nodejs /usr/bin/node
|
||||||
|
|
||||||
# Working directory
|
# Working directory
|
||||||
WORKDIR ${CONTIKI_NG}
|
WORKDIR ${CONTIKI_NG}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user