Browse Source

tests: Rename dmesg files to a unique name

This allows multiple dmesg files to be saved if a test case is executed
multiple times similarly to the other logfiles.

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 10 years ago
parent
commit
cfb5576d93
1 changed files with 4 additions and 0 deletions
  1. 4 0
      tests/hwsim/run-tests.py

+ 4 - 0
tests/hwsim/run-tests.py

@@ -142,6 +142,10 @@ class DataCollector(object):
             self._trace_cmd.wait()
             self._trace_cmd.wait()
         if self._dmesg:
         if self._dmesg:
             output = os.path.join(self._logdir, '%s.dmesg' % (self._testname, ))
             output = os.path.join(self._logdir, '%s.dmesg' % (self._testname, ))
+            num = 0
+            while os.path.exists(output):
+                output = os.path.join(self._logdir, '%s.dmesg-%d' % (self._testname, num))
+                num += 1
             subprocess.call(['dmesg', '-c'], stdout=open(output, 'w'))
             subprocess.call(['dmesg', '-c'], stdout=open(output, 'w'))
 
 
 def rename_log(logdir, basename, testname, dev):
 def rename_log(logdir, basename, testname, dev):