test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] tests/power_telemetry: update telemetry client file to specify socket file
@ 2023-06-02 15:41 Karen Kelly
  2023-06-06  7:06 ` Pattan, Reshma
  0 siblings, 1 reply; 2+ messages in thread
From: Karen Kelly @ 2023-06-02 15:41 UTC (permalink / raw)
  To: dts; +Cc: karen.kelly, reshma.pattan, Tadhg Kearney

From: Tadhg Kearney <tadhg.kearney@intel.com>

Telemetry test creates a client file to support creating json data, using
this you can specify a socket file instead of default. Currently bug in
dpdk-telemetry-client.py which doesn't allow this to work.

Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>
---
 tests/TestSuite_power_telemetry.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/TestSuite_power_telemetry.py b/tests/TestSuite_power_telemetry.py
index c2f65273..9ddf7992 100644
--- a/tests/TestSuite_power_telemetry.py
+++ b/tests/TestSuite_power_telemetry.py
@@ -148,26 +148,26 @@ class TestPowerTelemetry(TestCase):
         """
         script_content = textwrap.dedent(
             """
-            #! /usr/bin/env python
+            #! /usr/bin/env python3
             import argparse
             import time
             import json
             from dpdk_telemetry_client import Client, GLOBAL_METRICS_REQ, BUFFER_SIZE
-            
+
             class ClientExd(Client):
                 def __init__(self, json_file):
                     super(ClientExd, self).__init__()
                     self.json_file = json_file
                 def save_date(self, data):
-                    with open(self.json_file, 'w') as fp:
+                    with open(self.json_file, 'wb') as fp:
                         fp.write(data)
                 def requestGlobalMetrics(self):
-                    self.socket.client_fd.send(GLOBAL_METRICS_REQ)
+                    self.socket.client_fd.send(GLOBAL_METRICS_REQ.encode())
                     data = self.socket.client_fd.recv(BUFFER_SIZE)
                     self.save_date(data)
             parser = argparse.ArgumentParser(description='telemetry')
             parser.add_argument('-f',
-                                '--file',
+                                '--file-prefix',
                                 nargs='*',
                                 default=1,
                                 help='message channel')
@@ -177,9 +177,10 @@ class TestPowerTelemetry(TestCase):
                                 default=None,
                                 help='json_file option')
             args = parser.parse_args()
-            file_path = args.file[0]
+            file_path = args.file_prefix[0]
             client = ClientExd(args.json_file[0])
             client.getFilepath(file_path)
+            client.setRunpath(file_path)
             client.register()
             client.requestGlobalMetrics()
             time.sleep(2)
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [dts] tests/power_telemetry: update telemetry client file to specify socket file
  2023-06-02 15:41 [dts] tests/power_telemetry: update telemetry client file to specify socket file Karen Kelly
@ 2023-06-06  7:06 ` Pattan, Reshma
  0 siblings, 0 replies; 2+ messages in thread
From: Pattan, Reshma @ 2023-06-06  7:06 UTC (permalink / raw)
  To: Kelly, Karen, dts; +Cc: Kearney, Tadhg



> -----Original Message-----
> From: Kelly, Karen <karen.kelly@intel.com>
> Sent: Friday, June 2, 2023 4:42 PM
> To: dts@dpdk.org
> Cc: Kelly, Karen <karen.kelly@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>; Kearney, Tadhg <tadhg.kearney@intel.com>
> Subject: [dts] tests/power_telemetry: update telemetry client file to specify
> socket file
> 
> From: Tadhg Kearney <tadhg.kearney@intel.com>
> 
> Telemetry test creates a client file to support creating json data, using this you
> can specify a socket file instead of default. Currently bug in dpdk-telemetry-
> client.py which doesn't allow this to work.
> 
> Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>


Acked-by: Reshma Pattan <reshma.pattan@intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-06  7:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02 15:41 [dts] tests/power_telemetry: update telemetry client file to specify socket file Karen Kelly
2023-06-06  7:06 ` Pattan, Reshma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).