From daed03679ec59bf113300f39bf5f53ff72259adb Mon Sep 17 00:00:00 2001 From: smit-gardhariya Date: Tue, 16 Jan 2024 10:42:44 +0530 Subject: [PATCH] Add Encoding while saving kernel log for CLH testcase This will add encoding while opening file to save kernel logs under Cloud-Hypervisor testcase. This is needed while running this test on windows to resolve UnicodeEncodeError. Signed-off-by: Smit Gardhariya --- microsoft/testsuites/cloud_hypervisor/ch_tests_tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/testsuites/cloud_hypervisor/ch_tests_tool.py b/microsoft/testsuites/cloud_hypervisor/ch_tests_tool.py index 24e121ed13..0811e68173 100644 --- a/microsoft/testsuites/cloud_hypervisor/ch_tests_tool.py +++ b/microsoft/testsuites/cloud_hypervisor/ch_tests_tool.py @@ -404,7 +404,7 @@ def _save_kernel_logs(self, log_path: Path) -> None: else: dmesg_str = self.node.tools[Dmesg].get_output(force_run=True) dmesg_path = log_path / "dmesg" - with open(str(dmesg_path), "w") as f: + with open(str(dmesg_path), "w", encoding='utf-8') as f: f.write(dmesg_str)