tps: added question-to-operator feature in case of repeated test in the same board

parent 3c76940b
...@@ -16,6 +16,7 @@ import datetime ...@@ -16,6 +16,7 @@ import datetime
import random import random
import warnings import warnings
import zipfile import zipfile
import string
from ConfigParser import ConfigParser, NoOptionError from ConfigParser import ConfigParser, NoOptionError
from optparse import OptionParser from optparse import OptionParser
...@@ -188,7 +189,26 @@ class Suite(object): ...@@ -188,7 +189,26 @@ class Suite(object):
return self.run_ return self.run_
def search_prev_logs(self) :
"""Search for previous logs and ask the operator why repeat the test"""
for filename in os.listdir(self.log_path):
if string.find(filename, "run") == -1 :
continue;
try:
serial = re.match(r'^.*_([^_.]+)\.txt$', filename).group(1)
if serial == self.serial :
self.comment = raw_input('Previous logs for this board have been recorded.\nWhy do you want to repeat the test? (press ENTER to finish) : \n')
break;
except AttributeError:
pass
def run(self): def run(self):
self.comment = ""
self.search_prev_logs();
sequence = self.validate_and_compute_run() sequence = self.validate_and_compute_run()
ts = timestamp() ts = timestamp()
runid = sha(self.board + ':' + self.serial + ':' + ts) runid = sha(self.board + ':' + self.serial + ':' + ts)
...@@ -212,9 +232,10 @@ class Suite(object): ...@@ -212,9 +232,10 @@ class Suite(object):
' board = {0}\n' ' board = {0}\n'
' serial = {1}\n' ' serial = {1}\n'
' optional serial = {2}\n' ' optional serial = {2}\n'
' timestamp = {3}\n' ' comment = {3}\n'
' runid = {4}\n'.format( ' timestamp = {4}\n'
self.board, self.serial, self.extra_serial, ts, runid)) ' runid = {5}\n'.format(
self.board, self.serial, self.extra_serial, self.comment, ts, runid))
failures = [] failures = []
for test in sequence: for test in sequence:
try: try:
......
Markdown is supported
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