1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
###############################################################
# Copyright (c) 2017 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import pytest
from os import path
from click.testing import CliRunner
from qtip.cli.entry import cli
@pytest.fixture(scope="module")
def runner():
return CliRunner()
@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', '-p', result_path])
assert "Benchmark..............................................................." \
"...................dhrystone" in result.output
assert "Score..................................................................." \
"..................63529.6"
def test_whetstone(runner, result_path):
""" Test whetstone output"""
result = runner.invoke(cli, ['report', 'show', 'whetstone', '-p', result_path])
assert "Number................................................................." \
"...........................40" in result.output
assert "Total CPUs............................................................." \
"...........................40"
def test_dpi(runner, result_path):
""" Test dpi report"""
result = runner.invoke(cli, ['report', 'show', 'dpi', '-p', result_path])
assert "Bits per Second..................................................." \
".............................3.638" in result.output
assert "Packets per Second................................................" \
".............................1.458" in result.output
def test_ramspeed(runner, result_path):
""" Test ramspeed report """
result = runner.invoke(cli, ['report', 'show', 'ramspeed', '-p', result_path])
assert "Float Addition........................................................" \
"......................10522.33" in result.output
assert "Integer Average........................................................" \
".....................11466.52" in result.output
def test_ssl(runner, result_path):
""" Test ssl report"""
result = runner.invoke(cli, ['report', 'show', 'ssl', '-p', result_path])
assert "8192............................................................." \
".........................667303.94k" in result.output
assert "1024.............................................................." \
"..........................100088.3" in result.output
def test_sys(runner, result_path):
""" Test sys_info """
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 "Operating System.................................................." \
"...............Ubuntu 16.04 xenial" in result.output
|