Skip to content

Commit

Permalink
tests/coap-lwm2m: enable full parallelism
Browse files Browse the repository at this point in the history
Use Makefile.compile-tests to compile and run
the tests.

This will automatically clean each test, and
select the right number of cores for make -j.
  • Loading branch information
pjonsson committed Sep 23, 2023
1 parent be094ba commit dca56fa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 29 deletions.
6 changes: 1 addition & 5 deletions tests/18-coap-lwm2m/06-lwm2m-ipso-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
source ../utils.sh

# Contiki directory
CONTIKI=$1
CONTIKI=../..
# Test basename
BASENAME=06-lwm2m-ipso-test

IPADDR=fd00::302:304:506:708

# Starting Contiki-NG native node
echo "Starting native node - lwm2m/ipso objects"
make -C $CONTIKI/examples/lwm2m-ipso-objects clean || exit 1
make -j4 -C $CONTIKI/examples/lwm2m-ipso-objects || exit 1
sudo $CONTIKI/examples/lwm2m-ipso-objects/example-ipso-objects.native &
CPID=$!

Expand Down Expand Up @@ -43,8 +41,6 @@ kill_bg $LESHID
if ! grep -q 'OK' leshan.err ; then
echo "==== leshan.log ====" ; cat leshan.log;
echo "==== leshan.err ====" ; cat leshan.err;
echo "==== $BASENAME.log ====" ; cat $BASENAME.log;

printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog;
rm -f leshan.log leshan.err
exit 1
Expand Down
9 changes: 0 additions & 9 deletions tests/18-coap-lwm2m/07-lwm2m-standalone-test.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#!/bin/bash
source ../utils.sh

# Contiki directory
CONTIKI=$1
# Test basename
BASENAME=07-lwm2m-standalone-test

# Building standalone posix example
echo "Compiling standalone posix example"
make CONTIKI_NG=$CONTIKI -C example-lwm2m-standalone/lwm2m clean || exit 1
make -j4 CONTIKI_NG=$CONTIKI -C example-lwm2m-standalone/lwm2m || exit 1

echo "Downloading leshan"
LESHAN_JAR=leshan-server-demo-1.0.0-SNAPSHOT-jar-with-dependencies.jar
wget -nv -nc https://joakimeriksson.github.io/resources/$LESHAN_JAR
Expand Down Expand Up @@ -44,8 +37,6 @@ kill_bg $LESHID
if ! grep -q 'OK' leshan.err ; then
echo "==== leshan.log ====" ; cat leshan.log;
echo "==== leshan.err ====" ; cat leshan.err;
echo "==== $BASENAME.log ====" ; cat $BASENAME.log;

printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog;
rm -f leshan.log leshan.err
exit 1
Expand Down
6 changes: 1 addition & 5 deletions tests/18-coap-lwm2m/08-lwm2m-qmode-ipso-test.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/bin/bash

# Contiki directory
CONTIKI=$1
CONTIKI=../..
# Test basename
BASENAME=08-lwm2m-qmode-ipso-test

IPADDR=fd00::302:304:506:708

# Starting Contiki-NG native node
echo "Starting native node - lwm2m/ipso objects with Q-Mode"
make -C $CONTIKI/examples/lwm2m-ipso-objects clean || exit 1
make -j4 -C $CONTIKI/examples/lwm2m-ipso-objects DEFINES=LWM2M_QUEUE_MODE_CONF_ENABLED=1,LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION=1,LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED=1 || exit 1
sudo $CONTIKI/examples/lwm2m-ipso-objects/example-ipso-objects.native &
CPID=$!

Expand Down Expand Up @@ -48,8 +46,6 @@ then
else
echo "==== leshan.log ====" ; cat leshan.log;
echo "==== leshan.err ====" ; cat leshan.err;
echo "==== $BASENAME.log ====" ; cat $BASENAME.log;

printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog;
rm -f leshan.log leshan.err
exit 1
Expand Down
9 changes: 0 additions & 9 deletions tests/18-coap-lwm2m/09-lwm2m-qmode-standalone-test.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
#!/bin/bash

# Contiki directory
CONTIKI=$1
# Test basename
BASENAME=09-lwm2m-qmode-standalone-test

# Building standalone posix example
echo "Compiling standalone posix example"
make CONTIKI_NG=$CONTIKI -C example-lwm2m-standalone/lwm2m clean || exit 1
make -j4 CONTIKI_NG=$CONTIKI -C example-lwm2m-standalone/lwm2m DEFINES=LWM2M_QUEUE_MODE_CONF_ENABLED=1,LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION=1,LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED=1 || exit 1

echo "Downloading leshan with Q-Mode support"
LESHAN_JAR=leshan-server-demo-qmode-support1.0.0-SNAPSHOT-jar-with-dependencies.jar
wget -nv -nc https://carlosgp143.github.io/resources/$LESHAN_JAR
Expand Down Expand Up @@ -47,8 +40,6 @@ then
else
echo "==== leshan.log ====" ; cat leshan.log;
echo "==== leshan.err ====" ; cat leshan.err;
echo "==== $BASENAME.log ====" ; cat $BASENAME.log;

printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog;
rm -f leshan.log leshan.err
exit 1
Expand Down
12 changes: 11 additions & 1 deletion tests/18-coap-lwm2m/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
include ../Makefile.script-test
RUN_FILE = 1

EXAMPLESDIR := $(abspath ../..)

EXAMPLES = \
examples/lwm2m-ipso-objects/native:./06-lwm2m-ipso-test.sh \
tests/18-coap-lwm2m/example-lwm2m-standalone/lwm2m/native:./07-lwm2m-standalone-test.sh:CONTIKI_NG=$(EXAMPLESDIR) \
examples/lwm2m-ipso-objects/native:./08-lwm2m-qmode-ipso-test.sh:DEFINES=LWM2M_QUEUE_MODE_CONF_ENABLED=1,LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION=1,LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED=1 \
tests/18-coap-lwm2m/example-lwm2m-standalone/lwm2m/native:./09-lwm2m-qmode-standalone-test.sh:CONTIKI_NG=$(EXAMPLESDIR):DEFINES=LWM2M_QUEUE_MODE_CONF_ENABLED=1,LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION=1,LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED=1

include ../Makefile.compile-test

0 comments on commit dca56fa

Please sign in to comment.