aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris Redpath <chris.redpath@arm.com>2017-06-20 22:35:41 +0100
committerKP Singh <kpsingh@google.com>2017-06-27 12:11:02 +0200
commitff851bdbb123bfb40bf0b4657a7409d51d322943 (patch)
tree9e19949585eda295f17d9b2a9f25d6b10213c7e3 /tests
parentef596e5739b2e0946cbdfea09da09a314879dca8 (diff)
downloadtrappy-ff851bdbb123bfb40bf0b4657a7409d51d322943.tar.gz
trappy/test: fix tests for removal of raw.txt trace parsing
tests/test_ftrace.py: Stop creating and checking for existence of <trace>.raw.txt files. tests/test_sched.py: Stop creating raw.txt file. tests/raw_trace.raw.txt: Remove the file as it is no longer needed. The raw-formatted events are moved into raw_trace.txt tests/raw_trace.txt: Replace the formatted sched_switch events with raw formatted events, like we get when parsing a trace file. tests/trace_empty.txt: Remove the default sched_ events we would expect to parse in raw format - since we want to have events here which we are not looking for. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Reviewed-by: KP Singh <kpsingh@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/raw_trace.raw.txt7
-rw-r--r--tests/raw_trace.txt6
-rw-r--r--tests/test_ftrace.py34
-rw-r--r--tests/test_sched.py3
-rw-r--r--tests/trace_empty.txt32
5 files changed, 5 insertions, 77 deletions
diff --git a/tests/raw_trace.raw.txt b/tests/raw_trace.raw.txt
deleted file mode 100644
index f66d55b..0000000
--- a/tests/raw_trace.raw.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-version = 6
-CPU 3 is empty
-CPU 4 is empty
-cpus=6
- ls-4734 [002] 106439.675591: sched_switch: prev_comm=trace-cmd prev_pid=4734 prev_prio=120 prev_state=1024 next_comm=migration/2 next_pid=18 next_prio=0
- migration/2-18 [002] 106439.675613: sched_switch: prev_comm=migration/2 prev_pid=18 prev_prio=0 prev_state=1 next_comm=trace-cmd next_pid=4732 next_prio=120
- trace-cmd-4730 [001] 106439.675718: sched_switch: prev_comm=trace-cmd prev_pid=4730 prev_prio=120 prev_state=1 next_comm=trace-cmd next_pid=4729 next_prio=120
diff --git a/tests/raw_trace.txt b/tests/raw_trace.txt
index 4fbf4c9..f66d55b 100644
--- a/tests/raw_trace.txt
+++ b/tests/raw_trace.txt
@@ -2,6 +2,6 @@ version = 6
CPU 3 is empty
CPU 4 is empty
cpus=6
- ls-4734 [002] 106439.675591: sched_switch: trace-cmd:4734 [120] R ==> migration/2:18 [0]
- migration/2-18 [002] 106439.675613: sched_switch: migration/2:18 [0] S ==> trace-cmd:4732 [120]
- trace-cmd-4731 [001] 106439.675698: sched_switch: trace-cmd:4731 [120] S ==> trace-cmd:4730 [120]
+ ls-4734 [002] 106439.675591: sched_switch: prev_comm=trace-cmd prev_pid=4734 prev_prio=120 prev_state=1024 next_comm=migration/2 next_pid=18 next_prio=0
+ migration/2-18 [002] 106439.675613: sched_switch: prev_comm=migration/2 prev_pid=18 prev_prio=0 prev_state=1 next_comm=trace-cmd next_pid=4732 next_prio=120
+ trace-cmd-4730 [001] 106439.675718: sched_switch: prev_comm=trace-cmd prev_pid=4730 prev_prio=120 prev_state=1 next_comm=trace-cmd next_pid=4729 next_prio=120
diff --git a/tests/test_ftrace.py b/tests/test_ftrace.py
index 91ea8e3..7d7874a 100644
--- a/tests/test_ftrace.py
+++ b/tests/test_ftrace.py
@@ -352,34 +352,14 @@ class TestFTraceRawDat(utils_tests.SetupDirectory):
shutil.move("trace.dat", arbitrary_name)
trace = trappy.FTrace(arbitrary_name)
- self.assertTrue(os.path.isfile("my_trace.raw.txt"))
self.assertTrue(hasattr(trace, "sched_switch"))
self.assertTrue(len(trace.sched_switch.data_frame) > 0)
- def test_raw_created_if_dat_and_txt_exist(self):
- """trace.raw.txt is created when both trace.dat and trace.txt exist"""
-
- # Create the trace.txt
- cmd = ["trace-cmd", "report", "trace.dat"]
- with open(os.devnull) as devnull:
- out = subprocess.check_output(cmd, stderr=devnull)
-
- with open("trace.txt", "w") as fout:
- fout.write(out)
-
- # Now check that the raw trace is created and analyzed when creating the trace
- trace = trappy.FTrace()
-
- self.assertTrue(hasattr(trace, "sched_switch"))
- self.assertTrue(len(trace.sched_switch.data_frame) > 0)
- self.assertTrue("prev_comm" in trace.sched_switch.data_frame.columns)
-
class TestFTraceRawBothTxt(utils_tests.SetupDirectory):
def __init__(self, *args, **kwargs):
super(TestFTraceRawBothTxt, self).__init__(
- [("raw_trace.txt", "trace.txt"),
- ("raw_trace.raw.txt", "trace.raw.txt")],
+ [("raw_trace.txt", "trace.txt"),],
*args,
**kwargs)
@@ -395,10 +375,8 @@ class TestFTraceRawBothTxt(utils_tests.SetupDirectory):
"""Test raw parsing for txt files arbitrary name"""
arbitrary_name = "my_trace.txt"
- arbitrary_name_raw = "my_trace.raw.txt"
shutil.move("trace.txt", arbitrary_name)
- shutil.move("trace.raw.txt", arbitrary_name_raw)
trace = trappy.FTrace(arbitrary_name)
self.assertTrue(hasattr(trace, "sched_switch"))
@@ -475,14 +453,6 @@ class TestTraceDat(utils_tests.SetupDirectory):
self.assert_thermal_in_trace("trace.txt")
- def test_do_raw_txt_if_not_there(self):
- """Create trace.raw.txt if it's not there"""
- self.assertFalse(os.path.isfile("trace.raw.txt"))
-
- trappy.FTrace()
-
- self.assert_thermal_in_trace("trace.raw.txt")
-
def test_ftrace_arbitrary_trace_dat(self):
"""FTrace() works if asked to parse a binary trace with a filename other than trace.dat"""
arbitrary_trace_name = "my_trace.dat"
@@ -491,11 +461,9 @@ class TestTraceDat(utils_tests.SetupDirectory):
dfr = trappy.FTrace(arbitrary_trace_name).thermal.data_frame
self.assertTrue(os.path.exists("my_trace.txt"))
- self.assertTrue(os.path.exists("my_trace.raw.txt"))
self.assertTrue(len(dfr) > 0)
self.assertFalse(os.path.exists("trace.dat"))
self.assertFalse(os.path.exists("trace.txt"))
- self.assertFalse(os.path.exists("trace.raw.txt"))
def test_regenerate_txt_if_outdated(self):
"""Regenerate the trace.txt if it's older than the trace.dat"""
diff --git a/tests/test_sched.py b/tests/test_sched.py
index 6527779..89375c8 100644
--- a/tests/test_sched.py
+++ b/tests/test_sched.py
@@ -25,8 +25,7 @@ sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "trappy"))
class BaseTestSched(utils_tests.SetupDirectory):
def __init__(self, *args, **kwargs):
super(BaseTestSched, self).__init__(
- [("trace_sched.txt", "trace.txt"),
- ("trace_sched.txt", "trace.raw.txt")],
+ [("trace_sched.txt", "trace.txt"),],
*args,
**kwargs)
diff --git a/tests/trace_empty.txt b/tests/trace_empty.txt
index b35ba6f..8bf02f0 100644
--- a/tests/trace_empty.txt
+++ b/tests/trace_empty.txt
@@ -2,84 +2,52 @@ version = 6
cpus=5
trace-cmd-2461 [000] 34.896920: sched_stat_runtime: comm=trace-cmd pid=2461 runtime=7778999 [ns] vruntime=6087430069 [ns]
trace-cmd-2461 [000] 34.896941: sched_stat_sleep: comm=sshd pid=2450 delay=1802051076 [ns]
- trace-cmd-2461 [000] 34.896972: sched_wakeup: sshd:2450 [120] success=1 CPU:000
trace-cmd-2461 [000] 34.897022: sched_stat_wait: comm=sshd pid=2450 delay=0 [ns]
- trace-cmd-2461 [000] 34.897053: sched_switch: trace-cmd:2461 [120] R ==> sshd:2450 [120]
<idle>-0 [001] 34.897147: sched_stat_wait: comm=rcuos/0 pid=9 delay=0 [ns]
- <idle>-0 [001] 34.897153: sched_switch: swapper/1:0 [120] R ==> rcuos/0:9 [120]
rcuos/0-9 [001] 34.897169: sched_stat_runtime: comm=sshd pid=2450 runtime=258292 [ns] vruntime=6078688361 [ns]
rcuos/0-9 [001] 34.897175: sched_stat_sleep: comm=rcu_sched pid=7 delay=26617125 [ns]
- rcuos/0-9 [001] 34.897182: sched_wakeup: rcu_sched:7 [120] success=1 CPU:000
rcuos/0-9 [001] 34.897186: sched_stat_runtime: comm=rcuos/0 pid=9 runtime=445750 [ns] vruntime=6730976621 [ns]
- rcuos/0-9 [001] 34.897230: sched_switch: rcuos/0:9 [120] S ==> swapper/1:0 [120]
sshd-2450 [000] 34.897303: sched_stat_runtime: comm=sshd pid=2450 runtime=134042 [ns] vruntime=6078822403 [ns]
sshd-2450 [000] 34.897313: sched_stat_wait: comm=rcu_sched pid=7 delay=134042 [ns]
- sshd-2450 [000] 34.897319: sched_switch: sshd:2450 [120] S ==> rcu_sched:7 [120]
rcu_sched-7 [000] 34.897329: sched_stat_runtime: comm=rcu_sched pid=7 runtime=25916 [ns] vruntime=6078455985 [ns]
rcu_sched-7 [000] 34.897338: sched_stat_wait: comm=trace-cmd pid=2461 delay=418250 [ns]
- rcu_sched-7 [000] 34.897343: sched_switch: rcu_sched:7 [120] S ==> trace-cmd:2461 [120]
trace-cmd-2461 [000] 34.897641: sched_process_exit: comm=trace-cmd pid=2461 prio=120
trace-cmd-2461 [000] 34.897665: sched_stat_runtime: comm=trace-cmd pid=2461 runtime=335875 [ns] vruntime=6087765944 [ns]
trace-cmd-2461 [000] 34.897675: sched_stat_runtime: comm=trace-cmd pid=2461 runtime=10459 [ns] vruntime=6087776403 [ns]
trace-cmd-2461 [000] 34.897697: sched_stat_sleep: comm=bash pid=2459 delay=696151164 [ns]
- trace-cmd-2461 [000] 34.897703: sched_wakeup: bash:2459 [120] success=1 CPU:001
trace-cmd-2461 [000] 34.897708: sched_stat_runtime: comm=trace-cmd pid=2461 runtime=33500 [ns] vruntime=6087809903 [ns]
- trace-cmd-2461 [000] 34.897738: sched_switch: trace-cmd:2461 [120] x ==> swapper/0:0 [120]
<idle>-0 [001] 34.898076: sched_stat_wait: comm=bash pid=2459 delay=0 [ns]
- <idle>-0 [001] 34.898082: sched_switch: swapper/1:0 [120] R ==> bash:2459 [120]
bash-2459 [001] 34.898188: sched_process_wait: comm=bash pid=0 prio=120
bash-2459 [001] 34.898653: sched_process_exit: comm=bash pid=2459 prio=120
bash-2459 [001] 34.898702: sched_stat_sleep: comm=sshd pid=2450 delay=1394541 [ns]
- bash-2459 [001] 34.898708: sched_wakeup: sshd:2450 [120] success=1 CPU:000
<idle>-0 [000] 34.898720: sched_stat_wait: comm=sshd pid=2450 delay=0 [ns]
bash-2459 [001] 34.898721: sched_stat_runtime: comm=bash pid=2459 runtime=1027542 [ns] vruntime=6723004163 [ns]
- <idle>-0 [000] 34.898726: sched_switch: swapper/0:0 [120] R ==> sshd:2450 [120]
bash-2459 [001] 34.898732: sched_stat_runtime: comm=bash pid=2459 runtime=11000 [ns] vruntime=6723015163 [ns]
bash-2459 [001] 34.898745: sched_stat_runtime: comm=bash pid=2459 runtime=13458 [ns] vruntime=6723028621 [ns]
- bash-2459 [001] 34.898758: sched_switch: bash:2459 [120] x ==> swapper/1:0 [120]
sshd-2450 [000] 34.898825: sched_process_wait: comm=sshd pid=0 prio=120
sshd-2450 [000] 34.898927: sched_process_wait: comm=sshd pid=0 prio=120
sshd-2450 [000] 34.898983: sched_stat_runtime: comm=sshd pid=2450 runtime=285875 [ns] vruntime=6079108278 [ns]
- sshd-2450 [000] 34.898996: sched_switch: sshd:2450 [120] S ==> swapper/0:0 [120]
<idle>-0 [000] 34.899144: sched_stat_sleep: comm=rcu_sched pid=7 delay=1810584 [ns]
- <idle>-0 [000] 34.899149: sched_wakeup: rcu_sched:7 [120] success=1 CPU:000
<idle>-0 [000] 34.899175: sched_stat_wait: comm=rcu_sched pid=7 delay=0 [ns]
- <idle>-0 [000] 34.899180: sched_switch: swapper/0:0 [120] R ==> rcu_sched:7 [120]
rcu_sched-7 [000] 34.899194: sched_stat_sleep: comm=rcuos/0 pid=9 delay=2004042 [ns]
- rcu_sched-7 [000] 34.899200: sched_wakeup: rcuos/0:9 [120] success=1 CPU:001
rcu_sched-7 [000] 34.899205: sched_stat_runtime: comm=rcu_sched pid=7 runtime=65375 [ns] vruntime=6078875278 [ns]
- rcu_sched-7 [000] 34.899216: sched_switch: rcu_sched:7 [120] S ==> swapper/0:0 [120]
<idle>-0 [001] 34.899620: sched_stat_wait: comm=rcuos/0 pid=9 delay=0 [ns]
- <idle>-0 [001] 34.899628: sched_switch: swapper/1:0 [120] R ==> rcuos/0:9 [120]
rcuos/0-9 [001] 34.899770: sched_stat_sleep: comm=rcu_sched pid=7 delay=538708 [ns]
- rcuos/0-9 [001] 34.899807: sched_wakeup: rcu_sched:7 [120] success=1 CPU:000
rcuos/0-9 [001] 34.899848: sched_stat_runtime: comm=rcuos/0 pid=9 runtime=653458 [ns] vruntime=6731630079 [ns]
- rcuos/0-9 [001] 34.899877: sched_switch: rcuos/0:9 [120] S ==> swapper/1:0 [120]
<idle>-0 [000] 34.899988: sched_stat_sleep: comm=sshd pid=2450 delay=1003959 [ns]
- <idle>-0 [000] 34.899995: sched_wakeup: sshd:2450 [120] success=1 CPU:001
<idle>-0 [000] 34.900052: sched_stat_wait: comm=rcu_sched pid=7 delay=0 [ns]
- <idle>-0 [000] 34.900058: sched_switch: swapper/0:0 [120] R ==> rcu_sched:7 [120]
rcu_sched-7 [000] 34.900069: sched_stat_runtime: comm=rcu_sched pid=7 runtime=325042 [ns] vruntime=6079200320 [ns]
- rcu_sched-7 [000] 34.900086: sched_switch: rcu_sched:7 [120] S ==> swapper/0:0 [120]
<idle>-0 [001] 34.900452: sched_stat_wait: comm=sshd pid=2450 delay=0 [ns]
- <idle>-0 [001] 34.900460: sched_switch: swapper/1:0 [120] R ==> sshd:2450 [120]
sshd-2450 [001] 34.900756: sched_stat_sleep: comm=in:imuxsock pid=1767 delay=1926798326 [ns]
- sshd-2450 [001] 34.900767: sched_wakeup: in:imuxsock:1767 [120] success=1 CPU:000
<idle>-0 [000] 34.901148: sched_stat_wait: comm=in:imuxsock pid=1767 delay=0 [ns]
- <idle>-0 [000] 34.901155: sched_switch: swapper/0:0 [120] R ==> in:imuxsock:1767 [120]
in:imuxsock-1767 [000] 34.901243: sched_stat_runtime: comm=in:imuxsock pid=1767 runtime=496084 [ns] vruntime=6079305987 [ns]
in:imuxsock-1767 [000] 34.901250: sched_stat_sleep: comm=rs:main Q:Reg pid=1769 delay=1925639660 [ns]
- in:imuxsock-1767 [000] 34.901256: sched_wakeup: rs:main Q:Reg:1769 [120] success=1 CPU:000
in:imuxsock-1767 [000] 34.901271: sched_stat_runtime: comm=in:imuxsock pid=1767 runtime=28500 [ns] vruntime=6079334487 [ns]
in:imuxsock-1767 [000] 34.901282: sched_stat_wait: comm=rs:main Q:Reg pid=1769 delay=28500 [ns]
- in:imuxsock-1767 [000] 34.901287: sched_switch: in:imuxsock:1767 [120] S ==> rs:main Q:Reg:1769 [120]
sshd-2450 [001] 34.901431: sched_stat_runtime: comm=rs:main Q:Reg pid=1769 runtime=160500 [ns] vruntime=6078970403 [ns]
sshd-2450 [001] 34.901437: sched_stat_sleep: comm=in:imuxsock pid=1767 delay=160500 [ns]
- sshd-2450 [001] 34.901443: sched_wakeup: in:imuxsock:1767 [120] success=1 CPU:000
rs:main-1769 [000] 34.901447: sched_stat_runtime: comm=rs:main Q:Reg pid=1769 runtime=15833 [ns] vruntime=6078986236 [ns]
rs:main-1769 [000] 34.901457: sched_stat_wait: comm=in:imuxsock pid=1767 delay=15833 [ns]
- rs:main-1769 [000] 34.901462: sched_switch: rs:main Q:Reg:1769 [120] S ==> in:imuxsock:1767 [120]
in:imuxsock-1767 [000] 34.901490: sched_stat_runtime: comm=in:imuxsock pid=1767 runtime=43125 [ns] vruntime=6079377612 [ns]
in:imuxsock-1767 [000] 34.901495: sched_stat_sleep: comm=rs:main Q:Reg pid=1769 delay=43125 [ns]
- in:imuxsock-1767 [000] 34.901501: sched_wakeup: rs:main Q:Reg:1769 [120] success=1 CPU:000
in:imuxsock-1767 [000] 34.901511: sched_stat_runtime: comm=in:imuxsock pid=1767 runtime=21333 [ns] vruntime=6079398945 [ns]