Add a regression test for the stack check library
This commit is contained in:
parent
f9516eae73
commit
7233dfbbdd
81
tests/07-simulation-base/22-stack-guard-sky.csc
Normal file
81
tests/07-simulation-base/22-stack-guard-sky.csc
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<simconf>
|
||||||
|
<simulation>
|
||||||
|
<title>Stack guard test (Sky)</title>
|
||||||
|
<randomseed>123456</randomseed>
|
||||||
|
<motedelay_us>1000000</motedelay_us>
|
||||||
|
<radiomedium>
|
||||||
|
org.contikios.cooja.radiomediums.UDGM
|
||||||
|
<transmitting_range>50.0</transmitting_range>
|
||||||
|
<interference_range>100.0</interference_range>
|
||||||
|
<success_ratio_tx>1.0</success_ratio_tx>
|
||||||
|
<success_ratio_rx>1.0</success_ratio_rx>
|
||||||
|
</radiomedium>
|
||||||
|
<events>
|
||||||
|
<logoutput>40000</logoutput>
|
||||||
|
</events>
|
||||||
|
<motetype>
|
||||||
|
org.contikios.cooja.mspmote.SkyMoteType
|
||||||
|
<identifier>sky1</identifier>
|
||||||
|
<description>Sky Mote Type #1</description>
|
||||||
|
<source EXPORT="discard">[CONTIKI_DIR]/examples/libs/stack-check/example-stack-check.c</source>
|
||||||
|
<commands EXPORT="discard">make -j example-stack-check.sky TARGET=sky</commands>
|
||||||
|
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/libs/stack-check/example-stack-check.sky</firmware>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspClock</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspMoteID</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.mspmote.interfaces.SkyButton</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.mspmote.interfaces.SkyFlash</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.mspmote.interfaces.Msp802154Radio</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspSerial</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.mspmote.interfaces.SkyLED</moteinterface>
|
||||||
|
</motetype>
|
||||||
|
<mote>
|
||||||
|
<breakpoints />
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>64.11203103628397</x>
|
||||||
|
<y>93.06735634828134</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||||
|
<id>1</id>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>sky1</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
</simulation>
|
||||||
|
<plugin>
|
||||||
|
org.contikios.cooja.plugins.ScriptRunner
|
||||||
|
<plugin_config>
|
||||||
|
<scriptfile>[CONFIG_DIR]/js/22-stack-check.js</scriptfile>
|
||||||
|
<active>true</active>
|
||||||
|
</plugin_config>
|
||||||
|
<width>541</width>
|
||||||
|
<z>0</z>
|
||||||
|
<height>448</height>
|
||||||
|
<location_x>299</location_x>
|
||||||
|
<location_y>7</location_y>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
org.contikios.cooja.plugins.SimControl
|
||||||
|
<width>280</width>
|
||||||
|
<z>2</z>
|
||||||
|
<height>160</height>
|
||||||
|
<location_x>7</location_x>
|
||||||
|
<location_y>10</location_y>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
org.contikios.cooja.plugins.LogListener
|
||||||
|
<plugin_config>
|
||||||
|
<filter />
|
||||||
|
</plugin_config>
|
||||||
|
<width>680</width>
|
||||||
|
<z>1</z>
|
||||||
|
<height>240</height>
|
||||||
|
<location_x>51</location_x>
|
||||||
|
<location_y>288</location_y>
|
||||||
|
</plugin>
|
||||||
|
</simconf>
|
25
tests/07-simulation-base/js/22-stack-check.js
Normal file
25
tests/07-simulation-base/js/22-stack-check.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
TIMEOUT(100000);
|
||||||
|
|
||||||
|
/* This script checks that the stack usage is dynamically changing */
|
||||||
|
|
||||||
|
var re = /stack usage: (\d+)/i;
|
||||||
|
|
||||||
|
var minusage = 10000;
|
||||||
|
var maxusage = 0;
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
log.log("> " + msg + "\n");
|
||||||
|
|
||||||
|
var found = msg.match(re);
|
||||||
|
|
||||||
|
if(found) {
|
||||||
|
var n = parseInt(found[1]);
|
||||||
|
minusage = minusage < n ? minusage : n;
|
||||||
|
maxusage = maxusage > n ? maxusage : n;
|
||||||
|
|
||||||
|
if(minusage < 800 && maxusage >= 1000) {
|
||||||
|
log.testOK();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
YIELD();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user