From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7E9D942C11; Fri, 2 Jun 2023 17:42:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55D0640ED8; Fri, 2 Jun 2023 17:42:12 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 1214D406B8 for ; Fri, 2 Jun 2023 17:42:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685720531; x=1717256531; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0qIJD+kOlfC1pXpYXcSsOcYdQhtnvipi4C6sGpFHkcY=; b=SJ0/H/xqjHPmcRRca2/qvltDU2btnjKHqx+msB/FTImgNzlQn+HFx8M9 tm8kl2+/i+lTygH2/weNKLXnF0vNEZucA4pEeVRyszSRxCDXv557bisHq lrc2VQW9oakO74ctExrZSG9cTsiwn96dZ/oHFAIWq5hiFzDAwKyXN7cfy 5AdQi9Dap3u6XvZqDBoxGRj9eCKwCmEkFKtwwAKNS+UxDNteI8ioOa+ZC d0OG4msfIMn4auTGBrTsSX/P1UIG1j8qelvCcP8zAxLPvOfklqGYYbiuo aFzc1BitqZT39AUZxHJvpvp50s7Ij07zarf8jysw3jC9B5qXc02QCxKO1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10729"; a="345476503" X-IronPort-AV: E=Sophos;i="6.00,213,1681196400"; d="scan'208";a="345476503" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2023 08:42:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10729"; a="852203096" X-IronPort-AV: E=Sophos;i="6.00,213,1681196400"; d="scan'208";a="852203096" Received: from silpixa00400354.ir.intel.com (HELO silpixa00400354.ger.corp.intel.com) ([10.237.213.59]) by fmsmga001.fm.intel.com with ESMTP; 02 Jun 2023 08:42:08 -0700 From: Karen Kelly To: dts@dpdk.org Cc: karen.kelly@intel.com, reshma.pattan@intel.com, Tadhg Kearney Subject: [dts] tests/power_telemetry: update telemetry client file to specify socket file Date: Fri, 2 Jun 2023 15:41:42 +0000 Message-Id: <20230602154142.92670-1-karen.kelly@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org From: Tadhg Kearney 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 --- 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