blob: 83b06388492806d1fc9506ff1fa7b7d925d2d5ab [file] [log] [blame]
KP Singh7319a882014-12-24 18:18:01 +00001#!/usr/bin/env python
2
3import unittest
4import matplotlib
5import pandas as pd
6
7from test_thermal import BaseTestThermal
8import cr2
9
10
11class TestPlotter(BaseTestThermal):
12
13 """No Bombing testcases for plotter"""
14
15 def __init__(self, *args, **kwargs):
16 super(TestPlotter, self).__init__(*args, **kwargs)
17
18 def test_plot_no_pivot(self):
19 """Tests LinePlot with no pivot"""
20 run1 = cr2.Run(name="first")
21 l = cr2.LinePlot(run1, cr2.thermal.Thermal, column="temp")
22 l.view()
23 matplotlib.pyplot.close('all')
24
25 def test_plot_multi_run(self):
26 """Tests LinePlot with no Pivot multi runs"""
27 run1 = cr2.Run(name="first")
28 run2 = cr2.Run(name="second")
29 l = cr2.LinePlot(
30 [run1, run2], cr2.thermal.Thermal, column="temp")
31 l.view()
32 matplotlib.pyplot.close('all')
33
34 def test_plot_multi(self):
35 """Tests LinePlot with no Pivot multi attrs"""
36 run1 = cr2.Run(name="first")
37 run2 = cr2.Run(name="second")
38 l = cr2.LinePlot([run1,
39 run2],
40 [cr2.thermal.Thermal,
41 cr2.thermal.ThermalGovernor],
42 column=["temp",
43 "power_range"])
44 l.view()
45 matplotlib.pyplot.close('all')
46
47 def test_plot_filter(self):
48 """Tests LinePlot with no Pivot with filters"""
49 run1 = cr2.Run(name="first")
50 run2 = cr2.Run(name="second")
51 l = cr2.LinePlot([run1,
52 run2],
53 [cr2.power.OutPower],
54 column=["power"],
55 filters={"cdev_state": [1]})
56 l.view()
57 matplotlib.pyplot.close('all')
58
59 def test_plot_pivot(self):
60 """Tests LinePlot with Pivot"""
61 run1 = cr2.Run(name="first")
62 l = cr2.LinePlot(
63 run1,
64 cr2.thermal.Thermal,
65 column="temp",
66 pivot="thermal_zone")
67 l.view()
68 matplotlib.pyplot.close('all')
69
70 def test_plot_multi_run_pivot(self):
71 """Tests LinePlot with Pivot multi runs"""
72 run1 = cr2.Run(name="first")
73 run2 = cr2.Run(name="second")
74 l = cr2.LinePlot(
75 [run1, run2], cr2.power.OutPower, column="power", pivot="cpus")
76 l.view()
77 matplotlib.pyplot.close('all')
78
79 def test_plot_multi_pivot(self):
80 """Tests LinePlot with Pivot with multi attrs"""
81 run1 = cr2.Run(name="first")
82 run2 = cr2.Run(name="second")
83 l = cr2.LinePlot([run1,
84 run2],
85 [cr2.power.InPower,
86 cr2.power.OutPower],
87 column="power",
88 pivot="cpus")
89 l.view()
90 matplotlib.pyplot.close('all')
91
92 def test_plot_multi_pivot_filter(self):
93 """Tests LinePlot with Pivot and filters"""
94 run1 = cr2.Run(name="first")
95 run2 = cr2.Run(name="second")
96 l = cr2.LinePlot(
97 run1,
98 cr2.power.InPower,
99 column=[
100 "power",
101 "load1"],
102 filters={
103 "cdev_state": [
104 1,
105 0]},
106 pivot="cpus")
107 l.view()
108 matplotlib.pyplot.close('all')