tests: assume c source files are utf-8 encoded

Message ID 20240305134614.64951-2-rjarry@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series tests: assume c source files are utf-8 encoded |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Robin Jarry March 5, 2024, 1:46 p.m. UTC
  Instead of relying on the default locale from the environment (LC_ALL),
explicitly read the files as utf-8 encoded.

Fixes: 0aeaf75df879 ("test: define unit tests suites based on test types")

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 buildtools/get-test-suites.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Bruce Richardson March 5, 2024, 1:49 p.m. UTC | #1
On Tue, Mar 05, 2024 at 02:46:15PM +0100, Robin Jarry wrote:
> Instead of relying on the default locale from the environment (LC_ALL),
> explicitly read the files as utf-8 encoded.
> 
> Fixes: 0aeaf75df879 ("test: define unit tests suites based on test types")
> 
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Thanks for the update/fix.
  
Morten Brørup March 5, 2024, 2:26 p.m. UTC | #2
> From: Robin Jarry [mailto:rjarry@redhat.com]
> Sent: Tuesday, 5 March 2024 14.46
> 
> Instead of relying on the default locale from the environment (LC_ALL),
> explicitly read the files as utf-8 encoded.
> 
> Fixes: 0aeaf75df879 ("test: define unit tests suites based on test types")
> 
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---

I strongly agree on UTF-8 encoding everywhere in the DPDK project, so...

Acked-by: Morten Brørup <mb@smartsharesystems.com>
  
Tyler Retzlaff March 5, 2024, 6:25 p.m. UTC | #3
On Tue, Mar 05, 2024 at 02:46:15PM +0100, Robin Jarry wrote:
> Instead of relying on the default locale from the environment (LC_ALL),
> explicitly read the files as utf-8 encoded.
> 
> Fixes: 0aeaf75df879 ("test: define unit tests suites based on test types")
> 
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  
Thomas Monjalon March 6, 2024, 9:20 p.m. UTC | #4
05/03/2024 14:49, Bruce Richardson:
> On Tue, Mar 05, 2024 at 02:46:15PM +0100, Robin Jarry wrote:
> > Instead of relying on the default locale from the environment (LC_ALL),
> > explicitly read the files as utf-8 encoded.
> > 
> > Fixes: 0aeaf75df879 ("test: define unit tests suites based on test types")
> > 
> > Signed-off-by: Robin Jarry <rjarry@redhat.com>
> > ---
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> Thanks for the update/fix.

Applied, thanks.
  

Patch

diff --git a/buildtools/get-test-suites.py b/buildtools/get-test-suites.py
index 574c233aa873..c61f6a273fad 100644
--- a/buildtools/get-test-suites.py
+++ b/buildtools/get-test-suites.py
@@ -19,7 +19,7 @@  def get_fast_test_params(test_name, ln):
     return f":{nohuge.strip().lower()}:{asan.strip().lower()}"
 
 for fname in input_list:
-    with open(fname) as f:
+    with open(fname, "r", encoding="utf-8") as f:
         contents = [ln.strip() for ln in f.readlines()]
         test_lines = [ln for ln in contents if test_def_regex.match(ln)]
         non_suite_tests.extend([non_suite_regex.match(ln).group(1)