trappy: rename to trappy
Change-Id: I7e0e34c9f5565e34629683bb29ab25cf5e737088
diff --git a/tests/cr2 b/tests/cr2
deleted file mode 120000
index 9e88218..0000000
--- a/tests/cr2
+++ /dev/null
@@ -1 +0,0 @@
-../cr2
\ No newline at end of file
diff --git a/tests/test_base.py b/tests/test_base.py
index b77ecea..be6f291 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -18,10 +18,10 @@
import sys
import unittest
import utils_tests
-import cr2
-from cr2.base import trace_parser_explode_array
+import trappy
+from trappy.base import trace_parser_explode_array
-sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "cr2"))
+sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "trappy"))
class TestBaseMethods(unittest.TestCase):
"""Test simple methods that don't need to set up a directory"""
@@ -90,7 +90,7 @@
with open("trace.txt", "w") as fout:
fout.write(in_data)
- run = cr2.Run()
+ run = trappy.Run()
dfr = run.cpu_in_power.data_frame
self.assertEquals(set(dfr.columns), expected_columns)
@@ -122,8 +122,8 @@
with open("trace.txt", "w") as fout:
fout.write(in_data)
- cr2.register_dynamic('Event0', 'event0', scope="sched")
- run = cr2.Run()
+ trappy.register_dynamic('Event0', 'event0', scope="sched")
+ run = trappy.Run()
dfr = run.event0.data_frame
self.assertEquals(set(dfr.columns), expected_columns)
@@ -146,9 +146,9 @@
with open("trace.txt", "w") as fout:
fout.write(in_data)
- cr2.register_dynamic('sched_stat_runtime', 'my_sched_stat_runtime',
+ trappy.register_dynamic('sched_stat_runtime', 'my_sched_stat_runtime',
scope="sched")
- run = cr2.Run()
+ run = trappy.Run()
dfr = run.sched_stat_runtime.data_frame
self.assertEquals(set(dfr.columns), expected_columns)
@@ -160,7 +160,7 @@
def test_get_dataframe(self):
"""TestBase: Thermal.data_frame["thermal_zone"] exists and
it contains a known value"""
- dfr = cr2.Run().thermal.data_frame
+ dfr = trappy.Run().thermal.data_frame
self.assertTrue("thermal_zone" in dfr.columns)
self.assertEquals(dfr["temp"].iloc[0], 68786)
@@ -170,7 +170,7 @@
from csv import DictReader
fname = "thermal.csv"
- cr2.Run().thermal.write_csv(fname)
+ trappy.Run().thermal.write_csv(fname)
with open(fname) as fin:
csv_reader = DictReader(fin)
@@ -184,7 +184,7 @@
def test_normalize_time(self):
"""TestBase: Base::normalize_time() normalizes the time of the trace"""
- thrm = cr2.Run().thermal
+ thrm = trappy.Run().thermal
last_prev_time = thrm.data_frame.index[-1]
diff --git a/tests/test_constraint.py b/tests/test_constraint.py
index a8730c1..31e6da7 100644
--- a/tests/test_constraint.py
+++ b/tests/test_constraint.py
@@ -17,11 +17,11 @@
import pandas as pd
import unittest
-from cr2.plotter import AttrConf
-from cr2.plotter.Constraint import ConstraintManager
+from trappy.plotter import AttrConf
+from trappy.plotter.Constraint import ConstraintManager
class TestConstraintManager(unittest.TestCase):
- """Test cr2.plotter.ConstraintManager"""
+ """Test trappy.plotter.ConstraintManager"""
def __init__(self, *args, **kwargs):
"""Init some common data for the tests"""
diff --git a/tests/test_cpu_power.py b/tests/test_cpu_power.py
index ea837b2..af60939 100644
--- a/tests/test_cpu_power.py
+++ b/tests/test_cpu_power.py
@@ -18,7 +18,7 @@
import pandas as pd
from test_thermal import BaseTestThermal
-import cr2
+import trappy
import cpu_power
class TestCpuPower(BaseTestThermal):
@@ -52,21 +52,21 @@
def test_cpuoutpower_dataframe(self):
"""Test that CpuOutPower() creates a proper data_frame"""
- outp = cr2.Run().cpu_out_power
+ outp = trappy.Run().cpu_out_power
self.assertEquals(outp.data_frame["power"].iloc[0], 1344)
self.assertTrue("cdev_state" in outp.data_frame.columns)
def test_cpuoutpower_get_all_freqs(self):
"""Test CpuOutPower.get_all_freqs()"""
- dfr = cr2.Run().cpu_out_power.get_all_freqs(self.map_label)
+ dfr = trappy.Run().cpu_out_power.get_all_freqs(self.map_label)
self.assertEquals(dfr["A57"].iloc[0], 1100)
self.assertEquals(dfr["A53"].iloc[1], 850)
def test_cpuinpower_get_dataframe(self):
"""Test that CpuInPower() creates a proper data_frame()"""
- inp = cr2.Run().cpu_in_power
+ inp = trappy.Run().cpu_in_power
self.assertTrue("load0" in inp.data_frame.columns)
self.assertEquals(inp.data_frame["load0"].iloc[0], 24)
@@ -80,7 +80,7 @@
with open("trace.txt", "w") as fout:
fout.write(in_data)
- inp = cr2.Run(normalize_time=False).cpu_in_power
+ inp = trappy.Run(normalize_time=False).cpu_in_power
self.assertEquals(round(inp.data_frame.index[0], 6), 676.256284)
self.assertEquals(inp.data_frame["cpus"].iloc[1], "00000000,00000030")
@@ -97,7 +97,7 @@
with open("trace.txt", "w") as fout:
fout.write(in_data)
- inp = cr2.Run(normalize_time=False).cpu_in_power
+ inp = trappy.Run(normalize_time=False).cpu_in_power
self.assertEquals(inp.data_frame["load0"].iloc[0], 74)
self.assertEquals(inp.data_frame["load1"].iloc[0], 49)
@@ -110,7 +110,7 @@
def test_cpuinpower_get_all_freqs(self):
"""Test CpuInPower.get_all_freqs()"""
- dfr = cr2.Run().cpu_in_power.get_all_freqs(self.map_label)
+ dfr = trappy.Run().cpu_in_power.get_all_freqs(self.map_label)
self.assertEquals(dfr["A57"].iloc[0], 1100)
self.assertEquals(dfr["A53"].iloc[1], 850)
@@ -118,7 +118,7 @@
def test_cpuinpower_get_load_data(self):
"""Test CpuInPower.get_load_data()"""
- run = cr2.Run()
+ run = trappy.Run()
first_load = run.cpu_in_power.data_frame["load0"].iloc[0]
load_data = run.cpu_in_power.get_load_data(self.map_label)
@@ -131,7 +131,7 @@
def test_cpuinpower_get_normalized_load_data(self):
"""Test CpuInPower.get_normalized_load_data()"""
- run = cr2.Run()
+ run = trappy.Run()
first_load = run.cpu_in_power.data_frame["load0"].iloc[0]
load_data = run.cpu_in_power.get_normalized_load_data(self.map_label)
diff --git a/tests/test_devfreq.py b/tests/test_devfreq.py
index d8aa980..6ec168a 100644
--- a/tests/test_devfreq.py
+++ b/tests/test_devfreq.py
@@ -15,7 +15,7 @@
import pandas as pd
-import cr2
+import trappy
from test_thermal import BaseTestThermal
class TestDevfreqPower(BaseTestThermal):
@@ -23,20 +23,20 @@
def test_devfreq_inp_dataframe(self):
"""Test that DevfreqInPower creates proper data frames"""
- devfreq_in_power = cr2.Run().devfreq_in_power
+ devfreq_in_power = trappy.Run().devfreq_in_power
self.assertTrue("freq" in devfreq_in_power.data_frame.columns)
def test_devfreq_outp_dataframe(self):
"""Test that DevfreqOutPower creates proper data frames"""
- devfreq_out_power = cr2.Run().devfreq_out_power
+ devfreq_out_power = trappy.Run().devfreq_out_power
self.assertTrue("freq" in devfreq_out_power.data_frame.columns)
def test_get_inp_all_freqs(self):
"""Test that DevfreqInPower get_all_freqs() work"""
- all_freqs = cr2.Run().devfreq_in_power.get_all_freqs()
+ all_freqs = trappy.Run().devfreq_in_power.get_all_freqs()
self.assertTrue(isinstance(all_freqs, pd.DataFrame))
self.assertEquals(all_freqs["freq"].iloc[0], 525)
@@ -44,7 +44,7 @@
def test_get_outp_all_freqs(self):
"""Test that DevfreqOutPower get_all_freqs() work"""
- all_freqs = cr2.Run().devfreq_out_power.get_all_freqs()
+ all_freqs = trappy.Run().devfreq_out_power.get_all_freqs()
self.assertTrue(isinstance(all_freqs, pd.DataFrame))
self.assertEquals(all_freqs["freq"].iloc[0], 525)
diff --git a/tests/test_duplicates.py b/tests/test_duplicates.py
index dd3ec6a..f994389 100644
--- a/tests/test_duplicates.py
+++ b/tests/test_duplicates.py
@@ -18,7 +18,7 @@
import matplotlib
import pandas as pd
import utils_tests
-import cr2
+import trappy
import shutil
from test_thermal import BaseTestThermal
@@ -46,10 +46,10 @@
rcuos/2-22 [001] 6550.018627: sched_load_avg_sg: cpus=00000002 load=1 utilization=7
rcuos/2-22 [001] 6550.018628: sched_load_avg_sg: cpus=00000004 load=2 utilization=8\n""")
fout.close()
- run1 = cr2.Run(name="first")
- l = cr2.LinePlot(
+ run1 = trappy.Run(name="first")
+ l = trappy.LinePlot(
run1,
- cr2.sched.SchedLoadAvgSchedGroup,
+ trappy.sched.SchedLoadAvgSchedGroup,
column=['utilization'],
filters={
"load": [
@@ -80,10 +80,10 @@
rcuos/2-22 [001] 6550.018628: sched_load_avg_sg: cpus=00000004 load=2 utilization=8\n""")
fout.close()
- run1 = cr2.Run(name="first")
- l = cr2.LinePlot(
+ run1 = trappy.Run(name="first")
+ l = trappy.LinePlot(
run1,
- cr2.sched.SchedLoadAvgSchedGroup,
+ trappy.sched.SchedLoadAvgSchedGroup,
column=['utilization'],
filters={
"load": [
diff --git a/tests/test_dynamic.py b/tests/test_dynamic.py
index 5522395..e7044c8 100644
--- a/tests/test_dynamic.py
+++ b/tests/test_dynamic.py
@@ -17,14 +17,14 @@
import unittest
import matplotlib
from test_sched import BaseTestSched
-from cr2.base import Base
-import cr2
+from trappy.base import Base
+import trappy
class DynamicEvent(Base):
"""Test the ability to register
- specific classes to cr2"""
+ specific classes to trappy"""
unique_word = "dynamic_test_key"
name = "dynamic_event"
@@ -45,8 +45,8 @@
Test if the dynamic events are populated
in the data frame
"""
- cr2.register_dynamic("DynamicEvent", "dynamic_test_key")
- r = cr2.Run(name="first")
+ trappy.register_dynamic("DynamicEvent", "dynamic_test_key")
+ r = trappy.Run(name="first")
self.assertTrue(len(r.dynamic_event.data_frame) == 1)
def test_dynamic_class_attr(self):
@@ -54,7 +54,7 @@
Test the attibutes of the dynamically
generated class
"""
- cls = cr2.register_dynamic("DynamicEvent", "dynamic_test_key")
+ cls = trappy.register_dynamic("DynamicEvent", "dynamic_test_key")
self.assertEquals(cls.__name__, "DynamicEvent")
self.assertEquals(cls.name, "dynamic_event")
self.assertEquals(cls.unique_word, "dynamic_test_key")
@@ -63,9 +63,9 @@
"""Test if plotter can accept a dynamic class
for a template argument"""
- cls = cr2.register_dynamic("DynamicEvent", "dynamic_test_key")
- r = cr2.Run(name="first")
- l = cr2.LinePlot(r, cls, column="load")
+ cls = trappy.register_dynamic("DynamicEvent", "dynamic_test_key")
+ r = trappy.Run(name="first")
+ l = trappy.LinePlot(r, cls, column="load")
l.view(test=True)
def test_dynamic_event_scope(self):
@@ -73,12 +73,12 @@
registered. it should appear in both thermal and sched
run class definitions when scoped run objects are created
"""
- cls = cr2.register_dynamic("DynamicEvent", "dynamic_test_key")
- r1 = cr2.Run(name="first")
+ cls = trappy.register_dynamic("DynamicEvent", "dynamic_test_key")
+ r1 = trappy.Run(name="first")
print r1.class_definitions
self.assertTrue(r1.class_definitions.has_key(cls.name))
def test_register_class(self):
- cr2.register_class(DynamicEvent)
- r = cr2.Run(name="first")
+ trappy.register_class(DynamicEvent)
+ r = trappy.Run(name="first")
self.assertTrue(len(r.dynamic_event.data_frame) == 1)
diff --git a/tests/test_pid.py b/tests/test_pid.py
index cb75c01..1276e47 100644
--- a/tests/test_pid.py
+++ b/tests/test_pid.py
@@ -17,12 +17,12 @@
import matplotlib
from test_thermal import BaseTestThermal
-import cr2
+import trappy
class TestPIDController(BaseTestThermal):
def test_dataframe(self):
"""Test that PIDController() generates a valid data_frame"""
- pid = cr2.Run().pid_controller
+ pid = trappy.Run().pid_controller
self.assertTrue(len(pid.data_frame) > 0)
self.assertTrue("err_integral" in pid.data_frame.columns)
@@ -32,7 +32,7 @@
"""Test PIDController.plot_controller()
As it happens with all plot functions, just test that it doesn't explode"""
- pid = cr2.Run().pid_controller
+ pid = trappy.Run().pid_controller
pid.plot_controller()
matplotlib.pyplot.close('all')
diff --git a/tests/test_plot_utils.py b/tests/test_plot_utils.py
index 8406856..bedc0b2 100644
--- a/tests/test_plot_utils.py
+++ b/tests/test_plot_utils.py
@@ -19,7 +19,7 @@
import pandas as pd
from test_thermal import BaseTestThermal
-import cr2
+import trappy
import plot_utils
class TestPlotUtils(unittest.TestCase):
@@ -118,7 +118,7 @@
"""Calculate the number of frequency plots correctly"""
trace_out = ""
- run = cr2.Run()
+ run = trappy.Run()
self.assertEquals(plot_utils.number_freq_plots([run], self.map_label),
3)
@@ -133,15 +133,15 @@
fout.write(trace_out)
# Without devfreq there should only be two plots
- run = cr2.Run()
+ run = trappy.Run()
self.assertEquals(plot_utils.number_freq_plots([run], self.map_label),
2)
def test_plot_temperature(self):
"""Test that plot_utils.plot_temperature() doesn't bomb"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
runs = [run1, run2]
plot_utils.plot_temperature(runs, ylim="default")
@@ -150,8 +150,8 @@
def test_plot_load(self):
"""Test that plot_utils.plot_load() doesn't bomb"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
runs = [run1, run2]
plot_utils.plot_load(runs, self.map_label, height=5)
@@ -159,7 +159,7 @@
def test_plot_load_single_run(self):
"""plot_utils.plot_load() can be used with a single run"""
- run = cr2.Run()
+ run = trappy.Run()
plot_utils.plot_load([run], self.map_label)
matplotlib.pyplot.close('all')
@@ -167,8 +167,8 @@
def test_plot_allfreqs(self):
"""Test that plot_utils.plot_allfreqs() doesn't bomb"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
runs = [run1, run2]
plot_utils.plot_allfreqs(runs, self.map_label, width=20)
@@ -176,7 +176,7 @@
def test_plot_allfreqs_single_run(self):
"""plot_utils.plot_allfreqs() can be used with a single run"""
- run = cr2.Run()
+ run = trappy.Run()
plot_utils.plot_allfreqs([run], self.map_label)
matplotlib.pyplot.close('all')
@@ -184,8 +184,8 @@
def test_plot_controller(self):
"""plot_utils.plot_controller() doesn't bomb"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
runs = [run1, run2]
plot_utils.plot_controller(runs, height=5)
@@ -194,8 +194,8 @@
def test_plot_input_power(self):
"""plot_utils.plot_input_power() doesn't bomb"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
runs = [run1, run2]
plot_utils.plot_input_power(runs, self.actor_order, width=20)
@@ -204,8 +204,8 @@
def test_plot_output_power(self):
"""plot_utils.plot_output_power() doesn't bomb"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
runs = [run1, run2]
plot_utils.plot_output_power(runs, self.actor_order, width=20)
@@ -214,8 +214,8 @@
def test_plot_freq_hists(self):
"""plot_utils.plot_freq_hists() doesn't bomb"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
runs = [run1, run2]
plot_utils.plot_freq_hists(runs, self.map_label)
@@ -224,7 +224,7 @@
def test_plot_freq_hists_single_run(self):
"""plot_utils.plot_freq_hists() works with a single run"""
- run = cr2.Run()
+ run = trappy.Run()
plot_utils.plot_freq_hists([run], self.map_label)
matplotlib.pyplot.close('all')
@@ -232,8 +232,8 @@
def test_plot_temperature_hist(self):
"""plot_utils.plot_temperature_hist() doesn't bomb"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
runs = [run1, run2]
plot_utils.plot_temperature_hist(runs)
diff --git a/tests/test_plotter.py b/tests/test_plotter.py
index a914e65..520d10e 100644
--- a/tests/test_plotter.py
+++ b/tests/test_plotter.py
@@ -21,7 +21,7 @@
import os
from test_thermal import BaseTestThermal
-import cr2
+import trappy
class TestPlotter(BaseTestThermal):
@@ -33,67 +33,67 @@
def test_plot_no_pivot(self):
"""Tests LinePlot with no pivot"""
- run1 = cr2.Run(name="first")
- l = cr2.LinePlot(run1, cr2.thermal.Thermal, column="temp")
+ run1 = trappy.Run(name="first")
+ l = trappy.LinePlot(run1, trappy.thermal.Thermal, column="temp")
l.view(test=True)
def test_plot_multi_run(self):
"""Tests LinePlot with no Pivot multi runs"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
- l = cr2.LinePlot(
- [run1, run2], cr2.thermal.Thermal, column="temp")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
+ l = trappy.LinePlot(
+ [run1, run2], trappy.thermal.Thermal, column="temp")
l.view(test=True)
def test_plot_multi(self):
"""Tests LinePlot with no Pivot multi attrs"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
- l = cr2.LinePlot([run1,
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
+ l = trappy.LinePlot([run1,
run2],
- [cr2.thermal.Thermal,
- cr2.thermal.ThermalGovernor],
+ [trappy.thermal.Thermal,
+ trappy.thermal.ThermalGovernor],
column=["temp",
"power_range"])
l.view(test=True)
def test_plot_filter(self):
"""Tests LinePlot with no Pivot with filters"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
- l = cr2.LinePlot([run1,
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
+ l = trappy.LinePlot([run1,
run2],
- [cr2.cpu_power.CpuOutPower],
+ [trappy.cpu_power.CpuOutPower],
column=["power"],
filters={"cdev_state": [1]})
l.view(test=True)
def test_plot_pivot(self):
"""Tests LinePlot with Pivot"""
- run1 = cr2.Run(name="first")
- l = cr2.LinePlot(
+ run1 = trappy.Run(name="first")
+ l = trappy.LinePlot(
run1,
- cr2.thermal.Thermal,
+ trappy.thermal.Thermal,
column="temp",
pivot="thermal_zone")
l.view(test=True)
def test_plot_multi_run_pivot(self):
"""Tests LinePlot with Pivot multi runs"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
- l = cr2.LinePlot(
- [run1, run2], cr2.cpu_power.CpuOutPower, column="power", pivot="cpus")
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
+ l = trappy.LinePlot(
+ [run1, run2], trappy.cpu_power.CpuOutPower, column="power", pivot="cpus")
l.view(test=True)
def test_plot_multi_pivot(self):
"""Tests LinePlot with Pivot with multi attrs"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
- l = cr2.LinePlot([run1,
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
+ l = trappy.LinePlot([run1,
run2],
- [cr2.cpu_power.CpuInPower,
- cr2.cpu_power.CpuOutPower],
+ [trappy.cpu_power.CpuInPower,
+ trappy.cpu_power.CpuOutPower],
column=["dynamic_power",
"power"],
pivot="cpus")
@@ -101,11 +101,11 @@
def test_plot_multi_pivot_filter(self):
"""Tests LinePlot with Pivot and filters"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
- l = cr2.LinePlot(
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
+ l = trappy.LinePlot(
run1,
- cr2.cpu_power.CpuInPower,
+ trappy.cpu_power.CpuInPower,
column=[
"dynamic_power",
"load1"],
@@ -118,11 +118,11 @@
def test_plot_savefig(self):
"""Tests plotter: savefig"""
- run1 = cr2.Run(name="first")
- run2 = cr2.Run(name="second")
- l = cr2.LinePlot(
+ run1 = trappy.Run(name="first")
+ run2 = trappy.Run(name="second")
+ l = trappy.LinePlot(
run1,
- cr2.cpu_power.CpuInPower,
+ trappy.cpu_power.CpuInPower,
column=[
"dynamic_power",
"load1"],
diff --git a/tests/test_results.py b/tests/test_results.py
index 3198f24..b5d5daf 100644
--- a/tests/test_results.py
+++ b/tests/test_results.py
@@ -21,8 +21,8 @@
import pandas as pd
import utils_tests
-sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "cr2"))
-from cr2.wa import Result, get_results, combine_results
+sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "trappy"))
+from trappy.wa import Result, get_results, combine_results
class TestResults(utils_tests.SetupDirectory):
def __init__(self, *args, **kwargs):
@@ -109,7 +109,7 @@
matplotlib.pyplot.close('all')
def test_get_run_number(self):
- from cr2.wa.results import get_run_number
+ from trappy.wa.results import get_run_number
self.assertEquals(get_run_number("score_2"), (True, 2))
self.assertEquals(get_run_number("score"), (True, 0))
diff --git a/tests/test_run.py b/tests/test_run.py
index d3f1470..e6b8aee 100644
--- a/tests/test_run.py
+++ b/tests/test_run.py
@@ -22,7 +22,7 @@
import unittest
from test_thermal import BaseTestThermal
-import cr2
+import trappy
import utils_tests
class TestRun(BaseTestThermal):
@@ -33,7 +33,7 @@
def test_run_has_all_classes(self):
"""The Run() class has members for all classes"""
- run = cr2.Run()
+ run = trappy.Run()
for attr in run.class_definitions.iterkeys():
self.assertTrue(hasattr(run, attr))
@@ -41,7 +41,7 @@
def test_run_has_all_classes_scope_all(self):
"""The Run() class has members for all classes with scope=all"""
- run = cr2.Run(scope="all")
+ run = trappy.Run(scope="all")
for attr in run.class_definitions.iterkeys():
self.assertTrue(hasattr(run, attr))
@@ -49,7 +49,7 @@
def test_run_has_all_classes_scope_thermal(self):
"""The Run() class has only members for thermal classes with scope=thermal"""
- run = cr2.Run(scope="thermal")
+ run = trappy.Run(scope="thermal")
for attr in run.thermal_classes.iterkeys():
self.assertTrue(hasattr(run, attr))
@@ -60,7 +60,7 @@
def test_run_has_all_classes_scope_sched(self):
"""The Run() class has only members for sched classes with scope=sched"""
- run = cr2.Run(scope="sched")
+ run = trappy.Run(scope="sched")
for attr in run.thermal_classes.iterkeys():
self.assertFalse(hasattr(run, attr))
@@ -71,19 +71,19 @@
def test_run_accepts_name(self):
"""The Run() class has members for all classes"""
- run = cr2.Run(name="foo")
+ run = trappy.Run(name="foo")
self.assertEquals(run.name, "foo")
def test_fail_if_no_trace_dat(self):
"""Raise an IOError with the path if there's no trace.dat and trace.txt"""
os.remove("trace.txt")
- self.assertRaises(IOError, cr2.Run)
+ self.assertRaises(IOError, trappy.Run)
cwd = os.getcwd()
try:
- cr2.Run(cwd)
+ trappy.Run(cwd)
except IOError as exception:
pass
@@ -95,7 +95,7 @@
other_random_dir = tempfile.mkdtemp()
os.chdir(other_random_dir)
- dfr = cr2.Run(self.out_dir).thermal.data_frame
+ dfr = trappy.Run(self.out_dir).thermal.data_frame
self.assertTrue(len(dfr) > 0)
self.assertEquals(os.getcwd(), other_random_dir)
@@ -105,7 +105,7 @@
arbitrary_trace_name = "my_trace.txt"
shutil.move("trace.txt", arbitrary_trace_name)
- dfr = cr2.Run(arbitrary_trace_name).thermal.data_frame
+ dfr = trappy.Run(arbitrary_trace_name).thermal.data_frame
self.assertTrue(len(dfr) > 0)
self.assertFalse(os.path.exists("trace.txt"))
@@ -116,21 +116,21 @@
def test_run_autonormalize_time(self):
"""Run() normalizes by default"""
- run = cr2.Run()
+ run = trappy.Run()
self.assertEquals(round(run.thermal.data_frame.index[0], 7), 0)
def test_run_dont_normalize_time(self):
"""Run() doesn't normalize if asked not to"""
- run = cr2.Run(normalize_time=False)
+ run = trappy.Run(normalize_time=False)
self.assertNotEquals(round(run.thermal.data_frame.index[0], 7), 0)
def test_run_basetime(self):
"""Test that basetime calculation is correct"""
- run = cr2.Run(normalize_time=False)
+ run = trappy.Run(normalize_time=False)
basetime = run.thermal.data_frame.index[0]
@@ -139,7 +139,7 @@
def test_run_duration(self):
"""Test that duration calculation is correct"""
- run = cr2.Run(normalize_time=False)
+ run = trappy.Run(normalize_time=False)
duration = run.thermal_governor.data_frame.index[-1] - run.thermal.data_frame.index[0]
@@ -148,7 +148,7 @@
def test_run_normalize_time(self):
"""Run().normalize_time() works accross all classes"""
- run = cr2.Run(normalize_time=False)
+ run = trappy.Run(normalize_time=False)
prev_inpower_basetime = run.cpu_in_power.data_frame.index[0]
prev_inpower_last = run.cpu_in_power.data_frame.index[-1]
@@ -167,7 +167,7 @@
def test_get_all_freqs_data(self):
"""Test get_all_freqs_data()"""
- allfreqs = cr2.Run().get_all_freqs_data(self.map_label)
+ allfreqs = trappy.Run().get_all_freqs_data(self.map_label)
self.assertEquals(allfreqs[1][1]["A53_freq_out"].iloc[3], 850)
self.assertEquals(allfreqs[1][1]["A53_freq_in"].iloc[1], 850)
@@ -180,7 +180,7 @@
def test_plot_freq_hists(self):
"""Test that plot_freq_hists() doesn't bomb"""
- run = cr2.Run()
+ run = trappy.Run()
_, axis = matplotlib.pyplot.subplots(nrows=2)
run.plot_freq_hists(self.map_label, axis)
@@ -188,7 +188,7 @@
def test_plot_load(self):
"""Test that plot_load() doesn't explode"""
- run = cr2.Run()
+ run = trappy.Run()
run.plot_load(self.map_label, title="Util")
_, ax = matplotlib.pyplot.subplots()
@@ -197,7 +197,7 @@
def test_plot_normalized_load(self):
"""Test that plot_normalized_load() doesn't explode"""
- run = cr2.Run()
+ run = trappy.Run()
_, ax = matplotlib.pyplot.subplots()
run.plot_normalized_load(self.map_label, ax=ax)
@@ -205,7 +205,7 @@
def test_plot_allfreqs(self):
"""Test that plot_allfreqs() doesn't bomb"""
- run = cr2.Run()
+ run = trappy.Run()
run.plot_allfreqs(self.map_label)
matplotlib.pyplot.close('all')
@@ -222,13 +222,13 @@
expected_metadata["version"] = "6"
expected_metadata["cpus"] = "6"
- run = cr2.Run()
+ run = trappy.Run()
for key, value in expected_metadata.items():
self.assertTrue(hasattr(run, "_" + key))
self.assertEquals(getattr(run, "_" + key), value)
def test_missing_metadata(self):
- """Test if cr2.Run() works with a trace missing metadata info"""
+ """Test if trappy.Run() works with a trace missing metadata info"""
lines = []
with open("trace.txt", "r") as fil:
@@ -240,7 +240,7 @@
fil.write("".join(lines))
fil.close()
- run = cr2.Run()
+ run = trappy.Run()
self.assertEquals(run._cpus, None)
self.assertEquals(run._version, None)
self.assertTrue(len(run.thermal.data_frame) > 0)
@@ -259,7 +259,7 @@
def test_raw_dat(self):
"""Tests an event that relies on raw parsing"""
- run = cr2.Run()
+ run = trappy.Run()
self.assertTrue(hasattr(run, "sched_switch"))
self.assertTrue(len(run.sched_switch.data_frame) > 0)
self.assertTrue("prev_comm" in run.sched_switch.data_frame.columns)
@@ -270,7 +270,7 @@
arbitrary_name = "my_trace.dat"
shutil.move("trace.dat", arbitrary_name)
- run = cr2.Run(arbitrary_name)
+ run = trappy.Run(arbitrary_name)
self.assertTrue(os.path.isfile("my_trace.raw.txt"))
self.assertTrue(hasattr(run, "sched_switch"))
self.assertTrue(len(run.sched_switch.data_frame) > 0)
@@ -288,7 +288,7 @@
"""test raw parsing for txt files"""
self.assertFalse(os.path.isfile("trace.dat"))
- run = cr2.Run()
+ run = trappy.Run()
self.assertTrue(hasattr(run, "sched_switch"))
self.assertTrue(len(run.sched_switch.data_frame) > 0)
@@ -301,7 +301,7 @@
shutil.move("trace.txt", arbitrary_name)
shutil.move("trace.raw.txt", arbitrary_name_raw)
- run = cr2.Run(arbitrary_name)
+ run = trappy.Run(arbitrary_name)
self.assertTrue(hasattr(run, "sched_switch"))
self.assertTrue(len(run.sched_switch.data_frame) > 0)
@@ -317,7 +317,7 @@
def test_run_basetime_empty(self):
"""Test that basetime is 0 if data frame of all data objects is empty"""
- run = cr2.Run(normalize_time=False)
+ run = trappy.Run(normalize_time=False)
self.assertEqual(run.get_basetime(), 0)
@@ -327,7 +327,7 @@
with open("trace.txt", "a") as fil:
fil.write(" kworker/4:1-1219 [004] 508.424826: thermal_temperature: thermal_zone=exynos-therm id=0 temp_prev=24000 temp=24000")
- run = cr2.Run()
+ run = trappy.Run()
self.assertEqual(run.thermal.data_frame.index[0], 0)
@@ -344,7 +344,7 @@
"""Create trace.txt if it's not there"""
self.assertFalse(os.path.isfile("trace.txt"))
- cr2.Run()
+ trappy.Run()
found = False
with open("trace.txt") as fin:
@@ -359,7 +359,7 @@
"""Create trace.raw.txt if it's not there"""
self.assertFalse(os.path.isfile("trace.raw.txt"))
- cr2.Run()
+ trappy.Run()
found = False
with open("trace.raw.txt") as fin:
@@ -373,7 +373,7 @@
arbitrary_trace_name = "my_trace.dat"
shutil.move("trace.dat", arbitrary_trace_name)
- dfr = cr2.Run(arbitrary_trace_name).thermal.data_frame
+ dfr = trappy.Run(arbitrary_trace_name).thermal.data_frame
self.assertTrue(os.path.exists("my_trace.txt"))
self.assertTrue(os.path.exists("my_trace.raw.txt"))
diff --git a/tests/test_sched.py b/tests/test_sched.py
index 891dce1..35f9fe9 100644
--- a/tests/test_sched.py
+++ b/tests/test_sched.py
@@ -18,9 +18,9 @@
import sys
import utils_tests
-import cr2
+import trappy
-sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "cr2"))
+sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "trappy"))
class BaseTestSched(utils_tests.SetupDirectory):
def __init__(self, *args, **kwargs):
@@ -33,7 +33,7 @@
def test_get_dataframe(self):
"""Test that SchedLoadAvgSchedGroup creates a proper data_frame"""
- dfr = cr2.Run().sched_load_avg_sched_group.data_frame
+ dfr = trappy.Run().sched_load_avg_sched_group.data_frame
self.assertTrue(len(dfr) == 1)
self.assertEquals(dfr["cpus"].iloc[0], "00000002")
@@ -44,7 +44,7 @@
def test_get_dataframe(self):
"""Test that SchedLoadAvgTask creates a proper data_frame"""
- dfr = cr2.Run().sched_load_avg_task.data_frame
+ dfr = trappy.Run().sched_load_avg_task.data_frame
self.assertTrue(len(dfr) == 1)
self.assertEquals(dfr["comm"].iloc[0], "sshd")
@@ -59,7 +59,7 @@
def test_get_dataframe(self):
"""Test that SchedLoadAvgCpu creates a proper data_frame"""
- dfr = cr2.Run().sched_load_avg_cpu.data_frame
+ dfr = trappy.Run().sched_load_avg_cpu.data_frame
self.assertTrue(len(dfr) == 1)
self.assertEquals(dfr["cpu"].iloc[0], 0)
@@ -70,7 +70,7 @@
def test_get_dataframe(self):
"""Test that SchedContribScaleFactor creates a proper data_frame"""
- dfr = cr2.Run().sched_contrib_scale_factor.data_frame
+ dfr = trappy.Run().sched_contrib_scale_factor.data_frame
self.assertTrue(len(dfr) == 1)
self.assertEquals(dfr["cpu"].iloc[0], 0)
@@ -81,7 +81,7 @@
def test_get_dataframe(self):
"""Test that SchedCpuCapacity creates a proper data_frame"""
- dfr = cr2.Run().sched_cpu_capacity.data_frame
+ dfr = trappy.Run().sched_cpu_capacity.data_frame
self.assertTrue(len(dfr) == 1)
self.assertEquals(dfr["cpu"].iloc[0], 3)
@@ -92,7 +92,7 @@
def test_get_dataframe(self):
"""Test that CpuFrequency creates a proper data_frame"""
- dfr = cr2.Run().sched_cpu_frequency.data_frame
+ dfr = trappy.Run().sched_cpu_frequency.data_frame
self.assertTrue(len(dfr) == 1)
self.assertEquals(dfr["cpu"].iloc[0], 0)
@@ -104,7 +104,7 @@
def test_get_filters(self):
"""Test that Run::get_filters returns correct list of filters"""
- run = cr2.Run()
+ run = trappy.Run()
classes = run.class_definitions
filters = run.get_filters()
self.assertTrue(len(classes) == len(filters))
@@ -123,7 +123,7 @@
with open("trace.txt", "a") as fout:
fout.write(" <...>-2971 [004] 6550.056871: sched_load_avg_task: comm=AsyncTask #2 pid=6163 ")
- dfr = cr2.Run().sched_load_avg_task.data_frame
+ dfr = trappy.Run().sched_load_avg_task.data_frame
self.assertTrue(len(dfr) == 2)
self.assertEquals(dfr["comm"].iloc[1], "AsyncTask #2")
self.assertEquals(dfr["pid"].iloc[1], 6163)
@@ -139,7 +139,7 @@
def test_empty_trace_txt(self):
"""Test that empty objects are created with empty trace file"""
- run = cr2.Run()
+ run = trappy.Run()
for attr in run.sched_classes.iterkeys():
self.assertTrue(len(getattr(run, attr).data_frame) == 0)
diff --git a/tests/test_stats_grammar.py b/tests/test_stats_grammar.py
index 5fedce6..7db42c5 100644
--- a/tests/test_stats_grammar.py
+++ b/tests/test_stats_grammar.py
@@ -15,8 +15,8 @@
from test_thermal import BaseTestThermal
-import cr2
-from cr2.stats.grammar import Parser
+import trappy
+from trappy.stats.grammar import Parser
from pandas.util.testing import assert_series_equal
import numpy as np
@@ -29,7 +29,7 @@
def test_sum_operator(self):
"""Test Addition And Subtraction: Numeric"""
- parser = Parser(cr2.Run())
+ parser = Parser(trappy.Run())
# Simple equation
eqn = "10 + 2 - 3"
self.assertEquals(parser.solve(eqn), 9)
@@ -40,10 +40,10 @@
def test_accessors_sum(self):
"""Test Addition And Subtraction: Data"""
- parser = Parser(cr2.Run())
+ parser = Parser(trappy.Run())
# Equation with dataframe accessors
- eqn = "cr2.thermal.Thermal:temp + \
-cr2.thermal.Thermal:temp"
+ eqn = "trappy.thermal.Thermal:temp + \
+trappy.thermal.Thermal:temp"
assert_series_equal(
parser.solve(eqn),
2 *
@@ -52,16 +52,16 @@
def test_funcparams_sum(self):
"""Test Addition And Subtraction: Functions"""
- parser = Parser(cr2.Run())
+ parser = Parser(trappy.Run())
# Equation with functions as parameters (Mixed)
- eqn = "numpy.mean(cr2.thermal.Thermal:temp) + 1000"
+ eqn = "numpy.mean(trappy.thermal.Thermal:temp) + 1000"
self.assertEquals(
parser.solve(eqn),
np.mean(
parser.data.thermal.data_frame["temp"]) +
1000)
# Multiple func params
- eqn = "numpy.mean(cr2.thermal.Thermal:temp) + numpy.mean(cr2.thermal.Thermal:temp)"
+ eqn = "numpy.mean(trappy.thermal.Thermal:temp) + numpy.mean(trappy.thermal.Thermal:temp)"
self.assertEquals(
parser.solve(eqn),
np.mean(
@@ -72,12 +72,12 @@
"""Test Logical Operations: Vector"""
# The equation returns a vector mask
- parser = Parser(cr2.Run())
- eqn = "(cr2.thermal.Thermal:temp > 40000) & (cr2.cpu_power.CpuOutPower:power > 800)"
+ parser = Parser(trappy.Run())
+ eqn = "(trappy.thermal.Thermal:temp > 40000) & (trappy.cpu_power.CpuOutPower:power > 800)"
mask = parser.solve(eqn)
res = parser.ref(mask)
self.assertEquals(len(res), 67)
- eqn = "(cr2.thermal.Thermal:temp > 69000) | (cr2.cpu_power.CpuOutPower:power < 800)"
+ eqn = "(trappy.thermal.Thermal:temp > 69000) | (trappy.cpu_power.CpuOutPower:power < 800)"
mask = parser.solve(eqn)
res = parser.ref(~mask)
self.assertTrue(len(res), 17)
@@ -85,18 +85,18 @@
def test_bool_ops_scalar(self):
"""Test Logical Operations: Vector"""
- parser = Parser(cr2.Run())
+ parser = Parser(trappy.Run())
# The equation returns a boolean scalar
- eqn = "(numpy.mean(cr2.thermal.Thermal:temp) > 65000) && (numpy.mean(cr2.cpu_power.CpuOutPower) > 500)"
+ eqn = "(numpy.mean(trappy.thermal.Thermal:temp) > 65000) && (numpy.mean(trappy.cpu_power.CpuOutPower) > 500)"
self.assertTrue(parser.solve(eqn))
- eqn = "(numpy.mean(cr2.thermal.Thermal:temp) > 65000) || (numpy.mean(cr2.cpu_power.CpuOutPower) < 500)"
+ eqn = "(numpy.mean(trappy.thermal.Thermal:temp) > 65000) || (numpy.mean(trappy.cpu_power.CpuOutPower) < 500)"
self.assertTrue(parser.solve(eqn))
def test_single_func_call(self):
"""Test Single Function Call"""
- parser = Parser(cr2.Run())
- eqn = "numpy.mean(cr2.thermal.Thermal:temp)"
+ parser = Parser(trappy.Run())
+ eqn = "numpy.mean(trappy.thermal.Thermal:temp)"
self.assertEquals(
parser.solve(eqn),
np.mean(
@@ -105,7 +105,7 @@
def test_mul_ops(self):
"""Test Mult and Division: Numeric"""
- parser = Parser(cr2.Run())
+ parser = Parser(trappy.Run())
eqn = "(10 * 2 / 10)"
self.assertEquals(parser.solve(eqn), 2)
eqn = "-2 * 2 + 2 * 10 / 10"
@@ -114,11 +114,11 @@
def test_funcparams_mul(self):
"""Test Mult and Division: Data"""
- parser = Parser(cr2.Run())
- eqn = "cr2.thermal.Thermal:temp * 10.0"
+ parser = Parser(trappy.Run())
+ eqn = "trappy.thermal.Thermal:temp * 10.0"
series = parser.data.thermal.data_frame["temp"]
assert_series_equal(parser.solve(eqn), series * 10.0)
- eqn = "cr2.thermal.Thermal:temp / cr2.thermal.Thermal:temp * 10"
+ eqn = "trappy.thermal.Thermal:temp / trappy.thermal.Thermal:temp * 10"
assert_series_equal(parser.solve(eqn), series / series * 10)
def test_var_forward(self):
@@ -126,8 +126,8 @@
pvars = {}
pvars["control_temp"] = 78000
- parser = Parser(cr2.Run(), pvars=pvars)
- eqn = "numpy.mean(cr2.thermal.Thermal:temp) < control_temp"
+ parser = Parser(trappy.Run(), pvars=pvars)
+ eqn = "numpy.mean(trappy.thermal.Thermal:temp) < control_temp"
self.assertTrue(parser.solve(eqn))
def test_func_forward(self):
@@ -136,19 +136,19 @@
pvars = {}
pvars["mean"] = np.mean
pvars["control_temp"] = 78000
- parser = Parser(cr2.Run(), pvars=pvars)
- eqn = "mean(cr2.thermal.Thermal:temp) < control_temp"
+ parser = Parser(trappy.Run(), pvars=pvars)
+ eqn = "mean(trappy.thermal.Thermal:temp) < control_temp"
self.assertTrue(parser.solve(eqn))
def test_cls_forward(self):
"""Test Forwarding: Classes"""
- cls = cr2.thermal.Thermal
+ cls = trappy.thermal.Thermal
pvars = {}
pvars["mean"] = np.mean
pvars["control_temp"] = 78000
pvars["therm"] = cls
- parser = Parser(cr2.Run(), pvars=pvars)
+ parser = Parser(trappy.Run(), pvars=pvars)
eqn = "mean(therm:temp) < control_temp"
self.assertTrue(parser.solve(eqn))
diff --git a/tests/test_thermal.py b/tests/test_thermal.py
index bc7d71f..5bec61d 100644
--- a/tests/test_thermal.py
+++ b/tests/test_thermal.py
@@ -23,9 +23,9 @@
import tempfile
import utils_tests
-import cr2
+import trappy
-sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "cr2"))
+sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "trappy"))
class BaseTestThermal(utils_tests.SetupDirectory):
def __init__(self, *args, **kwargs):
@@ -44,7 +44,7 @@
"""
- th_data = cr2.Run().thermal
+ th_data = trappy.Run().thermal
dfr = th_data.data_frame
ct_series = pd.Series([57, 57], index=(dfr.index[0], dfr.index[-1]))
@@ -65,7 +65,7 @@
"""Test that plot_temperature_hist() doesn't bomb"""
_, ax = matplotlib.pyplot.subplots()
- cr2.Run().thermal.plot_temperature_hist(ax, "Foo")
+ trappy.Run().thermal.plot_temperature_hist(ax, "Foo")
matplotlib.pyplot.close('all')
class TestThermalGovernor(BaseTestThermal):
@@ -74,7 +74,7 @@
self.actor_order = ["GPU", "A15", "A7"]
def test_get_dataframe(self):
- dfr = cr2.Run().thermal_governor.data_frame
+ dfr = trappy.Run().thermal_governor.data_frame
self.assertTrue(len(dfr) > 0)
self.assertEquals(dfr["current_temperature"].iloc[0], 68775)
@@ -85,7 +85,7 @@
"""Test ThermalGovernor.plot_temperature()
Can't check that the graph is ok, so just see that the method doesn't blow up"""
- gov = cr2.Run().thermal_governor
+ gov = trappy.Run().thermal_governor
gov.plot_temperature()
gov.plot_temperature(legend_label="power allocator", ylim=(0, 72))
@@ -93,7 +93,7 @@
def test_plot_input_power(self):
"""plot_input_power() doesn't bomb"""
- gov = cr2.Run().thermal_governor
+ gov = trappy.Run().thermal_governor
gov.plot_input_power(self.actor_order)
matplotlib.pyplot.close('all')
@@ -108,7 +108,7 @@
def test_plot_weighted_input_power(self):
"""plot_weighted_input_power() doesn't bomb"""
- gov = cr2.Run().thermal_governor
+ gov = trappy.Run().thermal_governor
weights = zip(self.actor_order, [1024, 256, 512])
_, ax = matplotlib.pyplot.subplots()
@@ -119,7 +119,7 @@
"""Test plot_output_power()
Can't check that the graph is ok, so just see that the method doesn't blow up"""
- gov = cr2.Run().thermal_governor
+ gov = trappy.Run().thermal_governor
gov.plot_output_power(self.actor_order)
matplotlib.pyplot.close('all')
@@ -135,8 +135,8 @@
"""Test plot_inout_power()
Can't check that the graph is ok, so just see that the method doesn't blow up"""
- cr2.Run().thermal_governor.plot_inout_power()
- cr2.Run().thermal_governor.plot_inout_power(title="Antutu")
+ trappy.Run().thermal_governor.plot_inout_power()
+ trappy.Run().thermal_governor.plot_inout_power(title="Antutu")
matplotlib.pyplot.close('all')
class TestEmptyThermalGovernor(unittest.TestCase):
@@ -171,11 +171,11 @@
shutil.rmtree(self.out_dir)
def test_empty_trace_txt(self):
- dfr = cr2.Run(normalize_time=False).thermal_governor.data_frame
+ dfr = trappy.Run(normalize_time=False).thermal_governor.data_frame
self.assertEquals(len(dfr), 0)
def test_empty_plot_temperature(self):
"""run.thermal.plot_temperature() raises ValueError() on an empty
thermal trace"""
- run = cr2.Run()
+ run = trappy.Run()
self.assertRaises(ValueError, run.thermal.plot_temperature)
diff --git a/tests/test_cr2.py b/tests/test_trappy.py
similarity index 81%
rename from tests/test_cr2.py
rename to tests/test_trappy.py
index 920ecf1..c0b8367 100644
--- a/tests/test_cr2.py
+++ b/tests/test_trappy.py
@@ -18,12 +18,12 @@
import re
import matplotlib, tempfile
-import cr2
+import trappy
from test_thermal import BaseTestThermal
-class TestCR2(BaseTestThermal):
+class TestTrappy(BaseTestThermal):
def __init__(self, *args, **kwargs):
- super(TestCR2, self).__init__(*args, **kwargs)
+ super(TestTrappy, self).__init__(*args, **kwargs)
self.map_label = {"00000000,00000039": "A53", "00000000,00000006": "A57"}
self.actor_order = ["GPU", "A57", "A53"]
@@ -32,21 +32,21 @@
Can't check that the graphs are ok, so just see that the method doesn't blow up"""
- cr2.summary_plots(self.actor_order, self.map_label)
+ trappy.summary_plots(self.actor_order, self.map_label)
matplotlib.pyplot.close('all')
- cr2.summary_plots(self.actor_order, self.map_label, width=14,
+ trappy.summary_plots(self.actor_order, self.map_label, width=14,
title="Foo")
matplotlib.pyplot.close('all')
def test_summary_plots_bad_parameters(self):
"""When summary_plots() receives bad parameters, it offers an understandable error"""
- self.assertRaises(TypeError, cr2.summary_plots,
+ self.assertRaises(TypeError, trappy.summary_plots,
(self.map_label, self.actor_order))
try:
- cr2.summary_plots(self.map_label, self.actor_order)
+ trappy.summary_plots(self.map_label, self.actor_order)
self.fail()
except TypeError as exception:
pass
@@ -54,7 +54,7 @@
self.assertTrue("actor_order" in str(exception))
try:
- cr2.summary_plots(self.actor_order, self.actor_order)
+ trappy.summary_plots(self.actor_order, self.actor_order)
self.fail()
except TypeError as exception:
pass
@@ -67,7 +67,7 @@
other_random_dir = tempfile.mkdtemp()
os.chdir(other_random_dir)
- cr2.summary_plots(self.actor_order, self.map_label, path=self.out_dir)
+ trappy.summary_plots(self.actor_order, self.map_label, path=self.out_dir)
matplotlib.pyplot.close('all')
# Sanity check that the test actually ran from another directory
@@ -87,7 +87,7 @@
with open("trace.txt", "w") as fout:
fout.write(trace_out)
- cr2.summary_plots(self.actor_order, self.map_label)
+ trappy.summary_plots(self.actor_order, self.map_label)
matplotlib.pyplot.close('all')
def test_summary_plots_no_gpu(self):
@@ -104,13 +104,13 @@
with open("trace.txt", "w") as fout:
fout.write(trace_out)
- cr2.summary_plots(self.actor_order, self.map_label)
+ trappy.summary_plots(self.actor_order, self.map_label)
matplotlib.pyplot.close('all')
def test_compare_runs(self):
"""Basic compare_runs() functionality"""
- cr2.compare_runs(self.actor_order, self.map_label,
+ trappy.compare_runs(self.actor_order, self.map_label,
runs=[("new", "."), ("old", self.out_dir)])
matplotlib.pyplot.close('all')
diff --git a/tests/test_wa_sysfs_extractor.py b/tests/test_wa_sysfs_extractor.py
index b726542..3ebec67 100644
--- a/tests/test_wa_sysfs_extractor.py
+++ b/tests/test_wa_sysfs_extractor.py
@@ -20,7 +20,7 @@
import utils_tests
-import cr2.wa
+import trappy.wa
class TestWASysfsExtractor(utils_tests.SetupDirectory):
"""Test the WA specific interface to get parameters from a sysfs extractor"""
@@ -38,7 +38,7 @@
"""Test that we can get the parameters of a sysfs extractor output"""
os.chdir("..")
- thermal_params = cr2.wa.SysfsExtractor(self.out_dir).get_parameters()
+ thermal_params = trappy.wa.SysfsExtractor(self.out_dir).get_parameters()
self.assertEquals(thermal_params["cdev0_weight"], 1024)
self.assertEquals(thermal_params["cdev1_weight"], 768)
self.assertEquals(thermal_params["trip_point_0_temp"], 72000)
@@ -47,15 +47,15 @@
def test_print_thermal_params(self):
"""Test that printing the thermal params doesn't bomb"""
- cr2.wa.SysfsExtractor(".").pretty_print_in_ipython()
+ trappy.wa.SysfsExtractor(".").pretty_print_in_ipython()
class TestWASysfsExtractorFailMode(unittest.TestCase):
"""Test the failure modes of the Workload Automation sysfs extractor"""
def test_get_params_invalid_directory(self):
- """An invalid directory for cr2.wa.SysfsExtractor doesn't bomb"""
+ """An invalid directory for trappy.wa.SysfsExtractor doesn't bomb"""
- sysfs_extractor = cr2.wa.SysfsExtractor(".")
+ sysfs_extractor = trappy.wa.SysfsExtractor(".")
self.assertEquals(sysfs_extractor.get_parameters(), {})
sysfs_extractor.pretty_print_in_ipython()
diff --git a/tests/trappy b/tests/trappy
new file mode 120000
index 0000000..33a15b9
--- /dev/null
+++ b/tests/trappy
@@ -0,0 +1 @@
+../trappy
\ No newline at end of file