From 1b4574bc6a13d8fcfc7ea620cff516e2f74aefa5 Mon Sep 17 00:00:00 2001 From: Deb McLemore Date: Thu, 13 Dec 2018 07:38:07 -0600 Subject: [PATCH] OpTestOpenBMC: Download dumps to logdir Download the openbmc dumps to logdir to allow for running --run testcases.testRestAPI.HostOff.test_obmc_download_dumps (possibly as an additional component of automation). Additional issue opened on openbmc: BMC Capture journal -> https://github.com/openbmc/phosphor-debug-collector/issues/6 Signed-off-by: Deb McLemore --- OpTestConfiguration.py | 2 +- common/OpTestOpenBMC.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/OpTestConfiguration.py b/OpTestConfiguration.py index 9faed1c73..7181ff13f 100644 --- a/OpTestConfiguration.py +++ b/OpTestConfiguration.py @@ -473,7 +473,7 @@ def parse_args(self, argv=None): OpTestLogger.optest_logger_glob.setUpLoggerFile(datetime.utcnow().strftime("%Y%m%d%H%M%S%f")+'.main.log') OpTestLogger.optest_logger_glob.setUpLoggerDebugFile(datetime.utcnow().strftime("%Y%m%d%H%M%S%f")+'.debug.log') - OpTestLogger.optest_logger_glob.optest_logger.info('TestCase Log files: {}/*{}*'.format(self.output, self.outsuffix)) + OpTestLogger.optest_logger_glob.optest_logger.info('TestCase Log files: {}/*'.format(self.output)) OpTestLogger.optest_logger_glob.optest_logger.info('StreamHandler setup {}'.format('quiet' if self.args.quiet else 'normal')) self.logfile_proc = subprocess.Popen(logcmd, diff --git a/common/OpTestOpenBMC.py b/common/OpTestOpenBMC.py index cf176e578..f6af5c608 100644 --- a/common/OpTestOpenBMC.py +++ b/common/OpTestOpenBMC.py @@ -26,6 +26,7 @@ import json import requests import cgi +import os from OpTestSSH import OpTestSSH from OpTestBMC import OpTestBMC @@ -662,7 +663,7 @@ def download_dump(self, dump_id, minutes=BMC_CONST.HTTP_RETRY): uri = "/download/dump/{}".format(dump_id) r = self.conf.util_bmc_server.get(uri=uri, stream=True, minutes=minutes) value, params = cgi.parse_header(r.headers.get('Content-Disposition')) - with open(params.get('filename'), 'wb') as f: + with open(os.path.join(self.conf.logdir, params.get('filename')), 'wb') as f: f.write(r.content) def delete_dump(self, dump_id, minutes=BMC_CONST.HTTP_RETRY):