Re: [Fuego] [PATCH 1/2] Kernel_build: Update to parse and get test_build time

<[email protected]> Tue, 12 Apr 2022 16:33:06 +0000
Newsgroups dev.linux.lists.fuego
Message-ID <TYAPR01MB60918AE721E7D546BD27C644B3ED9@TYAPR01MB6091.jpnprd01.prod.outlook.com>
Dear Tim,

By mistake I have sent patch wrongly, please ignore the title with  [PATCH =
1/2].
It is only 1 patch related to Kernel_Build tool.
Kindly review the changes

Thanks & Regards
Sireesha

-----Original Message-----
From: [email protected] <[email protected]>=
=20
Sent: Tuesday, April 12, 2022 5:25 PM
To: [email protected]
Cc: nakkala sireesha(=1B$B#T#S#I#P=1B(B) <[email protected]=
>; [email protected]; dinesh kumar(=1B$B#T#S#I#P=1B(B) <dines=
[email protected]>; hayashi kazuhiro(=1B$BNS=1B(B =1B$BOB9(=1B(B =1B=
$B""#S#W#C"~#A#C#T=1B(B) <[email protected]>
Subject: [PATCH 1/2] Kernel_build: Update to parse and get test_build time

From: sireesha <[email protected]>

scripts/parser/common.py: Update reference to 'Consolelog' to parse build t=
ime

chart_config.json: Add reference to get test build time

parser.py: Implement to parse test build time from console log

reference.json: Add reference for test build time

test.yaml: Add data files related to kernel build

Signed-off-by: sireesha <[email protected]>
---
 scripts/parser/common.py                      |  1 +
 .../Functional.kernel_build/chart_config.json |  5 +++++
 tests/Functional.kernel_build/parser.py       | 21 +++++++++++++++++++
 tests/Functional.kernel_build/reference.json  | 20 ++++++++++++++++++
 tests/Functional.kernel_build/test.yaml       |  3 +++
 5 files changed, 50 insertions(+)
 create mode 100644 tests/Functional.kernel_build/chart_config.json
 create mode 100644 tests/Functional.kernel_build/parser.py
 create mode 100644 tests/Functional.kernel_build/reference.json

diff --git a/scripts/parser/common.py b/scripts/parser/common.py index d7dc=
fbd..ba28cc1 100644
--- a/scripts/parser/common.py
+++ b/scripts/parser/common.py
@@ -114,6 +114,7 @@ for env_var in env_list:
 REF_JSON  =3D TEST_HOME + '/reference.json'
 CHART_CONFIG_JSON  =3D TEST_HOME + '/chart_config.json'
 TEST_LOG =3D '%s/logs/%s/%s.%s.%s.%s/testlog.txt' % (FUEGO_RW, TESTDIR, NO=
DE_NAME, TESTSPEC, BUILD_NUMBER, BUILD_ID)
+CONSOLE_LOG =3D '%s/logs/%s/%s.%s.%s.%s/consolelog.txt' % (FUEGO_RW,=20
+TESTDIR, NODE_NAME, TESTSPEC, BUILD_NUMBER, BUILD_ID)
 RUN_JSON =3D LOGDIR + '/run.json'
=20
 #Here are some pre-packaged regex strings diff --git a/tests/Functional.ke=
rnel_build/chart_config.json b/tests/Functional.kernel_build/chart_config.j=
son
new file mode 100644
index 0000000..a8802de
--- /dev/null
+++ b/tests/Functional.kernel_build/chart_config.json
@@ -0,0 +1,5 @@
+{
+    "chart_type": "measure_plot",
+    "measures": ["default.test_build"]
+}
+
diff --git a/tests/Functional.kernel_build/parser.py b/tests/Functional.ker=
nel_build/parser.py
new file mode 100644
index 0000000..78f35c3
--- /dev/null
+++ b/tests/Functional.kernel_build/parser.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python3
+import os, re, sys
+import common as plib
+  =20
+cur_search_str =3D "^(Fuego.test_build.duration=3D)\ *([\d]{1,8}.[\d]{1,4}=
).*"
+
+print("Reading current values from " + plib.CONSOLE_LOG) cur_file =3D=20
+open(plib.CONSOLE_LOG,'r')
+
+lines =3D cur_file.readlines()
+cur_file.close()
+
+measurements =3D {}
+for line in lines:
+    m =3D re.match(cur_search_str, line)
+    if m:
+        value =3D m.group(2)
+        measurements['default.kernel_build'] =3D [{"name": "test_build",=20
+"measure" : value}]
+
+sys.exit(plib.process(measurements))
+
diff --git a/tests/Functional.kernel_build/reference.json b/tests/Functiona=
l.kernel_build/reference.json
new file mode 100644
index 0000000..9d8adfc
--- /dev/null
+++ b/tests/Functional.kernel_build/reference.json
@@ -0,0 +1,20 @@
+{
+    "test_sets":[
+        {
+            "name":"default",
+            "test_cases":[
+                {
+                    "name":"kernel_build",
+                    "measurements":[
+                        {
+                            "name":"test_build",
+                            "unit":"s"
+                        }
+
+                    ]
+                }
+            ]
+        }
+    ]
+}
+
diff --git a/tests/Functional.kernel_build/test.yaml b/tests/Functional.ker=
nel_build/test.yaml
index c076bd7..304218e 100644
--- a/tests/Functional.kernel_build/test.yaml
+++ b/tests/Functional.kernel_build/test.yaml
@@ -46,3 +46,6 @@ data_files:
     - fuego_test.sh
     - spec.json
     - test.yaml
+    - parser.py
+    - reference.json
+    - chart_config.json
--
2.20.1