fix(tests): TAP 66/43066/8
authorPeter Mikus <[email protected]>
Mon, 2 Jun 2025 07:41:23 +0000 (09:41 +0200)
committerPeter Mikus <[email protected]>
Tue, 3 Jun 2025 07:39:00 +0000 (09:39 +0200)
Signed-off-by: Peter Mikus <[email protected]>
Change-Id: I251f8432ceab1608d5b45114bc2d3523a402268a

resources/libraries/python/CpuUtils.py
resources/libraries/python/VhostUser.py

index c573417..34f6801 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -474,10 +474,6 @@ class CpuUtils:
         else:
             cpu_node = 0
 
-        smt_used = CpuUtils.is_smt_enabled(node[u"cpuinfo"])
-        if smt_used:
-            cpu_cnt = cpu_cnt // CpuUtils.NR_OF_THREADS
-
         return CpuUtils.cpu_slice_of_list_per_node(
             node, cpu_node=cpu_node, skip_cnt=skip_cnt, cpu_cnt=cpu_cnt,
             smt_used=False)
index b36edbf..a5711df 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -164,13 +164,15 @@ class VhostUser:
         :type pf_key: str
         :type skip_cnt: int
         """
-        pids, _ = exec_cmd_no_error(
-            node, f"grep -h vhost /proc/*/comm | uniq | xargs pidof")
+        command = "grep -e vhost /proc/$(pidof vpp)/task/*/comm "
+        command +="| awk 'BEGIN { FS = \"/\" } ; { print $5 }'"
+        pids, _ = exec_cmd_no_error(node, command)
 
         affinity = CpuUtils.get_affinity_vhost(
-            node, pf_key, skip_cnt=skip_cnt, cpu_cnt=len(pids.split(" ")))
+            node, pf_key, skip_cnt=skip_cnt, cpu_cnt=len(pids.splitlines())
+        )
 
-        for cpu, pid in zip(affinity, pids.split(" ")):
+        for cpu, pid in zip(affinity, pids.splitlines()):
             exec_cmd_no_error(node, f"taskset -pc {cpu} {pid}", sudo=True)