linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 4/4] trace-cruncher: Add tests for sorted events/systems
Date: Tue, 31 Aug 2021 15:53:57 +0300	[thread overview]
Message-ID: <20210831125357.56862-4-y.karadz@gmail.com> (raw)
In-Reply-To: <20210831125357.56862-1-y.karadz@gmail.com>

An optional parameter 'sort' was added to available_event_systems()
and available_system_events(). Here we add the corresponding test
cases.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 .../tests/1_unit/test_01_ftracepy_unit.py          | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py b/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py
index 971fd5f..710d3e1 100644
--- a/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py
+++ b/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py
@@ -111,19 +111,23 @@ class TracersTestCase(unittest.TestCase):
 
 class EventsTestCase(unittest.TestCase):
     def test_available_systems(self):
-        systems = ft.available_event_systems()
-        self.assertTrue(len(systems) > 1)
+        systems = ft.available_event_systems(sort=True)
+        self.assertTrue(len(systems) > 2)
         self.assertTrue('sched' in systems)
+        for i in range(len(systems) - 2):
+            self.assertTrue(systems[i] < systems[i + 1])
 
         inst = ft.create_instance(instance_name)
         systems = ft.available_event_systems(inst)
-        self.assertTrue(len(systems) > 1)
+        self.assertTrue(len(systems) > 2)
         self.assertTrue('sched' in systems)
 
     def test_available_system_events(self):
-        events = ft.available_system_events(system='sched')
-        self.assertTrue(len(events) > 1)
+        events = ft.available_system_events(system='sched', sort=True)
+        self.assertTrue(len(events) > 2)
         self.assertTrue('sched_switch' in events)
+        for i in range(len(events) - 2):
+            self.assertTrue(events[i] < events[i + 1])
 
         inst = ft.create_instance(instance_name)
         events = ft.available_system_events(instance=inst,
-- 
2.30.2


      parent reply	other threads:[~2021-08-31 12:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 12:53 [PATCH 1/4] trace-cruncher: Add optional sort to tfs_list2py_list() Yordan Karadzhov (VMware)
2021-08-31 12:53 ` [PATCH 2/4] trace-cruncher: Add optional sort to available_system_events() Yordan Karadzhov (VMware)
2021-08-31 12:53 ` [PATCH 3/4] trace-cruncher: Add optional sort to available_event_systems() Yordan Karadzhov (VMware)
2021-08-31 12:53 ` Yordan Karadzhov (VMware) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831125357.56862-4-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).