test suite reviews and discussions
 help / color / mirror / Atom feed
From: Karen Kelly <karen.kelly@intel.com>
To: dts@dpdk.org
Cc: karen.kelly@intel.com, reshma.pattan@intel.com,
	Tadhg Kearney <tadhg.kearney@intel.com>
Subject: [dts] tests/power_telemetry: update telemetry client file to specify socket file
Date: Fri,  2 Jun 2023 15:41:42 +0000	[thread overview]
Message-ID: <20230602154142.92670-1-karen.kelly@intel.com> (raw)

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


             reply	other threads:[~2023-06-02 15:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 15:41 Karen Kelly [this message]
2023-06-06  7:06 ` Pattan, Reshma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230602154142.92670-1-karen.kelly@intel.com \
    --to=karen.kelly@intel.com \
    --cc=dts@dpdk.org \
    --cc=reshma.pattan@intel.com \
    --cc=tadhg.kearney@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).