[v3,04/11] vm_boot_test: Fix log file path in vm_boot_test

Message ID 20210317145225.88050-5-amikan@ilbers.de
State Superseded, archived
Headers show
Series Update Avocado testsuite | expand

Commit Message

Anton Mikanovich March 17, 2021, 4:52 a.m. UTC
Make log filename random and store it in build folder.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 testsuite/vm_boot_test/vm_boot_test.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/testsuite/vm_boot_test/vm_boot_test.py b/testsuite/vm_boot_test/vm_boot_test.py
index f1b7b1f..c937a16 100644
--- a/testsuite/vm_boot_test/vm_boot_test.py
+++ b/testsuite/vm_boot_test/vm_boot_test.py
@@ -4,6 +4,7 @@  import os
 import subprocess32
 import sys
 import time
+import tempfile
 
 from os.path import dirname
 sys.path.append(dirname(__file__) + '/..')
@@ -26,9 +27,9 @@  class VmBootTest(Test):
         self.log.info('Isar build folder is: ' + build_dir)
         self.log.info('===================================================')
 
-        output_file = '/tmp/vm_boot_test.log'
-        if os.path.exists(output_file):
-            os.remove(output_file)
+        fd, output_file = tempfile.mkstemp(suffix='_log.txt',
+                                           prefix='vm_start_' + distro + '_' +
+                                           arch + '_', dir=build_dir, text=True)
 
         cmdline = start_vm.format_qemu_cmdline(arch, build_dir, distro,
                                                None, None)