Skip to content

Commit be0e39d

Browse files
committed
testrunner: Now generates a output log file in each test
1 parent 717fbc8 commit be0e39d

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

test/testrunner.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(self, path, clean=False, command=['python', 'test.py'], name=None):
6767
self.command_ = command
6868
self.proc_ = None
6969
self.path_ = path
70-
self.output_ = None
70+
self.output_ = []
7171
self.clean = clean
7272
# Extract category and type from the path variable
7373
# Category is linked to the top level folder e.g. net, fs, hw
@@ -133,9 +133,11 @@ def start(self):
133133
if self.clean:
134134
self.clean_test()
135135

136+
logfile_stdout = open('log_stdout.log', 'w')
137+
logfile_stderr = open('log_stderr.log', 'w')
136138
self.proc_ = subprocess.Popen(self.command_, shell=False,
137-
stdout=subprocess.PIPE,
138-
stderr=subprocess.PIPE)
139+
stdout=logfile_stdout,
140+
stderr=logfile_stderr)
139141
os.chdir(startdir)
140142
return self
141143

@@ -158,7 +160,15 @@ def wait_status(self):
158160
self.print_start()
159161

160162
# Start and wait for the process
161-
self.output_ = self.proc_.communicate()
163+
self.proc_.communicate()
164+
165+
os.chdir(startdir + "/" + self.path_)
166+
with open('log_stdout.log', 'r') as log_stdout:
167+
self.output_.append(log_stdout.read())
168+
169+
with open('log_stderr.log', 'r') as log_stderr:
170+
self.output_.append(log_stderr.read())
171+
162172

163173
if self.proc_.returncode == 0:
164174
print pretty.PASS_INLINE()

0 commit comments

Comments
 (0)