Commit c5c081df authored by Reto Da Forno's avatar Reto Da Forno
Browse files

encoding bugfix and more xml config adaptations

parent d5bc87dc
......@@ -213,12 +213,10 @@ def main(argv):
WHERE `serv_tests_key`=%d AND TIMESTAMPDIFF(MINUTE, `time_end_wish`, '%s') > %d
"""
if cur.execute(sql % (testid, now, maxtestcleanuptime)) > 0:
# thread is stuck -> add to kill list
pids.append(pid)
if len(pids) > 0:
# kill the stuck threads
for pid in pids:
os.kill(pid, signal.SIGKILL)
# thread is stuck -> add to list and kill
pids.append(str(pid))
os.kill(pid, signal.SIGKILL)
if len(pids) > 0:Z
msg = "%d stuck threads terminated (PIDs: %s)" % (len(pids), ", ".join(pids))
logger.info(msg)
emails = flocklab.get_admin_emails(cur)
......
......@@ -697,7 +697,10 @@ def stop_test(testid, cur, cn, obsdict_key, obsdict_id, abort=False):
else:
status = 'cleaning up'
logger.debug("Setting test status in DB to %s..." %status)
flocklab.set_test_status(cur, cn, testid, status)
if flocklab.set_test_status(cur, cn, testid, status) != flocklab.SUCCESS:
msg = "Failed to set test status in DB."
errors.append(msg)
logger.error(msg)
# Stop serial proxy ---
# Get the XML config from the database and check if the serial service was used in the test:
......
......@@ -949,19 +949,19 @@ def main(argv):
cpus_serial = flocklab.config.getint('fetcher', 'cpus_serial')
else:
cpus_serial = 0
cpus_free = cpus_free + flocklab.config.getint('fetcher', 'cpus_serial')
#cpus_free = cpus_free + flocklab.config.getint('fetcher', 'cpus_serial')
# CPUs for GPIO tracing:
if servicesUsed_dict['gpiotracing'] == True:
cpus_gpiomonitoring = flocklab.config.getint('fetcher', 'cpus_gpiomonitoring')
else:
cpus_gpiomonitoring = 0
cpus_free = cpus_free + flocklab.config.getint('fetcher', 'cpus_gpiomonitoring')
#cpus_free = cpus_free + flocklab.config.getint('fetcher', 'cpus_gpiomonitoring')
# CPUs for powerprofiling:
if servicesUsed_dict['powerprofiling'] == True:
cpus_powerprofiling = flocklab.config.getint('fetcher', 'cpus_powerprofiling')
else:
cpus_powerprofiling = 0
cpus_free = cpus_free + flocklab.config.getint('fetcher', 'cpus_powerprofiling')
#cpus_free = cpus_free + flocklab.config.getint('fetcher', 'cpus_powerprofiling')
# If there are free CPUs left, give them to GPIO tracing and power profiling evenly as these services need the most CPU power:
if cpus_free > 0:
if (cpus_powerprofiling > 0) and (cpus_gpiomonitoring > 0):
......
......@@ -690,7 +690,7 @@ def set_test_status(cursor=None, conn=None, testid=0, status=None):
logger = get_logger()
logger.error("%s: %s" %(str(sys.exc_info()[0]), str(sys.exc_info()[1])))
return FAILED
return(0)
return SUCCESS
### END set_test_status()
......
......@@ -361,15 +361,17 @@ def main(argv):
print(("Line %d: element dbImageId: There is already an image for core %d (image with ID %s)." % (line, core, str(dbimg))))
errcnt = errcnt + 1
else:
obsiddict[obsid][core] = ret[0]
obsiddict[obsid][core] = ret[0] # target platform
if "dpp2lora" in ret[0].lower():
usesdpp2lora = True
# If embedded image IDs are present, check if they have a corresponding <imageConf> which is valid:
# If embedded image IDs are present, check if they have a corresponding <embeddedImageConf> which is valid:
if embimageid:
for embimg, line in zip(embimageid, embimageid_line):
imageconf = tree.xpath('//d:imageConf/d:embeddedImageId[text()="%s"]/..' %(embimg), namespaces=ns)
imageconf = tree.xpath('//d:embeddedImageConf/d:embeddedImageId[text()="%s"]/..' %(embimg), namespaces=ns)
if not imageconf:
if not quiet:
print(("Line %d: element embeddedImageId: There is no corresponding element imageConf with embeddedImageId %s defined." %(line, embimg)))
print(("Line %d: element embeddedImageId: There is no corresponding element embeddedImageConf with embeddedImageId %s defined." %(line, embimg)))
errcnt = errcnt + 1
else:
# Get os and platform and put it into dictionary for later use:
......@@ -527,6 +529,17 @@ def main(argv):
print("Element serialConf: Some observer IDs have been used but do not have a targetConf element associated with them.")
errcnt = errcnt + 1
# debugConf additional validation
(debugObsIds, duplicates, allInList) = check_obsids(tree, '//d:debugConf/d:obsIds', ns, obsidlist)
if duplicates:
if not quiet:
print("Element debugConf: Some observer IDs have been used more than once.")
errcnt = errcnt + 1
if not allInList:
if not quiet:
print("Element debugConf: Some observer IDs have been used but do not have a targetConf element associated with them.")
errcnt = errcnt + 1
# gpioTracingConf additional validation ---------------------------------------
# * observer ids need to have a targetConf associated and must be unique
# * Every (pin, edge) combination can only be used once.
......@@ -544,27 +557,23 @@ def main(argv):
# Check (pin, edge) combinations:
gpiomonconfs = tree.xpath('//d:gpioTracingConf', namespaces=ns)
for gpiomonconf in gpiomonconfs:
combList = []
usesDebug = False
obsIds = gpiomonconf.findtext('d:obsIds', namespaces=ns).split()
# check if one of the used observers also uses the debug service
for obs in obsIds:
if obs in debugObsIds:
usesDebug = True
pins = gpiomonconf.find('d:pins', namespaces=ns)
if pins != None:
if usesdpp2lora and "INT2" in pins.text:
if not quiet:
print("Line %d: Pin INT2 cannot be used with target platform DPP2LoRa." % (pins.sourceline))
errcnt = errcnt + 1
break
pinconfs = gpiomonconf.xpath('d:pinConf', namespaces=ns)
for pinconf in pinconfs:
pin = pinconf.xpath('d:pin', namespaces=ns)[0].text
edge = pinconf.xpath('d:edge', namespaces=ns)[0].text
combList.append((pin, edge))
if usesdpp2lora and pin == "INT2":
errcnt = errcnt + 1
print("Line %d: Pin INT2 cannot be used with target platform DPP2LoRa." % pinconf.sourceline)
break
if (len(combList) != len(set(combList))):
if usesdpp2lora and "INT2" in pins.text:
if not quiet:
print("Line %d: Pin INT2 cannot be used with target platform DPP2LoRa." % (pins.sourceline))
errcnt = errcnt + 1
break
if usesDebug and ("LED1" in pins.text or "LED3" in pins.text):
if not quiet:
print(("Line %d: element gpioTracingConf: Every (pin, edge) combination can only be used once per observer configuration." %(gpiomonconf.sourceline)))
print("Line %d: Pins LED1 and LED3 cannot be traced on target platform DPP2LoRa in conjunction with the debug service." % (pins.sourceline))
errcnt = errcnt + 1
break
# gpioActuationConf additional validation ---------------------------
# * observer ids need to have a targetConf associated and must be unique
......@@ -640,12 +649,13 @@ def main(argv):
errcnt = errcnt + 1
# check total number of samples (for now, just multiply the total by the number of observers)
total_samples = total_samples * len(ids)
if total_samples > flocklab.config.getint('tests', 'powerprofilinglimit'):
if not quiet:
print(("Invalid combination of power profiling duration and sampling rate: the total amount of data to collect is too large (%d samples requested, limit is %d)." % (total_samples, flocklab.config.getint('tests', 'powerprofilinglimit'))))
errcnt = errcnt + 1
if ids:
total_samples = total_samples * len(ids)
if total_samples > flocklab.config.getint('tests', 'powerprofilinglimit'):
if not quiet:
print(("Invalid combination of power profiling duration and sampling rate: the total amount of data to collect is too large (%d samples requested, limit is %d)." % (total_samples, flocklab.config.getint('tests', 'powerprofilinglimit'))))
errcnt = errcnt + 1
#===========================================================================
# All additional tests finished. Clean up and exit.
#===========================================================================
......
......@@ -29,6 +29,7 @@ function db_connect()
mysqli_query($dbh, $sql) or flocklab_die('Cannot init timezone for database connection because: ' . mysqli_error($dbh));
$sql='SET sql_mode=""';
mysqli_query($dbh, $sql) or flocklab_die('Cannot set sql mode for database connection because: ' . mysqli_error($dbh));
mysqli_query($dbh, "set names 'utf8'") or flocklab_die('Cannot set names for database connection because: ' . mysqli_error($dbh));
return($dbh);
}
......@@ -1077,7 +1078,7 @@ function update_add_test($xml_config, &$errors, $existing_test_id = NULL, $abort
$dbImages[$row['serv_targetimages_key']] = Array('platform' => $row['platforms_fk']);
mysqli_close($db);
}
foreach($testconfig->imageConf as $im) {
foreach($testconfig->embeddedImageConf as $im) {
$eId = trim($im->embeddedImageId);
if(array_key_exists($eId, $embeddedImages)) {
array_push($errors, "Provided embedded images do not have unique IDs.");
......@@ -1206,8 +1207,8 @@ function update_add_test($xml_config, &$errors, $existing_test_id = NULL, $abort
// strip all embedded images from xml config
// add embedded images to db
$comment = '';
while (count($testconfig->imageConf) > 0) {
$imgEId = trim($testconfig->imageConf[0]->embeddedImageId);
while (count($testconfig->embeddedImageConf) > 0) {
$imgEId = trim($testconfig->embeddedImageConf[0]->embeddedImageId);
if ($embeddedImages[$imgEId]['used']) {
$imgId = check_image_duplicate($embeddedImages[$imgEId]);
if ($imgId === false) {
......@@ -1224,7 +1225,7 @@ function update_add_test($xml_config, &$errors, $existing_test_id = NULL, $abort
unset($embeddedImages[$imgEId]);
$comment.="<!-- stripped embedded image '".$imgEId."', image is not used in this test -->\n";
}
unset($testconfig->imageConf[0]);
unset($testconfig->embeddedImageConf[0]);
}
$xml_config = $testconfig->asXML();
$xml_config = preg_replace('#</testConf>#s', $comment.'</testConf>', $xml_config);
......
......@@ -11,11 +11,11 @@
<title>FlockLab - <!-- TEMPLATE title --></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="AUTHOR" content="ETH Zurich, Christoph Walser, CH-8092 Zurich, Switzerland">
<meta name="AUTHOR" content="ETH Zurich, Computer Engineering Group">
<meta name="COPYRIGHT" content="ETH Zurich, Switzerland">
<meta name="LANGUAGE" content="English">
<meta name="ROBOTS" content="noindex, nofollow">
<meta name="DATE" content="2011">
<meta charset="utf-8"/>
<!-- TEMPLATE javascript -->
<script type="text/javascript" src="scripts/jquery-latest.js"></script>
......
......@@ -50,7 +50,7 @@
<!-- Power profiling service configuration. If service is not to be used, do not specify this element. -->
<xs:element name="powerProfilingConf" type="powerProfilingConfType"/>
<!-- Target image configuration. If only images from database are to be used, do not specify this element. -->
<xs:element name="imageConf" type="imageConfType"/>
<xs:element name="embeddedImageConf" type="embeddedImageConfType"/>
<!-- Debug service configuration. If service is not to be used, do not specify this element. -->
<xs:element name="debugConf" type="debugConfType"/>
</xs:choice>
......@@ -143,7 +143,7 @@
</xs:group>
<!-- Configuration of target images -->
<xs:complexType name="imageConfType">
<xs:complexType name="embeddedImageConfType">
<xs:all>
<xs:element name="embeddedImageId" type="embeddedImageIdType"/>
<xs:element name="name">
......@@ -213,7 +213,7 @@
<xs:complexType name="gpioTracingConfType">
<xs:sequence>
<xs:element name="obsIds" type="obsIdListRestType"/>
<xs:element name="pins" type="pinTracingListType" minOccurs="0" maxOccurs="1"/>
<xs:element name="pins" type="pinTracingListType" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
......@@ -375,7 +375,7 @@
<!-- Type definition for test duration in seconds -->
<xs:simpleType name="testDurationSecsType">
<xs:restriction base="xs:integer">
<xs:minInclusive value="10"/>
<xs:minInclusive value="60"/>
</xs:restriction>
</xs:simpleType>
......
......@@ -33,7 +33,7 @@
<serialConf>
<obsIds>02 04 05 07 08</obsIds>
<baudrate>115200</baudrate>
<port>usb</port>
<port>serial</port>
</serialConf>
<!-- GPIO Tracing Service configuration -->
......@@ -52,7 +52,7 @@
<duration>30</duration>
</powerProfilingConf>
<imageConf>
<embeddedImageConf>
<embeddedImageId>Image_1</embeddedImageId>
<name>Hello world</name>
<description>Hello world application for a CC430 in FlockLab</description>
......@@ -1022,5 +1022,5 @@ X0gAX19TWVNTTklWAF9fU1VNRVhUAF9fUDNNQVA0NV9IAF9fTENEQk00AF9fU1ZTTUxDVExfTABf
X1BKRElSAF9fT1AyX0wAX19BREMxMENUTDFfTABfX2lzcl80MABfX1BCUkVOAHJmMWFfc3RhcnRf
dHgA
</data>
</imageConf>
</embeddedImageConf>
</testConf>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment