From c0783e284155821fd18dd23aa17c1a6053be2b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20=27Morty=27=20Str=C3=BCbe?= Date: Mon, 14 Apr 2014 15:48:03 +0200 Subject: [PATCH 1/3] sky: Initialize energest as early as possible If energest is initialized too late, the radio is not accounted until the first switch. This is a problem when the radio is always listening. --- platform/sky/contiki-sky-main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/sky/contiki-sky-main.c b/platform/sky/contiki-sky-main.c index 639d0d108..d589ca037 100644 --- a/platform/sky/contiki-sky-main.c +++ b/platform/sky/contiki-sky-main.c @@ -283,6 +283,10 @@ main(int argc, char **argv) * Hardware initialization done! */ + /* Initialize energest first (but after rtimer) + */ + energest_init(); + ENERGEST_ON(ENERGEST_TYPE_CPU); #if WITH_TINYOS_AUTO_IDS node_id = TOS_NODE_ID; @@ -418,9 +422,6 @@ main(int argc, char **argv) } #endif /* WITH_UIP */ - energest_init(); - ENERGEST_ON(ENERGEST_TYPE_CPU); - watchdog_start(); NETSTACK_LLSEC.bootstrap(start_network_layer); From 74b741bad20397c2bcbe59abe9ba96f956cc9b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20=27Morty=27=20Str=C3=BCbe?= Date: Wed, 8 Oct 2014 09:22:37 +0200 Subject: [PATCH 2/3] Support running multiple random seeds in case one fails --- regression-tests/Makefile.simulation-test | 6 +- regression-tests/simexec.sh | 114 ++++++++++++---------- 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/regression-tests/Makefile.simulation-test b/regression-tests/Makefile.simulation-test index 5c8b99e40..bc14c8b24 100644 --- a/regression-tests/Makefile.simulation-test +++ b/regression-tests/Makefile.simulation-test @@ -30,8 +30,8 @@ TESTS=$(wildcard ??-*.csc) TESTLOGS=$(patsubst %.csc,%.testlog,$(TESTS)) LOGS=$(patsubst %.csc,%.log,$(TESTS)) FAILLOGS=$(patsubst %.csc,%.faillog,$(TESTS)) -#Set random seed to create reproduceable results. -RANDOMSEED=1 +#Set random seeds to create reproduceable results. +RANDOMSEED=1 5 CONTIKI=../.. @@ -57,7 +57,7 @@ RUNALL=false endif %.testlog: %.csc cooja - @$(CONTIKI)/regression-tests/simexec.sh "$(RUNALL)" "$<" "$(CONTIKI)" "$(basename $@)" "$(RANDOMSEED)" + @$(CONTIKI)/regression-tests/simexec.sh "$(RUNALL)" "$<" "$(CONTIKI)" "$(basename $@)" $(RANDOMSEED) clean: @rm -f $(TESTLOGS) $(LOGS) $(FAILLOGS) COOJA.log COOJA.testlog \ diff --git a/regression-tests/simexec.sh b/regression-tests/simexec.sh index 1d1e46b7f..cb6d5e5b0 100755 --- a/regression-tests/simexec.sh +++ b/regression-tests/simexec.sh @@ -1,66 +1,82 @@ #!/bin/bash +# Do not return an error RUNALL=$1 -CSC=$2 -CONTIKI=$3 -BASENAME=$4 -RANDOMSEED=$5 +shift +# The simulation to run +CSC=$1 +shift +#Contiki directory +CONTIKI=$1 +shift +#The basename of the experiment +BASENAME=$1 +shift +# The test will end on the first successfull run #set -x -echo -n "Running test $BASENAME " +while (( "$#" )); do + RANDOMSEED=$1 + echo -n "Running test $BASENAME with random Seed $RANDOMSEED: " -java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$CSC -contiki=$CONTIKI -random-seed=$RANDOMSEED > $BASENAME.log & -JPID=$! + java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$CSC -contiki=$CONTIKI -random-seed=$RANDOMSEED > $BASENAME.log & + JPID=$! -# Copy the log and only print "." if it changed -touch $BASENAME.log.prog -while kill -0 $JPID 2> /dev/null -do - sleep 1 - diff $BASENAME.log $BASENAME.log.prog > /dev/null - if [ $? -ne 0 ] - then - echo -n "." - cp $BASENAME.log $BASENAME.log.prog - fi + # Copy the log and only print "." if it changed + touch $BASENAME.log.prog + while kill -0 $JPID 2> /dev/null + do + sleep 1 + diff $BASENAME.log $BASENAME.log.prog > /dev/null + if [ $? -ne 0 ] + then + echo -n "." + cp $BASENAME.log $BASENAME.log.prog + fi + done + rm $BASENAME.log.prog + + + wait $JPID + JRV=$? + + if [ $JRV -eq 0 ] ; then + touch COOJA.testlog; + mv COOJA.testlog $BASENAME.testlog + echo " OK" + exit 0 + fi + + + + # In case of failure + + + + #Verbose output when using CI + if [ "$CI" = "true" ]; then + echo "==== COOJA.log ====" ; cat COOJA.log; + echo "==== COOJA.testlog ====" ; cat COOJA.testlog; + else + tail -50 COOJA.log ; + fi; + + mv COOJA.testlog $BASENAME.$RANDOMSEED.faillog + + shift done -rm $BASENAME.log.prog - -wait $JPID -JRV=$? - -if [ $JRV -eq 0 ] ; then - touch COOJA.testlog; - mv COOJA.testlog $BASENAME.testlog - echo " OK" - exit 0 -fi - - - -# In case of failure - -echo " FAIL ಠ_ಠ" | tee -a COOJA.testlog; - -#Verbose output when using CI -if [ "$CI" = "true" ]; then - echo "==== COOJA.log ====" ; cat COOJA.log; - echo "==== COOJA.testlog ====" ; cat COOJA.testlog; -else - tail -50 COOJA.log ; -fi; - -mv COOJA.testlog $BASENAME.faillog +#All seeds failed + echo " FAIL ಠ_ಠ" | tee -a $BASENAME.$RANDOMSEED.faillog; # We do not want Make to stop -> Return 0 if [ "$RUNALL" = "true" ] ; then - touch COOJA.testlog; - mv COOJA.testlog $BASENAME.testlog; - exit 0 + touch COOJA.testlog; + mv COOJA.testlog $BASENAME.testlog; + exit 0 fi -#This is a failure + exit 1 From 9236b68779a55cc472c955dc1706fa54e433bf73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20=27Morty=27=20Str=C3=BCbe?= Date: Wed, 8 Oct 2014 10:59:59 +0200 Subject: [PATCH 3/3] Only fail on real fails --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 695a6fe54..a06b17454 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,7 +78,7 @@ after_script: - "[ ${BUILD_CATEGORY:-sim} = sim ] && tail regression-tests/??-$BUILD_TYPE/*.testlog" ## Print a basic summary - "echo 'Summary:'; cat regression-tests/??-$BUILD_TYPE/summary" - - "FAILS=`grep -c -i 'fail' regression-tests/??-$BUILD_TYPE/summary`" + - "FAILS=`grep -c ' FAIL ' regression-tests/??-$BUILD_TYPE/summary`" ## This will detect whether the build should pass or fail - "test $FAILS -eq 0; exit $?"