From f2e352a4d2d0e7a4842a30c44a8ccb94fab9a448 Mon Sep 17 00:00:00 2001 From: Smit Gardhariya <113590758+smit-gardhariya@users.noreply.github.com> Date: Tue, 16 Jan 2024 13:34:46 +0530 Subject: [PATCH] Add Encoding while saving kernel log for CLH testcase (#3140) 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..687d795d09 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)