From 61f2b00a2acc17086a93aec5e860098a592c10b4 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Tue, 6 Apr 2021 15:53:19 -0600 Subject: [PATCH] Export SMC data in HW Diagnostics Addresses issue #154 --- scripts/wk/hw/diags.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/wk/hw/diags.py b/scripts/wk/hw/diags.py index fbea7b98..5576970e 100644 --- a/scripts/wk/hw/diags.py +++ b/scripts/wk/hw/diags.py @@ -352,6 +352,21 @@ class State(): _f.write(f'\n{name}:\n') _f.write('\n'.join(debug.generate_object_report(test, indent=1))) + # SMC + if os.path.exists('/.wk-live-macos'): + data = [] + try: + proc = exe.run_program(['smc', '-f']) + data.extend(proc.stdout.splitlines()) + data.append('----') + proc = exe.run_program(['smc', '-l']) + data.extend(proc.stdout.splitlines()) + except Exception: # pylint: disable=broad-except + LOG.ERROR('Error(s) encountered while exporting SMC data') + data = [line.strip() for line in data] + with open(f'{debug_dir}/smc.data', 'a') as _f: + _f.write('\n'.join(data)) + def update_progress_pane(self): """Update progress pane.""" report = []