public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] test-types-stability: parallelize test case alternatives
@ 2020-04-29 15:28 Matthias Maennich
  2020-04-29 15:28 ` [PATCH 2/2] tests: reorder test execution to optimize 'make check' runtime Matthias Maennich
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matthias Maennich @ 2020-04-29 15:28 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, kernel-team, maennich, Mark Wielaard

Commit a9f5fb408946 ("Add --no-write-default-sizes option.") introduced
a new test variant for test-types-stability that is actually independent
of the original test case in terms of execution. Hence it can be
expressed as a separate test case. So, do that by parametrizing the
test_task struct with a new no_default_sizes flag and schedule a
separate test case in the main loop.

That test runs now ~twice as fast dropping from roughly 20s on my
machine to 10s. That effectively removes it from the critical path of
make check, which is now back to about 15s on my machine with my
configuration.

	* tests/test-types-stability.cc (test_task): add field no_default_sizes
	(test_task::perform) Switch on the new flag to test a different
	behaviour.
	(main): Schedule an additional test case to test with the new flag.

Cc: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
---
 tests/test-types-stability.cc | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tests/test-types-stability.cc b/tests/test-types-stability.cc
index bc3d4d6e2e8b..1c1a5312b600 100644
--- a/tests/test-types-stability.cc
+++ b/tests/test-types-stability.cc
@@ -70,7 +70,8 @@ const char* elf_paths[] =
 /// passed to the constructor of the task.
 struct test_task : public abigail::workers::task
 {
-  string path;
+  const string path;
+  const bool no_default_sizes;
   string error_message;
   bool is_ok;
 
@@ -78,8 +79,9 @@ struct test_task : public abigail::workers::task
   ///
   /// @param elf_path the path to the elf binary on which we are
   /// supposed to launch abidw --abidiff.
-  test_task(const string& elf_path)
+  test_task(const string& elf_path, bool no_default_sizes)
     : path(elf_path),
+      no_default_sizes(no_default_sizes),
       is_ok(true)
   {}
 
@@ -96,18 +98,14 @@ struct test_task : public abigail::workers::task
 
     string abidw = string(get_build_dir()) + "/tools/abidw";
     string elf_path = string(get_src_dir()) + "/tests/" + path;
-    string cmd = abidw + " --abidiff " + elf_path;
+    string cmd = abidw + " --abidiff "
+		 + (no_default_sizes ? "--no-write-default-sizes " : "")
+		 + elf_path;
     if (system(cmd.c_str()))
       {
-	error_message = "IR stability issue detected for binary " + elf_path;
-	is_ok = false;
-      }
-
-    cmd = abidw + " --abidiff --no-write-default-sizes " + elf_path;
-    if (system(cmd.c_str()))
-      {
-	error_message = "IR stability issue detected for binary " + elf_path
-	  + " with --no-write-default-sizes";
+	error_message =
+	    "IR stability issue detected for binary " + elf_path
+	    + (no_default_sizes ? " with --no-write-default-sizes" : "");
 	is_ok = false;
       }
   }
@@ -129,7 +127,7 @@ main()
   /// Create a task queue.  The max number of worker threads of the
   /// queue is the number of the concurrent threads supported by the
   /// processor of the machine this code runs on.
-  const size_t num_tests = sizeof(elf_paths) / sizeof (char*) - 1;
+  const size_t num_tests = (sizeof(elf_paths) / sizeof(char*) - 1) * 2;
   size_t num_workers = std::min(get_number_of_threads(), num_tests);
   queue task_queue(num_workers);
 
@@ -138,7 +136,10 @@ main()
   /// a worker thread that starts working on the task.
   for (const char** p = elf_paths; p && *p; ++p)
     {
-      test_task_sptr t(new test_task(*p));
+      test_task_sptr t(new test_task(*p, false));
+      ABG_ASSERT(task_queue.schedule_task(t));
+
+      t.reset(new test_task(*p, true));
       ABG_ASSERT(task_queue.schedule_task(t));
     }
 
-- 
2.26.2.303.gf8c07b1a785-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-04 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 15:28 [PATCH 1/2] test-types-stability: parallelize test case alternatives Matthias Maennich
2020-04-29 15:28 ` [PATCH 2/2] tests: reorder test execution to optimize 'make check' runtime Matthias Maennich
2020-04-29 20:44 ` [PATCH 1/2] test-types-stability: parallelize test case alternatives Mark Wielaard
2020-04-30 11:42   ` Matthias Maennich
2020-05-04 13:36 ` Dodji Seketeli

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 read-only IMAP folder(s) and NNTP newsgroup(s).