[Fuego] [PATCH] hwlatdetect: Add a new test program for rt-tests

Hoang Van Tuyen tuyen.hoangvan at toshiba-tsdv.com
Wed Feb 7 07:36:22 UTC 2018


The hwlatdetect is a program to control the kernel hardware latency 
detection module.
Target boards have to support hwlat_detector module.

Signed-off-by: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
---
  ...1-hwlatdetect-cleaned-up-exception-raises.patch | 37 
++++++++++++++++++++++
  .../tests/Benchmark.hwlatdetect/chart_config.json  |  4 +++
  engine/tests/Benchmark.hwlatdetect/criteria.json   | 12 +++++++
  engine/tests/Benchmark.hwlatdetect/fuego_test.sh   | 23 ++++++++++++++
  engine/tests/Benchmark.hwlatdetect/parser.py       | 13 ++++++++
  engine/tests/Benchmark.hwlatdetect/reference.json  | 18 +++++++++++
  engine/tests/Benchmark.hwlatdetect/spec.json       | 14 ++++++++
  7 files changed, 121 insertions(+)
  create mode 100644 
engine/tests/Benchmark.hwlatdetect/0001-hwlatdetect-cleaned-up-exception-raises.patch
  create mode 100644 engine/tests/Benchmark.hwlatdetect/chart_config.json
  create mode 100644 engine/tests/Benchmark.hwlatdetect/criteria.json
  create mode 100755 engine/tests/Benchmark.hwlatdetect/fuego_test.sh
  create mode 100755 engine/tests/Benchmark.hwlatdetect/parser.py
  create mode 100644 engine/tests/Benchmark.hwlatdetect/reference.json
  create mode 100644 engine/tests/Benchmark.hwlatdetect/spec.json

diff --git 
a/engine/tests/Benchmark.hwlatdetect/0001-hwlatdetect-cleaned-up-exception-raises.patch 
b/engine/tests/Benchmark.hwlatdetect/0001-hwlatdetect-cleaned-up-exception-raises.patch
new file mode 100644
index 0000000..23b5e96
--- /dev/null
+++ 
b/engine/tests/Benchmark.hwlatdetect/0001-hwlatdetect-cleaned-up-exception-raises.patch
@@ -0,0 +1,37 @@
+From 679c56ddcf83c67517d208d0fe9c60cdc45606d0 Mon Sep 17 00:00:00 2001
+From: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
+Date: Wed, 7 Feb 2018 11:42:56 +0700
+Subject: [PATCH] hwlatdetect: cleaned up exception raises
+
+Fix issue: TypeError: raise: arg 3 must be a traceback or None
+and correct typing mistake by using Hwlat instead of HwLat
+
+Signed-off-by: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
+---
+ src/hwlatdetect/hwlatdetect.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/hwlatdetect/hwlatdetect.py 
b/src/hwlatdetect/hwlatdetect.py
+index 5ebd4f1..5106bfb 100755
+--- a/src/hwlatdetect/hwlatdetect.py
++++ b/src/hwlatdetect/hwlatdetect.py
+@@ -306,7 +306,7 @@ class Tracer(Detector):
+         super(Tracer, self).__init__()
+         path = self.debugfs.getpath('tracing/hwlat_detector')
+         if not os.path.exists(path):
+-            raise DetectorNotAvailable, "hwlat", "hwlat tracer not 
available"
++            raise DetectorNotAvailable("hwlat", "hwlat tracer not 
available")
+         self.type = "tracer"
+         self.samples = []
+         self.set("enable", 0)
+@@ -545,7 +545,7 @@ if __name__ == '__main__':
+         try:
+             detect = Tracer()
+         except DetectorNotAvailable, err:
+-            detect = HwLat()
++            detect = Hwlat()
+
+     if o.threshold:
+         t = microseconds(o.threshold)
+--
+2.1.4
diff --git a/engine/tests/Benchmark.hwlatdetect/chart_config.json 
b/engine/tests/Benchmark.hwlatdetect/chart_config.json
new file mode 100644
index 0000000..71c8238
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/chart_config.json
@@ -0,0 +1,4 @@
+{
+    "chart_type": "measure_plot",
+    "measures": ["default.latencies.max_latency"]
+}
diff --git a/engine/tests/Benchmark.hwlatdetect/criteria.json 
b/engine/tests/Benchmark.hwlatdetect/criteria.json
new file mode 100644
index 0000000..0520968
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/criteria.json
@@ -0,0 +1,12 @@
+{
+    "schema_version":"1.0",
+    "criteria":[
+        {
+            "tguid":"default.latencies.max_latency",
+            "reference":{
+                "value":15000,
+                "operator":"le"
+            }
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.hwlatdetect/fuego_test.sh 
b/engine/tests/Benchmark.hwlatdetect/fuego_test.sh
new file mode 100755
index 0000000..d1ab59e
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/fuego_test.sh
@@ -0,0 +1,23 @@
+tarball=../rt-tests/rt-tests-v1.1.1.tar.gz
+
+# This test requires the hwlat_detector driver.
+# The hwlatdetect executable test file have many actions for checking 
and loading
+# the hwlat_detector. So, We do not add a pre_check for hwlat_detector 
driver.
+NEED_ROOT=1
+function test_pre_check {
+    assert_define BENCHMARK_HWLATDETECT_PARAMS
+}
+
+function test_build {
+    patch -p1 -N -s < 
$TEST_HOME/../rt-tests/0001-Add-scheduling-policies-for-old-kernels.patch
+    patch -p1 -N -s < 
$TEST_HOME/0001-hwlatdetect-cleaned-up-exception-raises.patch
+    make hwlatdetect
+}
+
+function test_deploy {
+    put hwlatdetect $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR; ./hwlatdetect 
$BENCHMARK_HWLATDETECT_PARAMS"
+}
diff --git a/engine/tests/Benchmark.hwlatdetect/parser.py 
b/engine/tests/Benchmark.hwlatdetect/parser.py
new file mode 100755
index 0000000..32c23ce
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/parser.py
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+import os, re, sys
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+regex_string = "^Max Latency:\s+(\d+)us"
+measurements = {}
+matches = plib.parse_log(regex_string)
+
+if matches:
+    measurements['default.latencies'] = [{"name": "max_latency", 
"measure" : float(matches[0])}]
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Benchmark.hwlatdetect/reference.json 
b/engine/tests/Benchmark.hwlatdetect/reference.json
new file mode 100644
index 0000000..ba61c77
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/reference.json
@@ -0,0 +1,18 @@
+{
+    "test_sets":[
+        {
+            "name":"default",
+            "test_cases":[
+                {
+                    "name":"latencies",
+                    "measurements":[
+                        {
+                            "name":"max_latency",
+                            "unit":"us"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.hwlatdetect/spec.json 
b/engine/tests/Benchmark.hwlatdetect/spec.json
new file mode 100644
index 0000000..c59f5ff
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/spec.json
@@ -0,0 +1,14 @@
+{
+    "testName": "Benchmark.hwlatdetect",
+    "specs": {
+        "default": {
+            "PARAMS": "--duration=1m --hardlimit=15000"
+        },
+        "latest": {
+            "PER_JOB_BUILD": "true",
+            "gitrepo": 
"https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git",
+            "gitref": "unstable/devel/v1.1.1",
+            "PARAMS": "--duration=1m --report=smi.txt"
+        }
+    }
+}
-- 
2.1.4


-- 
================================================================
Hoang Van Tuyen (Mr.)
TOSHIBA SOFTWARE DEVELOPMENT (VIETNAM) CO., LTD.
16th Floor, VIT Building, 519 Kim Ma Str., Ba Dinh Dist., Hanoi, Vietnam
Tel: 84-4-22208801 (Company) - Ext.251
Fax: 84-4-22208802 (Company)
Email: tuyen.hoangvan at toshiba-tsdv.com
================================================================

-------------- next part --------------
From 2578640eb402b7fb36daad3b6adcf254c6951fbe Mon Sep 17 00:00:00 2001
From: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
Date: Wed, 7 Feb 2018 14:10:59 +0700
Subject: [PATCH] hwlatdetect: Add a new test program for rt-tests

The hwlatdetect is a program to control the kernel hardware latency detection module.
Target boards have to support hwlat_detector module.

Signed-off-by: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
---
 ...1-hwlatdetect-cleaned-up-exception-raises.patch | 37 ++++++++++++++++++++++
 .../tests/Benchmark.hwlatdetect/chart_config.json  |  4 +++
 engine/tests/Benchmark.hwlatdetect/criteria.json   | 12 +++++++
 engine/tests/Benchmark.hwlatdetect/fuego_test.sh   | 23 ++++++++++++++
 engine/tests/Benchmark.hwlatdetect/parser.py       | 13 ++++++++
 engine/tests/Benchmark.hwlatdetect/reference.json  | 18 +++++++++++
 engine/tests/Benchmark.hwlatdetect/spec.json       | 14 ++++++++
 7 files changed, 121 insertions(+)
 create mode 100644 engine/tests/Benchmark.hwlatdetect/0001-hwlatdetect-cleaned-up-exception-raises.patch
 create mode 100644 engine/tests/Benchmark.hwlatdetect/chart_config.json
 create mode 100644 engine/tests/Benchmark.hwlatdetect/criteria.json
 create mode 100755 engine/tests/Benchmark.hwlatdetect/fuego_test.sh
 create mode 100755 engine/tests/Benchmark.hwlatdetect/parser.py
 create mode 100644 engine/tests/Benchmark.hwlatdetect/reference.json
 create mode 100644 engine/tests/Benchmark.hwlatdetect/spec.json

diff --git a/engine/tests/Benchmark.hwlatdetect/0001-hwlatdetect-cleaned-up-exception-raises.patch b/engine/tests/Benchmark.hwlatdetect/0001-hwlatdetect-cleaned-up-exception-raises.patch
new file mode 100644
index 0000000..23b5e96
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/0001-hwlatdetect-cleaned-up-exception-raises.patch
@@ -0,0 +1,37 @@
+From 679c56ddcf83c67517d208d0fe9c60cdc45606d0 Mon Sep 17 00:00:00 2001
+From: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
+Date: Wed, 7 Feb 2018 11:42:56 +0700
+Subject: [PATCH] hwlatdetect: cleaned up exception raises
+
+Fix issue: TypeError: raise: arg 3 must be a traceback or None
+and correct typing mistake by using Hwlat instead of HwLat
+
+Signed-off-by: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
+---
+ src/hwlatdetect/hwlatdetect.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
+index 5ebd4f1..5106bfb 100755
+--- a/src/hwlatdetect/hwlatdetect.py
++++ b/src/hwlatdetect/hwlatdetect.py
+@@ -306,7 +306,7 @@ class Tracer(Detector):
+         super(Tracer, self).__init__()
+         path = self.debugfs.getpath('tracing/hwlat_detector')
+         if not os.path.exists(path):
+-            raise DetectorNotAvailable, "hwlat", "hwlat tracer not available"
++            raise DetectorNotAvailable("hwlat", "hwlat tracer not available")
+         self.type = "tracer"
+         self.samples = []
+         self.set("enable", 0)
+@@ -545,7 +545,7 @@ if __name__ == '__main__':
+         try:
+             detect = Tracer()
+         except DetectorNotAvailable, err:
+-            detect = HwLat()
++            detect = Hwlat()
+
+     if o.threshold:
+         t = microseconds(o.threshold)
+--
+2.1.4
diff --git a/engine/tests/Benchmark.hwlatdetect/chart_config.json b/engine/tests/Benchmark.hwlatdetect/chart_config.json
new file mode 100644
index 0000000..71c8238
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/chart_config.json
@@ -0,0 +1,4 @@
+{
+	"chart_type": "measure_plot",
+	"measures": ["default.latencies.max_latency"]
+}
diff --git a/engine/tests/Benchmark.hwlatdetect/criteria.json b/engine/tests/Benchmark.hwlatdetect/criteria.json
new file mode 100644
index 0000000..0520968
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/criteria.json
@@ -0,0 +1,12 @@
+{
+    "schema_version":"1.0",
+    "criteria":[
+        {
+            "tguid":"default.latencies.max_latency",
+            "reference":{
+                "value":15000,
+                "operator":"le"
+            }
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.hwlatdetect/fuego_test.sh b/engine/tests/Benchmark.hwlatdetect/fuego_test.sh
new file mode 100755
index 0000000..d1ab59e
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/fuego_test.sh
@@ -0,0 +1,23 @@
+tarball=../rt-tests/rt-tests-v1.1.1.tar.gz
+
+# This test requires the hwlat_detector driver.
+# The hwlatdetect executable test file have many actions for checking and loading
+# the hwlat_detector. So, We do not add a pre_check for hwlat_detector driver.
+NEED_ROOT=1
+function test_pre_check {
+    assert_define BENCHMARK_HWLATDETECT_PARAMS
+}
+
+function test_build {
+    patch -p1 -N -s < $TEST_HOME/../rt-tests/0001-Add-scheduling-policies-for-old-kernels.patch
+    patch -p1 -N -s < $TEST_HOME/0001-hwlatdetect-cleaned-up-exception-raises.patch
+    make hwlatdetect
+}
+
+function test_deploy {
+    put hwlatdetect $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR; ./hwlatdetect $BENCHMARK_HWLATDETECT_PARAMS"
+}
diff --git a/engine/tests/Benchmark.hwlatdetect/parser.py b/engine/tests/Benchmark.hwlatdetect/parser.py
new file mode 100755
index 0000000..32c23ce
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/parser.py
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+import os, re, sys
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+regex_string = "^Max Latency:\s+(\d+)us"
+measurements = {}
+matches = plib.parse_log(regex_string)
+
+if matches:
+	measurements['default.latencies'] = [{"name": "max_latency", "measure" : float(matches[0])}]
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Benchmark.hwlatdetect/reference.json b/engine/tests/Benchmark.hwlatdetect/reference.json
new file mode 100644
index 0000000..ba61c77
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/reference.json
@@ -0,0 +1,18 @@
+{
+    "test_sets":[
+        {
+            "name":"default",
+            "test_cases":[
+                {
+                    "name":"latencies",
+                    "measurements":[
+                        {
+                            "name":"max_latency",
+                            "unit":"us"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.hwlatdetect/spec.json b/engine/tests/Benchmark.hwlatdetect/spec.json
new file mode 100644
index 0000000..c59f5ff
--- /dev/null
+++ b/engine/tests/Benchmark.hwlatdetect/spec.json
@@ -0,0 +1,14 @@
+{
+    "testName": "Benchmark.hwlatdetect",
+    "specs": {
+        "default": {
+            "PARAMS": "--duration=1m --hardlimit=15000"
+        },
+        "latest": {
+            "PER_JOB_BUILD": "true",
+            "gitrepo": "https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git",
+            "gitref": "unstable/devel/v1.1.1",
+            "PARAMS": "--duration=1m --report=smi.txt"
+        }
+    }
+}
-- 
2.1.4
-------------- next part --------------
-- 
This mail was scanned by BitDefender
For more information please visit http://www.bitdefender.com


More information about the Fuego mailing list