[oe-commits] [openembedded-core] 32/37: oeqa/parselogs: Don't use cwd for file transfers

git at git.openembedded.org git at git.openembedded.org
Tue Nov 8 23:48:18 UTC 2016


rpurdie pushed a commit to branch krogoth
in repository openembedded-core.

commit 64ff5be5909705395b2db8d64e8d2c2c76092e1c
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Fri Sep 9 13:19:02 2016 +0100

    oeqa/parselogs: Don't use cwd for file transfers
    
    If you run:
    
    MACHINE=A bitbake <image> -c testimage
    MACHINE=B bitbake <image> -c testimage
    
    and A has errors in parselogs, machine B can pick these up and cause
    immense confusion. This is because the test transfers the log files
    to cwd which is usually TOPDIR. This is clearly bad and this patch
    uses a subdir of WORKDIR to ensure machines don't contaminate each
    other.
    
    Also ensure any previous logs are cleaned up from any existing
    transfer directory.
    
    (From OE-Core rev: ac8f1e58ca3a0945795087cad9443be3e3e6ead8)
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 meta/lib/oeqa/runtime/parselogs.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/parselogs.py b/meta/lib/oeqa/runtime/parselogs.py
index 116cb0b..477b051 100644
--- a/meta/lib/oeqa/runtime/parselogs.py
+++ b/meta/lib/oeqa/runtime/parselogs.py
@@ -169,6 +169,9 @@ class ParseLogsTest(oeRuntimeTest):
     def getMachine(self):
         return oeRuntimeTest.tc.d.getVar("MACHINE", True)
 
+    def getWorkdir(self):
+        return oeRuntimeTest.tc.d.getVar("WORKDIR", True)
+
     #get some information on the CPU of the machine to display at the beginning of the output. This info might be useful in some cases.
     def getHardwareInfo(self):
         hwi = ""
@@ -206,16 +209,19 @@ class ParseLogsTest(oeRuntimeTest):
 
     #copy the log files to be parsed locally
     def transfer_logs(self, log_list):
-        target_logs = 'target_logs'
+        workdir = self.getWorkdir()
+        self.target_logs = workdir + '/' + 'target_logs'
+        target_logs = self.target_logs
         if not os.path.exists(target_logs):
             os.makedirs(target_logs)
+        bb.utils.remove(self.target_logs + "/*")
         for f in log_list:
             self.target.copy_from(f, target_logs)
 
     #get the local list of logs
     def get_local_log_list(self, log_locations):
         self.transfer_logs(self.getLogList(log_locations))
-        logs = [ os.path.join('target_logs',f) for f in os.listdir('target_logs') if os.path.isfile(os.path.join('target_logs',f)) ]
+        logs = [ os.path.join(self.target_logs, f) for f in os.listdir(self.target_logs) if os.path.isfile(os.path.join(self.target_logs, f)) ]
         return logs
 
     #build the grep command to be used with filters and exclusions

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list