Added multithreading test:

Single Sky node running examples/multi-threading/multi-threading.c. Waits until both threads have counted up and down 5 times.
This commit is contained in:
fros4943 2008-11-21 12:02:29 +00:00
parent a02a2e998a
commit f9152668e8
3 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<simulation>
<title>My simulation</title>
<delaytime>0</delaytime>
<ticktime>1</ticktime>
<randomseed>123456</randomseed>
<motedelay>1000</motedelay>
<radiomedium>
se.sics.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>
<motetype>
se.sics.cooja.mspmote.SkyMoteType
<identifier>sky1</identifier>
<description>Sky Mote Type #1</description>
<source>../../../examples/multi-threading/multi-threading.c</source>
<command>make multi-threading.sky TARGET=sky</command>
</motetype>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>83.20518861404864</x>
<y>11.060511519885651</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>1</id>
</interface_config>
</mote>
</simulation>
<plugin>
se.sics.cooja.plugins.SimControl
<width>265</width>
<z>1</z>
<height>200</height>
<location_x>0</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.VisState
<width>300</width>
<z>3</z>
<height>300</height>
<location_x>638</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.LogListener
<plugin_config>
<filter />
<history>256</history>
</plugin_config>
<width>938</width>
<z>2</z>
<height>209</height>
<location_x>1</location_x>
<location_y>746</location_y>
<minimized>false</minimized>
</plugin>
</simconf>

View File

@ -0,0 +1 @@
Single Sky node running examples/multi-threading/multi-threading.c. Waits until both threads have counted up and down 5 times.

View File

@ -0,0 +1,38 @@
lowAlpha = "BA\n";
highAlpha = "JIHGFEDCBA\n";
lowCount = "10\n";
highCount = "9876543210\n";
/* Filter messages */
if (msg.equals(lowCount)) {
log.log("Count is low\n");
} else if (msg.equals(lowAlpha)) {
log.log("Alpha is low\n");
} else if (msg.equals(highCount)) {
log.log("Count is high\n");
} else if (msg.equals(highAlpha)) {
log.log("Alpha is high\n");
} else {
/* Ignore all other messages */
return;
}
/* Remember messages */
count = global.get(msg);
if (count == null) {
count = 0;
}
count++;
global.put(msg, count);
/* Wait during test */
count = global.get(lowAlpha);
if (count == null || count < 5) return;
count = global.get(highAlpha);
if (count == null || count < 5) return;
count = global.get(lowCount);
if (count == null || count < 5) return;
count = global.get(highCount);
if (count == null || count < 5) return;
log.testOK(); /* We are done! */