aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorzhihui wu <wu.zhihui1@zte.com.cn>2017-03-24 01:11:43 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-03-24 01:11:43 +0000
commit31fd7fff783ce793d51a06780c1ab424aa1d8d33 (patch)
treebe90be3698a4f41853fbf7a9f9332e8365969e17 /tests
parentff0316e4a23ac9edcd64e3f312a344d3cc527e7f (diff)
parentc2bb13c460566a18e61a3c840bf12f7f717940c2 (diff)
Merge "Integrate cli, runner and reporter."
Diffstat (limited to 'tests')
-rw-r--r--tests/data/reporter/qtip-2017-03-16-20-07/result.json265
-rw-r--r--tests/unit/cli/cmd_report_test.py32
-rw-r--r--tests/unit/reporter/console_test.py32
3 files changed, 305 insertions, 24 deletions
diff --git a/tests/data/reporter/qtip-2017-03-16-20-07/result.json b/tests/data/reporter/qtip-2017-03-16-20-07/result.json
new file mode 100644
index 00000000..d26ad400
--- /dev/null
+++ b/tests/data/reporter/qtip-2017-03-16-20-07/result.json
@@ -0,0 +1,265 @@
+{
+ "plan_name": "compute_qpi",
+ "start_time": "2017-03-11-03-14",
+ "stop_time": "2017-03-11-03-32",
+ "sut": [
+ {
+ "name": "node-41",
+ "qpis": [
+ {
+ "benchmarks": [
+ {
+ "name": "ssl",
+ "cpu_usage": "3%",
+ "results": {
+ "aes_128_cbc_1024_bytes": "584709.80k",
+ "aes_128_cbc_16_bytes": "531050.51k",
+ "aes_128_cbc_256_bytes": "584951.30k",
+ "aes_128_cbc_64_bytes": "571063.66k",
+ "aes_128_cbc_8192_bytes": "584723.11k",
+ "rsa_sign_1024": "2.6",
+ "rsa_sign_2048": "9.9",
+ "rsa_sign_4096": "1.7",
+ "rsa_sign_512": "0.5",
+ "rsa_verify_1024": "101616.4",
+ "rsa_verify_2048": "31104.1",
+ "rsa_verify_4096": "7688.5",
+ "rsa_verify_512": "257411.2"
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1199/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-41.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4449.9/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ },
+ {
+ "name": "ramspeed",
+ "cpu_usage": "3%",
+ "results": {
+ "float_add": "10217.62",
+ "float_average": "9176.88",
+ "float_copy": "8127.13",
+ "float_scale": "8085.40",
+ "float_triad": "10277.38",
+ "integer_add": "11471.63",
+ "integer_average": "11396.35",
+ "integer_copy": "11297.18",
+ "integer_scale": "11316.86",
+ "integer_triad": "11499.74"
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-41.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4388.3/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ },
+ {
+ "name": "whetstone",
+ "cpu_usage": "3%",
+ "results": {
+ "multi_cpus": {
+ "num": "40",
+ "score": "21198.3"
+ },
+ "single_cpu": {
+ "num": "1",
+ "score": "633.2"
+ },
+ "total_cpus": "40"
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1393/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-41.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4390.1/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ },
+ {
+ "name": "dpi",
+ "cpu_usage": "3%",
+ "results": {
+ "bps": 3.638,
+ "pps": 1.45
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1199/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-41.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4409.8/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ },
+ {
+ "name": "dhrystone",
+ "cpu_usage": "3%",
+ "results": {
+ "multi_cpus": {
+ "num": "40",
+ "score": "63529.6"
+ },
+ "single_cpu": {
+ "num": "1",
+ "score": "2981.5"
+ },
+ "total_cpus": "40"
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1199/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-41.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4390.9/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ }
+ ],
+ "name": "compute_qpi"
+ }
+ ],
+ "type": "baremetal"
+ },
+ {
+ "name": "node-38",
+ "qpis": [
+ {
+ "benchmarks": [
+ {
+ "name": "ssl",
+ "cpu_usage": "3%",
+ "results": {
+ "aes_128_cbc_1024_bytes": "654325.42k",
+ "aes_128_cbc_16_bytes": "602261.15k",
+ "aes_128_cbc_256_bytes": "663959.64k",
+ "aes_128_cbc_64_bytes": "650967.68k",
+ "aes_128_cbc_8192_bytes": "667303.94k",
+ "rsa_sign_1024": "6.8",
+ "rsa_sign_2048": "8.8",
+ "rsa_sign_4096": "7.1",
+ "rsa_sign_512": "8.5",
+ "rsa_verify_1024": "100088.3",
+ "rsa_verify_2048": "31316.4",
+ "rsa_verify_4096": "8551.8",
+ "rsa_verify_512": "252476.3"
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1199/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-38.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4403.7/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ },
+ {
+ "name": "ramspeed",
+ "cpu_usage": "3%",
+ "results": {
+ "float_add": "10522.33",
+ "float_average": "9465.11",
+ "float_copy": "8434.94",
+ "float_scale": "8436.36",
+ "float_triad": "10466.82",
+ "integer_add": "11489.06",
+ "integer_average": "11466.52",
+ "integer_copy": "11398.52",
+ "integer_scale": "11413.87",
+ "integer_triad": "11564.61"
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-38.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4402.9/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ },
+ {
+ "name": "whetstone",
+ "cpu_usage": "3%",
+ "results": {
+ "multi_cpus": {
+ "num": "40",
+ "score": "21194.7"
+ },
+ "single_cpu": {
+ "num": "1",
+ "score": "676.6"
+ },
+ "total_cpus": "40"
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-38.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4405.5/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ },
+ {
+ "name": "dpi",
+ "cpu_usage": "3%",
+ "results": {
+ "bps": 3.69,
+ "pps": 1.458
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-38.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4418.2/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ },
+ {
+ "name": "dhrystone",
+ "cpu_usage": "3%",
+ "results": {
+ "multi_cpus": {
+ "num": "40",
+ "score": "63834.1"
+ },
+ "single_cpu": {
+ "num": "1",
+ "score": "3026.2"
+ },
+ "total_cpus": "40"
+ },
+ "sysinfo": {
+ "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz",
+ "disk": "1200.3GB (1.0% used)",
+ "hostname": "node-38.zte.com.cn",
+ "kernel": "4.4.0-62-generic x86_64 (64 bit)",
+ "memory": "4404.9/128524.1MB",
+ "os": "Ubuntu 16.04 xenial",
+ "product": "EC600G3"
+ }
+ }
+ ],
+ "name": "compute_qpi"
+ }
+ ],
+ "type": "baremetal"
+ }
+ ]
+}
diff --git a/tests/unit/cli/cmd_report_test.py b/tests/unit/cli/cmd_report_test.py
index 963ce987..9263707f 100644
--- a/tests/unit/cli/cmd_report_test.py
+++ b/tests/unit/cli/cmd_report_test.py
@@ -8,6 +8,7 @@
##############################################################################
import pytest
+from os import path
from click.testing import CliRunner
from qtip.cli.entry import cli
@@ -18,10 +19,17 @@ def runner():
return CliRunner()
-def test_dhrystone(runner):
+@pytest.fixture(scope="module")
+def result_path():
+ result = path.join(path.dirname(__file__), path.pardir, path.pardir,
+ 'data/reporter')
+ return result
+
+
+def test_dhrystone(runner, result_path):
"""Test dhrystone report"""
- result = runner.invoke(cli, ['report', 'show', 'dhrystone'])
+ result = runner.invoke(cli, ['report', 'show', 'dhrystone', '-p', result_path])
assert "Benchmark: dhrystone" in result.output
assert "CPU Usage: 3%" in result.output
assert "Number: 40" in result.output
@@ -30,10 +38,10 @@ def test_dhrystone(runner):
assert "Total CPUs: 40" in result.output
-def test_whetstone(runner):
+def test_whetstone(runner, result_path):
""" Test whetstone output"""
- result = runner.invoke(cli, ['report', 'show', 'whetstone'])
+ result = runner.invoke(cli, ['report', 'show', 'whetstone', '-p', result_path])
assert "Benchmark: whetstone" in result.output
assert "CPU Usage: 3%" in result.output
assert "Results:" in result.output
@@ -43,9 +51,9 @@ def test_whetstone(runner):
assert "Single CPU:" in result.output
-def test_dpi(runner):
+def test_dpi(runner, result_path):
""" Test dpi report"""
- result = runner.invoke(cli, ['report', 'show', 'dpi'])
+ result = runner.invoke(cli, ['report', 'show', 'dpi', '-p', result_path])
assert "Benchmark: dpi" in result.output
assert "CPU Usage: 3%" in result.output
assert "Bits per Second: 3.638" in result.output
@@ -54,9 +62,9 @@ def test_dpi(runner):
assert "Packets per Second: 1.458" in result.output
-def test_ramspeed(runner):
+def test_ramspeed(runner, result_path):
""" Test ramspeed report """
- result = runner.invoke(cli, ['report', 'show', 'ramspeed'])
+ result = runner.invoke(cli, ['report', 'show', 'ramspeed', '-p', result_path])
assert "Benchmark: ramspeed" in result.output
assert "CPU Usage: 3%" in result.output
assert "Float Addition: 10217.62" in result.output
@@ -68,10 +76,10 @@ def test_ramspeed(runner):
assert "Integer Average: 11396.35" in result.output
-def test_ssl(runner):
+def test_ssl(runner, result_path):
""" Test ssl report"""
- result = runner.invoke(cli, ['report', 'show', 'ssl'])
+ result = runner.invoke(cli, ['report', 'show', 'ssl', '-p', result_path])
assert "Benchmark: ssl" in result.output
assert "CPU Usage: 3%" in result.output
assert "AES 128 CBC (bytes):" in result.output
@@ -82,10 +90,10 @@ def test_ssl(runner):
assert "4096: 7688.5" in result.output
-def test_sys(runner):
+def test_sys(runner, result_path):
""" Test sys_info """
- result = runner.invoke(cli, ['report', 'show', 'ssl'])
+ result = runner.invoke(cli, ['report', 'show', 'ssl', '-p', result_path])
assert "System Information:" in result.output
assert "Host Name: node-38.zte.com.cn" in result.output
assert "Memory: 4403.7/128524.1MB" in result.output
diff --git a/tests/unit/reporter/console_test.py b/tests/unit/reporter/console_test.py
index aa7f848b..037ef2fb 100644
--- a/tests/unit/reporter/console_test.py
+++ b/tests/unit/reporter/console_test.py
@@ -8,6 +8,7 @@
##############################################################################
import pytest
+from os import path
from qtip.reporter.console import ConsoleReporter
@@ -17,14 +18,21 @@ def console_reporter():
return ConsoleReporter({})
+@pytest.fixture
+def result_path():
+ result = path.join(path.dirname(__file__), path.pardir, path.pardir,
+ 'data/reporter')
+ return result
+
+
def test_constructor(console_reporter):
assert isinstance(console_reporter, ConsoleReporter)
-def test_dhrystone(console_reporter):
+def test_dhrystone(console_reporter, result_path):
""" Test dhrystone report"""
- result = console_reporter.render('dhrystone')
+ result = console_reporter.render('dhrystone', result_path)
assert "Benchmark: dhrystone" in result
assert "Number: 40" in result
assert "Score: 63529.6" in result
@@ -32,10 +40,10 @@ def test_dhrystone(console_reporter):
assert "Total CPUs: 40" in result
-def test_whetstone(console_reporter):
+def test_whetstone(console_reporter, result_path):
""" Test whetstone output"""
- result = console_reporter.render('whetstone')
+ result = console_reporter.render('whetstone', result_path)
assert "Benchmark: whetstone" in result
assert "Results:" in result
assert "Multi CPU:" in result
@@ -44,10 +52,10 @@ def test_whetstone(console_reporter):
assert "Single CPU:" in result
-def test_dpi(console_reporter):
+def test_dpi(console_reporter, result_path):
""" Test dpi report"""
- result = console_reporter.render('dpi')
+ result = console_reporter.render('dpi', result_path)
assert "Benchmark: dpi" in result
assert "Bits per Second: 3.638" in result
assert "Packets per Second: 1.45" in result
@@ -55,10 +63,10 @@ def test_dpi(console_reporter):
assert "Packets per Second: 1.458" in result
-def test_ramspeed(console_reporter):
+def test_ramspeed(console_reporter, result_path):
""" Test ramspeed report """
- result = console_reporter.render('ramspeed')
+ result = console_reporter.render('ramspeed', result_path)
assert "Float Addition: 10217.62" in result
assert "Float Average: 9176.88" in result
assert "Float Copy: 8127.13" in result
@@ -68,10 +76,10 @@ def test_ramspeed(console_reporter):
assert "Integer Average: 11396.35" in result
-def test_ssl(console_reporter):
+def test_ssl(console_reporter, result_path):
""" Test ssl report"""
- result = console_reporter.render('ssl')
+ result = console_reporter.render('ssl', result_path)
assert "AES 128 CBC (bytes):" in result
assert "256: 584951.30k" in result
assert "RSA SIGN:" in result
@@ -80,10 +88,10 @@ def test_ssl(console_reporter):
assert "4096: 7688.5" in result
-def test_sys(console_reporter):
+def test_sys(console_reporter, result_path):
""" Test sys_info """
- result = console_reporter.render('ssl')
+ result = console_reporter.render('ssl', result_path)
assert "System Information:" in result
assert "Host Name: node-38.zte.com.cn" in result
assert "Memory: 4403.7/128524.1MB" in result