Commit 2e4fcb65 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

minor adjustments to logging and use different arm binutils path

parent b5278047
......@@ -115,8 +115,8 @@ shutdown_timeout = 240
; tools for target image validation
[targetimage]
imagevalidator = /home/flocklab/testmanagementserver/targetimage_validator.py
binutils_arm = /home/flocklab/binutils/binutils-arm ;Path to ARM binutils
binutils_msp430 = /home/flocklab/binutils/binutils-msp430/usr/bin ;Path to MSP430 binutils
binutils_arm = /usr/bin ;Path to ARM binutils
binutils_msp430 = /usr/bin ;Path to MSP430 binutils
setsymbolsscript = /home/flocklab/tools/tos-set-symbols ;Path to script used to set symbols (e.g. node ID)
; Recaptcha
......
......@@ -394,7 +394,7 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
errors.append(msg)
logger.error(msg)
shutil.move(imagepath, binpath)
logger.debug("Copied binary file without modification.")
logger.debug("Copied binary file to '%s' without modification." % (binpath))
# Remove the original file which is not used anymore:
if os.path.exists(imagepath):
......@@ -426,6 +426,7 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
logger.info("Processed all target images from database.")
# XML processing ---
if len(errors) == 0:
# Get the XML config from the database and generate a separate file for every observer used:
cur.execute("SELECT `testconfig_xml` FROM `tbl_serv_tests` WHERE (`serv_tests_key` = %s)" % testid)
ret = cur.fetchone()
......@@ -437,7 +438,7 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
parser = lxml.etree.XMLParser(remove_comments=True)
tree = lxml.etree.fromstring(bytes(bytearray(ret[0], encoding = 'utf-8')), parser)
ns = {'d': flocklab.config.get('xml', 'namespace')}
logger.debug("Got XML from database.")
#logger.debug("Got XML from database.")
# Create XML files for observers ---
# Create an empty XML config file for every observer used and organize them in a dictionary:
xmldict_key = {}
......@@ -1434,7 +1435,6 @@ def main(argv):
logger.info("Waiting for the test to stop... (%ds left)" % (int(stoptimestamp - time.time())))
while not abort and time.time() < stoptimestamp:
time.sleep(0.1)
logger.debug("Stopping test now...")
# Reconnect to the database:
try:
......
......@@ -177,9 +177,11 @@ def main(argv):
# Check for work ---
# Check if a new test is to be started ---
# Calculate the time frame in which a test can be started: at least the setuptime ahead, at most 5 minutes more ahead
earlieststart = (datetime.datetime.now() + datetime.timedelta(seconds=flocklab.config.getint("tests", "setuptime")) - datetime.timedelta(seconds=10)).strftime(flocklab.config.get("database", "timeformat"))
lateststart = (datetime.datetime.now() + datetime.timedelta(seconds=flocklab.config.getint("tests", "setuptime")) + datetime.timedelta(minutes=2)).strftime(flocklab.config.get("database", "timeformat"))
# Calculate the time frame in which a test can be started: at least the setuptime ahead
slacktime = 10
setuptime = flocklab.config.getint("tests", "setuptime")
earlieststart = (datetime.datetime.now() + datetime.timedelta(seconds=setuptime) - datetime.timedelta(seconds=slacktime)).strftime(flocklab.config.get("database", "timeformat"))
lateststart = (datetime.datetime.now() + datetime.timedelta(seconds=setuptime) + datetime.timedelta(seconds=slacktime)).strftime(flocklab.config.get("database", "timeformat"))
# Check if a test is going to start soon:
sql = """SELECT `serv_tests_key`,`time_start_wish`
FROM `tbl_serv_tests`
......@@ -188,22 +190,21 @@ def main(argv):
AND (`test_status` = 'planned')
AND (`dispatched` = 0)
""" % (earlieststart, lateststart)
logger.debug("Looking in DB for tests with start time between %s and %s and test status planned..." % (now, lateststart))
#logger.debug("Looking in DB for tests with start time between %s and %s and test status planned..." % (earlieststart, lateststart))
cur.execute(sql)
# start thread for each test to start
rs = cur.fetchall()
if rs:
# start thread for each test to start
for test in rs:
testid = int(test[0])
delay = int(calendar.timegm(time.strptime(str(test[1]), '%Y-%m-%d %H:%M:%S'))) - flocklab.config.getint("tests", "setuptime") - int(time.time())
delay = int(calendar.timegm(time.strptime(str(test[1]), '%Y-%m-%d %H:%M:%S'))) - setuptime - int(time.time())
if delay < 0:
delay = 0
logger.info("Call process to start test %s with delay %ss." % (testid,delay))
p = multiprocessing.Process(target=test_startstopabort, args=(testid, False, delay))
p.start()
else:
logger.debug("No test is to be started within the next %s seconds" % (flocklab.config.get("tests", "setuptime")))
logger.debug("No test is to be started within the next %d seconds" % (setuptime + 2 * slacktime))
# Check for test which have been missed ---
sql1 = """SELECT `serv_tests_key`
FROM `tbl_serv_tests`
......@@ -235,8 +236,8 @@ def main(argv):
else:
logger.error("Error %s returned when trying to get test owner information" % str(rs))
logger.warning("Updated test status of %d missed tests to 'failed' and informed users." % nmissed)
else:
logger.debug("No missed tests found.")
#else:
# logger.debug("No missed tests found.")
rs = errno.ENODATA
# Check if a test needs to be aborted ---
......
......@@ -1050,7 +1050,7 @@ def schedule_linktest(cur, cn, debug=False):
lasttest = linktest_interval_min * 2 # any number > (interval_hours + interval_random_minutes) will do
else:
lasttest = int(rs[0])
logger.debug("Last link measurement was %s minutes ago." % (lasttest))
#logger.debug("Last link measurement was %s minutes ago." % (lasttest))
nexttest = linktest_interval_min + random.randint(-config.getint("linktests", "interval_random_minutes"), config.getint("linktests", "interval_random_minutes"))
if lasttest >= nexttest:
......@@ -1176,12 +1176,8 @@ def patch_binary(symbol=None, value=None, binaryfile=None, arch=None):
binutils_objdump = "msp430-objdump"
elif arch == 'arm':
binutils_path = config.get('targetimage', 'binutils_arm')
binutils_objcopy = "usr/bin/arm-linux-gnu-objcopy"
binutils_objdump = "usr/bin/arm-linux-gnu-objdump"
# TODO: check whether this is necessary
if 'LD_LIBRARY_PATH' not in env:
env['LD_LIBRARY_PATH'] = ''
env['LD_LIBRARY_PATH'] += ':%s/%s' % (binutils_path, "usr/x86_64-linux-gnu/arm-linux-gnu/lib")
binutils_objcopy = "arm-none-eabi-objcopy"
binutils_objdump = "arm-none-eabi-objdump"
cmd = ['%s' % (set_symbols_tool), '--objcopy', '%s/%s' % (binutils_path, binutils_objcopy), '--objdump', '%s/%s' % (binutils_path, binutils_objdump), '--target', 'elf', binaryfile, binaryfile, '%s=%s' % (symbol, value), 'ActiveMessageAddressC$addr=%s' % (value), 'ActiveMessageAddressC__addr=%s' % (value)]
try:
......@@ -1218,12 +1214,8 @@ def bin_to_hex(binaryfile=None, arch=None, outputfile=None):
binutils_objdump = "msp430-objdump"
elif arch == 'arm':
binutils_path = config.get('targetimage', 'binutils_arm')
binutils_objcopy = "usr/bin/arm-linux-gnu-objcopy"
binutils_objdump = "usr/bin/arm-linux-gnu-objdump"
# TODO: check whether this is necessary
if 'LD_LIBRARY_PATH' not in env:
env['LD_LIBRARY_PATH'] = ''
env['LD_LIBRARY_PATH'] += ':%s/%s' % (binutils_path, "usr/x86_64-linux-gnu/arm-linux-gnu/lib")
binutils_objcopy = "arm-none-eabi-objcopy"
binutils_objdump = "arm-none-eabi-objdump"
cmd = ['%s/%s' % (binutils_path, binutils_objcopy), '--output-target', 'ihex', binaryfile, outputfile]
try:
......
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