summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2014-03-05 12:58:46 +0100
committerStef Walter <stefw@gnome.org>2014-03-05 13:02:16 +0100
commit533044c5ef208543b00e5f56635dcaae1b93d31b (patch)
tree7679e20322fdbcf0d0f53f722386415b9168ea0b /build
parent4f0b8a25630d6555cf0d91b849273e0e24a174ad (diff)
downloadgnome-keyring-533044c5ef208543b00e5f56635dcaae1b93d31b.tar.gz
Makefile.am: Use parallel tests for 'make check'
Also build in a 'make check-memory' and related functionality which drives valgrind.
Diffstat (limited to 'build')
-rw-r--r--build/gcr.supp14
-rw-r--r--build/gcrypt.supp39
-rw-r--r--build/glib.supp419
-rw-r--r--build/glibc.supp13
-rw-r--r--build/p11-kit.supp6
-rw-r--r--build/pixman.supp6
-rw-r--r--build/pthread.supp7
-rwxr-xr-xbuild/tap-driver357
-rwxr-xr-xbuild/tap-gtester176
-rw-r--r--build/unknown.supp420
10 files changed, 1457 insertions, 0 deletions
diff --git a/build/gcr.supp b/build/gcr.supp
new file mode 100644
index 00000000..69b6701c
--- /dev/null
+++ b/build/gcr.supp
@@ -0,0 +1,14 @@
+{
+ gcr_pkcs11_set_trust_store_uri
+ Memcheck:Leak
+ ...
+ fun:g_strdup
+ fun:gcr_pkcs11_set_trust_store_uri
+}
+{
+ gcr_pkcs11_set_trust_lookup_uris
+ Memcheck:Leak
+ ...
+ fun:g_strdupv
+ fun:gcr_pkcs11_set_trust_lookup_uris
+}
diff --git a/build/gcrypt.supp b/build/gcrypt.supp
new file mode 100644
index 00000000..05ff3959
--- /dev/null
+++ b/build/gcrypt.supp
@@ -0,0 +1,39 @@
+{
+ gpg_err_init
+ Memcheck:Leak
+ ...
+ fun:gpg_err_init
+}
+{
+ _gcry_module_add
+ Memcheck:Leak
+ ...
+ fun:_gcry_module_add
+}
+{
+ _gcry_rngcsprng_create_nonce
+ Memcheck:Leak
+ ...
+ fun:_gcry_malloc
+ ...
+ fun:initialize
+ fun:_gcry_rngcsprng_create_nonce
+}
+{
+ _gcry_rngcsprng_create_nonce
+ Memcheck:Leak
+ ...
+ fun:_gcry_malloc
+ ...
+ fun:initialize
+ fun:_gcry_rngcsprng_randomize
+}
+{
+ gcry_control__init
+ Memcheck:Leak
+ ...
+ fun:glib_thread_mutex_init
+ ...
+ fun:_gcry_vcontrol
+ fun:gcry_control
+}
diff --git a/build/glib.supp b/build/glib.supp
new file mode 100644
index 00000000..194b1e8a
--- /dev/null
+++ b/build/glib.supp
@@ -0,0 +1,419 @@
+{
+ g_type_register_static_1
+ Memcheck:Leak
+ ...
+ fun:g_type_register_static
+}
+{
+ g_type_register_fundamental
+ Memcheck:Leak
+ ...
+ fun:g_type_register_fundamental
+}
+{
+ g_type_init_with_debug_flags
+ Memcheck:Leak
+ ...
+ fun:g_type_init_with_debug_flags
+}
+{
+ g_type_class_ref
+ Memcheck:Leak
+ ...
+ fun:g_type_class_ref
+}
+{
+ g_type_add_interface_static
+ Memcheck:Leak
+ ...
+ fun:g_type_add_interface_static
+}
+{
+ g_param_spec_internal
+ Memcheck:Leak
+ ...
+ fun:g_type_class_ref
+ fun:g_type_create_instance
+ fun:g_param_spec_internal
+}
+{
+ g_param_spec_enum
+ Memcheck:Leak
+ ...
+ fun:g_type_class_ref
+ fun:g_param_spec_enum
+}
+{
+ g_param_spec_flags
+ Memcheck:Leak
+ ...
+ fun:g_type_class_ref
+ fun:g_param_spec_flags
+}
+{
+ g_quark_from_static_string
+ Memcheck:Leak
+ ...
+ fun:g_quark_from_static_string
+}
+{
+ g_quark_from_string
+ Memcheck:Leak
+ ...
+ fun:g_quark_from_string
+}
+{
+ g_value_register_transform_func
+ Memcheck:Leak
+ ...
+ fun:g_value_register_transform_func
+}
+{
+ test_run_seed
+ Memcheck:Leak
+ ...
+ fun:g_rand_new_with_seed_array
+ fun:test_run_seed
+ ...
+ fun:g_test_run_suite
+}
+{
+ g_test_init
+ Memcheck:Leak
+ ...
+ fun:g_test_init
+}
+{
+ g_intern_static_string
+ Memcheck:Leak
+ ...
+ fun:g_intern_static_string
+}
+{
+ g_main_context_push_thread_default
+ Memcheck:Leak
+ ...
+ fun:g_queue_new
+ fun:g_main_context_push_thread_default
+}
+{
+ g_dbus_error_register_error
+ Memcheck:Leak
+ ...
+ fun:g_dbus_error_register_error
+}
+{
+ g_param_spec_pool_insert
+ Memcheck:Leak
+ ...
+ fun:g_param_spec_pool_insert
+}
+{
+ g_main_context_default
+ Memcheck:Leak
+ ...
+ fun:g_main_context_default
+}
+{
+ g_main_context_check
+ Memcheck:Leak
+ ...
+ fun:g_ptr_array_add
+ fun:g_main_context_check
+}
+{
+ g_test_run_suite
+ Memcheck:Leak
+ ...
+ fun:g_slist_copy
+ fun:g_test_run_suite_internal
+ fun:g_test_run_suite
+}
+{
+ g_dbus_interface_info_cache_build
+ Memcheck:Leak
+ ...
+ fun:g_dbus_interface_info_cache_build
+}
+{
+ g_cancellable_push_current
+ Memcheck:Leak
+ ...
+ fun:thread_memory_from_self
+ ...
+ fun:g_cancellable_push_current
+}
+{
+ g_io_scheduler_push_job
+ Memcheck:Leak
+ ...
+ fun:init_scheduler
+ fun:g_once_impl
+ fun:g_io_scheduler_push_job
+}
+{
+ g_io_scheduler_push_job_2
+ Memcheck:Leak
+ ...
+ fun:g_system_thread_new
+ ...
+ fun:g_io_scheduler_push_job
+}
+{
+ g_bus_get_sync__available_connections
+ Memcheck:Leak
+ ...
+ fun:g_hash_table_new
+ fun:initable_init
+ fun:g_initable_init
+ fun:g_bus_get_sync
+}
+{
+ g_socket_connection_factory_register_type
+ Memcheck:Leak
+ ...
+ fun:g_socket_connection_factory_register_type
+}
+{
+ g_test_add_vtable
+ Memcheck:Leak
+ ...
+ fun:g_test_add_vtable
+}
+{
+ g_mutex_lock
+ Memcheck:Leak
+ ...
+ fun:g_mutex_impl_new
+ fun:g_mutex_get_impl
+ fun:g_mutex_lock
+}
+{
+ g_thread_self
+ Memcheck:Leak
+ ...
+ fun:g_thread_self
+}
+{
+ g_rec_mutex_lock
+ Memcheck:Leak
+ ...
+ fun:g_rec_mutex_impl_new
+ fun:g_rec_mutex_get_impl
+ fun:g_rec_mutex_lock
+}
+{
+ test_case_run
+ Memcheck:Leak
+ ...
+ fun:g_malloc0
+ fun:test_case_run
+ ...
+ fun:g_test_run_suite
+}
+{
+ g_get_charset
+ Memcheck:Leak
+ ...
+ fun:g_get_charset
+}
+{
+ g_test_run_suite__timer_new
+ Memcheck:Leak
+ ...
+ fun:g_timer_new
+ fun:test_case_run
+ ...
+ fun:g_test_run_suite
+}
+{
+ g_test_run_suite__timer_new2
+ Memcheck:Leak
+ ...
+ fun:g_timer_new
+ fun:test_case_run*
+ ...
+ fun:g_test_run_suite
+}
+{
+ g_test_run_suite__strconcat
+ Memcheck:Leak
+ ...
+ fun:g_strconcat
+ fun:test_case_run
+ ...
+ fun:g_test_run_suite
+ fun:g_test_run
+}
+{
+ g_type_interface_add_prerequisite
+ Memcheck:Leak
+ ...
+ fun:g_type_interface_add_prerequisite
+}
+{
+ g_test_run_suite_2
+ Memcheck:Leak
+ ...
+ fun:g_slist_copy
+ fun:g_test_run_suite_internal
+ ...
+ fun:g_test_run_suite
+}
+{
+ g_test_run_suite_3
+ Memcheck:Leak
+ ...
+ fun:g_malloc0
+ fun:g_test_run_suite_internal
+ ...
+ fun:g_test_run_suite
+}
+{
+ g_set_prgname
+ Memcheck:Leak
+ ...
+ fun:g_set_prgname
+}
+{
+ g_test_run_suite__strconcat_2
+ Memcheck:Leak
+ ...
+ fun:g_strconcat
+ fun:g_test_run_suite_internal
+}
+{
+ g_test_run_suite__strdup
+ Memcheck:Leak
+ ...
+ fun:g_strdup
+ fun:g_test_run_suite_internal
+}
+{
+ g_private_get
+ Memcheck:Leak
+ ...
+ fun:g_private_get
+}
+{
+ g_private_set
+ Memcheck:Leak
+ ...
+ fun:g_private_set
+}
+{
+ g_static_private_set_1
+ Memcheck:Leak
+ ...
+ fun:g_array_set_size
+ fun:g_static_private_set
+}
+{
+ g_static_private_set_2
+ Memcheck:Leak
+ ...
+ fun:g_array_sized_new
+ fun:g_static_private_set
+}
+{
+ g_static_mutex_get_mutex_impl
+ Memcheck:Leak
+ ...
+ fun:g_static_mutex_get_mutex_impl
+}
+{
+ g_variant_type_info_unref
+ Memcheck:Leak
+ ...
+ fun:g_hash_table_remove
+ fun:g_variant_type_info_unref
+}
+{
+ g_get_filename_charsets
+ Memcheck:Leak
+ ...
+ fun:g_get_filename_charsets
+}
+{
+ g_intern_string
+ Memcheck:Leak
+ ...
+ fun:g_intern_string
+}
+{
+ g_main_context_iterate
+ Memcheck:Leak
+ ...
+ fun:g_malloc
+ fun:g_main_context_iterate
+}
+{
+ g_main_context_dispatch
+ Memcheck:Leak
+ ...
+ fun:get_dispatch
+ fun:g_main_context_dispatch
+}
+{
+ g_log_set_handler
+ Memcheck:Leak
+ ...
+ fun:g_log_set_handler
+}
+{
+ g_simple_async_result_complete
+ Memcheck:Leak
+ ...
+ fun:g_main_context_push_thread_default
+ fun:g_simple_async_result_complete
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_static_private_set
+ fun:g_module_open
+}
+{
+ g_child_watch_source_new
+ Memcheck:Leak
+ ...
+ fun:ensure_unix_signal_handler_installed_unlocked
+ fun:g_child_watch_source_new
+}
+{
+ g_thread_pool_thread_proxy
+ Memcheck:Leak
+ ...
+ fun:g_malloc
+ fun:g_cond_new_posix_impl
+ ...
+ fun:g_async_queue_timed_pop
+ fun:g_thread_pool_thread_proxy
+}
+{
+ g_module_open
+ Memcheck:Leak
+ ...
+ fun:g_private_impl_new
+ ...
+ fun:g_module_open
+}
+{
+ g_system_thread_new
+ Memcheck:Leak
+ ...
+ fun:g_system_thread_new
+}
+{
+ thread_memory_from_self
+ Memcheck:Leak
+ ...
+ fun:thread_memory_from_self
+}
+{
+ g_get_language_names
+ Memcheck:Leak
+ ...
+ fun:g_get_language_names
+}
diff --git a/build/glibc.supp b/build/glibc.supp
new file mode 100644
index 00000000..34e68bff
--- /dev/null
+++ b/build/glibc.supp
@@ -0,0 +1,13 @@
+{
+ dlclose
+ Memcheck:Leak
+ ...
+ fun:dlclose
+}
+{
+ dlopen
+ Memcheck:Leak
+ ...
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.2.5
+}
diff --git a/build/p11-kit.supp b/build/p11-kit.supp
new file mode 100644
index 00000000..ad8b9289
--- /dev/null
+++ b/build/p11-kit.supp
@@ -0,0 +1,6 @@
+{
+ _p11_library_get_thread_local
+ Memcheck:Leak
+ ...
+ fun:_p11_library_get_thread_local
+}
diff --git a/build/pixman.supp b/build/pixman.supp
new file mode 100644
index 00000000..a384e0e1
--- /dev/null
+++ b/build/pixman.supp
@@ -0,0 +1,6 @@
+{
+ pixman
+ Memcheck:Leak
+ fun:malloc
+ obj:/usr/lib64/libpixman-1.so.0.22.2
+}
diff --git a/build/pthread.supp b/build/pthread.supp
new file mode 100644
index 00000000..a04bfc19
--- /dev/null
+++ b/build/pthread.supp
@@ -0,0 +1,7 @@
+{
+ _dl_allocate_tls
+ Memcheck:Leak
+ ...
+ fun:_dl_allocate_tls
+ fun:pthread_create*
+}
diff --git a/build/tap-driver b/build/tap-driver
new file mode 100755
index 00000000..3906b40e
--- /dev/null
+++ b/build/tap-driver
@@ -0,0 +1,357 @@
+#!/usr/bin/python
+
+# Copyright (C) 2013 Red Hat, Inc.
+#
+# Cockpit is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# Cockpit is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
+
+#
+# This is a TAP driver for automake
+#
+# In particular it leaves stderr untouched, and is cleaner than the
+# one implemented in shell that is making the rounds.
+#
+# This implements the automake "Custom Test Driver" protocol:
+# https://www.gnu.org/software/automake/manual/html_node/Custom-Test-Drivers.html
+#
+# This consumes the Test Anything Protocol (ie: TAP)
+# https://metacpan.org/pod/release/PETDANCE/Test-Harness-2.64/lib/Test/Harness/TAP.pod
+#
+
+import argparse
+import os
+import select
+import subprocess
+import sys
+
+class Driver:
+ def __init__(self, args):
+ self.argv = args.command
+ self.test_name = args.test_name
+ self.log = open(args.log_file, "w")
+ self.log.write("# %s\n" % " ".join(sys.argv))
+ self.trs = open(args.trs_file, "w")
+ self.color_tests = args.color_tests
+ self.expect_failure = args.expect_failure
+
+ def report(self, code, *args):
+ CODES = {
+ "XPASS": '\x1b[0;31m', # red
+ "FAIL": '\x1b[0;31m', # red
+ "PASS": '\x1b[0;32m', # grn
+ "XFAIL": '\x1b[1;32m', # lgn
+ "SKIP": '\x1b[1;34m', # blu
+ "ERROR": '\x1b[0;35m', # mgn
+ }
+
+ # Print out to console
+ if self.color_tests:
+ if code in CODES:
+ sys.stdout.write(CODES[code])
+ sys.stdout.write(code)
+ if self.color_tests:
+ sys.stdout.write('\x1b[m')
+ sys.stdout.write(": ")
+ sys.stdout.write(self.test_name)
+ sys.stdout.write(" ")
+ for arg in args:
+ sys.stdout.write(str(arg))
+ sys.stdout.write("\n")
+ sys.stdout.flush()
+
+ # Book keeping
+ if code in CODES:
+ self.trs.write(":test-result: %s\n" % code)
+
+ def result_pass(self, *args):
+ if self.expect_failure:
+ self.report("XPASS", *args)
+ else:
+ self.report("PASS", *args)
+
+ def result_fail(self, *args):
+ if self.expect_failure:
+ self.report("XFAIL", *args)
+ else:
+ self.report("FAIL", *args)
+
+ def result_skip(self, *args):
+ if self.expect_failure:
+ self.report("XFAIL", *args)
+ else:
+ self.report("SKIP", *args)
+
+ def report_error(self, description=""):
+ self.report("ERROR", "", description)
+
+ def process(self, output):
+ pass
+
+ def execute(self):
+ try:
+ proc = subprocess.Popen(self.argv, close_fds=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ except OSError, ex:
+ self.report_error("Couldn't run %s: %s" % (self.argv[0], str(ex)))
+ return
+
+ outf = proc.stdout.fileno()
+ errf = proc.stderr.fileno()
+ rset = [outf, errf]
+ while len(rset) > 0:
+ ret = select.select(rset, [], [], 10)
+ if outf in ret[0]:
+ data = os.read(outf, 1024)
+ if data == "":
+ rset.remove(outf)
+ self.log.write(data)
+ self.process(data)
+ if errf in ret[0]:
+ data = os.read(errf, 1024)
+ if data == "":
+ rset.remove(errf)
+ self.log.write(data)
+ sys.stderr.write(data)
+
+ proc.wait()
+ return proc.returncode
+
+
+class TapDriver(Driver):
+ def __init__(self, args):
+ Driver.__init__(self, args)
+ self.output = ""
+ self.reported = { }
+ self.test_plan = None
+ self.late_plan = False
+ self.errored = False
+ self.bail_out = False
+
+ def report(self, code, num, *args):
+ if num:
+ Driver.report(self, code, num, " ", *args)
+ self.reported[num] = code
+ else:
+ Driver.report(self, code, *args)
+ if code == "ERROR":
+ self.errored = True
+
+ def consume_test_line(self, ok, data):
+ # It's an error if the caller sends a test plan in the middle of tests
+ if self.late_plan:
+ self.report_error("Got tests after late TAP test plan")
+ self.late_plan = False
+
+ # Parse out a number and then description
+ (num, unused, description) = data.partition(" ")
+ try:
+ num = int(num)
+ except ValueError:
+ self.report_error("Invalid test number: %s" % data)
+ return
+ description = description.lstrip()
+
+ # Special case if description starts with this, then skip
+ if description.lower().startswith("# skip"):
+ self.result_skip(num, description)
+ elif ok:
+ self.result_pass(num, description)
+ else:
+ self.result_fail(num, description)
+
+ def consume_test_plan(self, first, last):
+ # Only one test plan is supported
+ if self.test_plan:
+ self.report_error("Get a second TAP test plan")
+ return
+
+ try:
+ first = int(first)
+ last = int(last)
+ except ValueError:
+ self.report_error("Invalid test plan: %s..%s" % (first, last))
+ return
+
+ self.test_plan = (first, last)
+ self.late_plan = self.reported and True or False
+
+ def consume_bail_out(self, line):
+ self.bail_out = True
+ self.report("SKIP", 0, line)
+
+ def process(self, output):
+ if output:
+ self.output += output
+ elif self.output:
+ self.output += "\n"
+ (ready, unused, self.output) = self.output.rpartition("\n")
+ for line in ready.split("\n"):
+ if line.startswith("ok "):
+ self.consume_test_line(True, line[3:])
+ elif line.startswith("not ok "):
+ self.consume_test_line(False, line[7:])
+ elif line and line[0].isdigit() and ".." in line:
+ (first, unused, last) = line.partition("..")
+ self.consume_test_plan(first, last)
+ elif line.lower().startswith("bail out!"):
+ self.consume_bail_out(line)
+
+ def run(self):
+ returncode = self.execute()
+
+ failed = False
+ skipped = True
+
+ # Basic collation of results
+ for (num, code) in self.reported.items():
+ if code == "ERROR":
+ self.errored = True
+ elif code == "FAIL" or code == "XPASS":
+ failed = True
+ if code != "SKIP":
+ skipped = False
+
+ if not self.errored and returncode:
+ self.report_error("process failed: %d" % returncode)
+ self.errored = True
+
+ # Check the plan
+ if not self.errored:
+ if not self.test_plan:
+ if not self.bail_out:
+ self.report_error("Didn't receive a TAP test plan")
+ else:
+ for i in range(self.test_plan[0], self.test_plan[1] + 1):
+ if i not in self.reported:
+ if self.bail_out:
+ self.report("SKIP", i, "- bailed out")
+ else:
+ self.report("ERROR", i, "- missing test")
+ skipped = False
+ self.errored = True
+
+ if self.errored:
+ self.trs.write(":global-test-result: ERROR\n")
+ self.trs.write(":test-global-result: ERROR\n")
+ self.trs.write(":recheck: yes\n")
+ elif failed:
+ self.trs.write(":global-test-result: FAIL\n")
+ self.trs.write(":test-global-result: FAIL\n")
+ self.trs.write(":recheck: yes\n")
+ elif skipped:
+ self.trs.write(":global-test-result: SKIP\n")
+ self.trs.write(":test-global-result: SKIP\n")
+ self.trs.write(":recheck: no\n")
+ else:
+ self.trs.write(":global-test-result: PASS\n")
+ self.trs.write(":test-global-result: PASS\n")
+ self.trs.write(":recheck: no\n")
+ if self.errored or failed:
+ self.trs.write(":copy-in-global-log: yes\n")
+
+ # Process result code
+ return 0
+
+
+class SimpleDriver(Driver):
+ def __init__(self, args):
+ Driver.__init__(self, args)
+
+ def run(self):
+ returncode = self.execute()
+ if returncode == 0:
+ self.result_pass()
+ self.trs.write(":global-test-result: PASS\n")
+ self.trs.write(":test-global-result: PASS\n")
+ self.trs.write(":recheck: no\n")
+ elif returncode == 77:
+ self.result_skip()
+ self.trs.write(":global-test-result: SKIP\n")
+ self.trs.write(":test-global-result: SKIP\n")
+ self.trs.write(":recheck: no\n")
+ elif returncode == 99:
+ self.report_error()
+ self.trs.write(":global-test-result: ERROR\n")
+ self.trs.write(":test-global-result: ERROR\n")
+ self.trs.write(":copy-in-global-log: yes\n")
+ self.trs.write(":recheck: yes\n")
+ else:
+ self.result_fail()
+ self.trs.write(":global-test-result: FAIL\n")
+ self.trs.write(":test-global-result: FAIL\n")
+ self.trs.write(":copy-in-global-log: yes\n")
+ self.trs.write(":recheck: yes\n")
+
+ # Process result code
+ return 0
+
+
+class MissingDriver(Driver):
+ def __init__(self, args):
+ Driver.__init__(self, args)
+ self.missing = args.missing
+
+ def run(self):
+ self.result_skip("skipping due to: ", self.missing)
+ self.trs.write(":global-test-result: SKIP\n")
+ self.trs.write(":test-global-result: SKIP\n")
+ self.trs.write(":recheck: no\n")
+ return 0
+
+
+class YesNoAction(argparse.Action):
+ def __init__(self, option_strings, dest, **kwargs):
+ argparse.Action.__init__(self, option_strings, dest, **kwargs)
+ self.metavar = "[yes|no]"
+ def __call__(self, parser, namespace, values, option_string=None):
+ if not values or "yes" in values:
+ setattr(namespace, self.dest, True)
+ else:
+ setattr(namespace, self.dest, False)
+
+
+def main(argv):
+ parser = argparse.ArgumentParser(description='Automake TAP driver')
+ parser.add_argument('--format', metavar='FORMAT', choices=[ "simple", "tap" ],
+ default="simple", help='The type of test to drive')
+ parser.add_argument('--missing', metavar="TOOL", nargs='?',
+ help="Force the test to skip due to missing tool")
+ parser.add_argument('--test-name', metavar='NAME',
+ help='The name of the test')
+ parser.add_argument('--log-file', metavar='PATH.log', required=True,
+ help='The .log file the driver creates')
+ parser.add_argument('--trs-file', metavar='PATH.trs', required=True,
+ help='The .trs file the driver creates')
+ parser.add_argument('--color-tests', default=True, action=YesNoAction,
+ help='Whether the console output should be colorized or not')
+ parser.add_argument('--expect-failure', default=False, action=YesNoAction,
+ help="Whether the tested program is expected to fail")
+ parser.add_argument('--enable-hard-errors', default=False, action=YesNoAction,
+ help="Whether hard errors in the tested program are treated differently")
+ parser.add_argument('command', nargs='+',
+ help="A test command line to run")
+ args = parser.parse_args(argv[1:])
+
+ if not args.test_name:
+ args.test_name = os.path.basename(args.command[0])
+ if args.missing:
+ driver = MissingDriver(args)
+ elif args.format == "simple":
+ driver = SimpleDriver(args)
+ elif args.format == "tap":
+ driver = TapDriver(args)
+ return driver.run()
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/build/tap-gtester b/build/tap-gtester
new file mode 100755
index 00000000..ff7506a4
--- /dev/null
+++ b/build/tap-gtester
@@ -0,0 +1,176 @@
+#!/usr/bin/python
+
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# Cockpit is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# Cockpit is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
+
+#
+# This is a test output compiler which produces TAP from GTest output
+# if GTest output is detected.
+#
+# Versions of glib later than 2.38.x output TAP natively when tests are
+# run with the --tap option. However we can't depend on such a recent
+# version of glib for our purposes.
+#
+# This implements the Test Anything Protocol (ie: TAP)
+# https://metacpan.org/pod/release/PETDANCE/Test-Harness-2.64/lib/Test/Harness/TAP.pod
+#
+
+import argparse
+import os
+import select
+import subprocess
+import sys
+
+class NullCompiler:
+ def __init__(self, command):
+ self.command = command
+
+ def input(self, line):
+ sys.stdout.write(line)
+
+ def process(self, proc):
+ while True:
+ line = proc.stdout.readline()
+ if not line:
+ break
+ self.input(line)
+ proc.wait()
+ return proc.returncode
+
+ def run(self, proc, line=None):
+ if line:
+ self.input(line)
+ return self.process(proc)
+
+
+class GTestCompiler(NullCompiler):
+ def __init__(self, filename):
+ NullCompiler.__init__(self, filename)
+ self.test_num = 0
+ self.test_name = None
+ self.test_remaining = []
+
+ def input(self, line):
+ line = line.strip()
+ if line.startswith("GTest: "):
+ (cmd, unused, data) = line[7:].partition(": ")
+ cmd = cmd.strip()
+ data = data.strip()
+ if cmd == "run":
+ self.test_name = data
+ assert self.test_name in self.test_remaining, "%s %s" % (self.test_name, repr(self.test_remaining))
+ self.test_remaining.remove(self.test_name)
+ self.test_num += 1
+ elif cmd == "result":
+ if data == "OK":
+ print "ok %d %s" % (self.test_num, self.test_name)
+ if data == "FAIL":
+ print "not ok %d %s", (self.test_num, self.test_name)
+ self.test_name = None
+ elif cmd == "skipping":
+ if "/subprocess" not in data:
+ print "ok %d # skip -- %s" % (self.test_num, data)
+ self.test_name = None
+ elif data:
+ print "# %s: %s" % (cmd, data)
+ else:
+ print "# %s" % cmd
+ elif line.startswith("(MSG: "):
+ print "# %s" % line[6:-1]
+ elif line:
+ print "# %s" % line
+ sys.stdout.flush()
+
+ def run(self, proc, output=""):
+ # Complete retrieval of the list of tests
+ output += proc.stdout.read()
+ proc.wait()
+ if proc.returncode:
+ sys.stderr.write("tap-gtester: listing GTest tests failed: %d\n" % proc.returncode)
+ return proc.returncode
+ self.test_remaining = []
+ for line in output.split("\n"):
+ if line.startswith("/"):
+ self.test_remaining.append(line.strip())
+ if not self.test_remaining:
+ print "Bail out! No tests found in GTest: %s" % self.command[0]
+ return 0
+
+ print "1..%d" % len(self.test_remaining)
+
+ # First try to run all the tests in a batch
+ proc = subprocess.Popen(self.command + ["--verbose" ], close_fds=True, stdout=subprocess.PIPE)
+ result = self.process(proc)
+ if result == 0:
+ return 0
+
+ # Now pick up any stragglers due to failures
+ while True:
+ # Assume that the last test failed
+ if self.test_name:
+ print "not ok %d %s" % (self.test_num, self.test_name)
+ self.test_name = None
+
+ # Run any tests which didn't get run
+ if not self.test_remaining:
+ break
+
+ proc = subprocess.Popen(self.command + ["--verbose", "-p", self.test_remaining[0]],
+ close_fds=True, stdout=subprocess.PIPE)
+ result = self.process(proc)
+
+ # The various exit codes and signals we continue for
+ if result not in [ 0, 1, -4, -5, -6, -7, -8, -11, 33 ]:
+ break
+
+ return result
+
+def main(argv):
+ parser = argparse.ArgumentParser(description='Automake TAP compiler')
+ parser.add_argument('--format', metavar='FORMAT', choices=[ "auto", "gtest", "tap" ],
+ default="auto", help='The input format to compile')
+ parser.add_argument('--verbose', action='store_true',
+ default=True, help='Verbose mode (ignored)')
+ parser.add_argument('command', nargs='+', help="A test command to run")
+ args = parser.parse_args(argv[1:])
+
+ output = None
+ format = args.format
+ cmd = args.command
+ proc = None
+
+ if format in ["auto", "gtest"]:
+ list_cmd = cmd + ["-l", "--verbose"]
+ proc = subprocess.Popen(list_cmd, close_fds=True, stdout=subprocess.PIPE)
+ output = proc.stdout.readline()
+ # Smell whether we're dealing with GTest list output from first line
+ if "random seed" in output or "GTest" in output or output.startswith("/"):
+ format = "gtest"
+ else:
+ format = "tap"
+ else:
+ proc = subprocess.Popen(cmd, close_fds=True, stdout=subprocess.PIPE)
+
+ if format == "gtest":
+ compiler = GTestCompiler(cmd)
+ elif format == "tap":
+ compiler = NullCompiler(cmd)
+ else:
+ assert False, "not reached"
+
+ return compiler.run(proc, output)
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/build/unknown.supp b/build/unknown.supp
new file mode 100644
index 00000000..bc7eea18
--- /dev/null
+++ b/build/unknown.supp
@@ -0,0 +1,420 @@
+{
+ _g_dbus_shared_thread_ref
+ Memcheck:Leak
+ ...
+ fun:_g_dbus_shared_thread_ref
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_slice_alloc
+ fun:g_slice_alloc0
+ fun:g_type_create_instance
+ fun:g_object_constructor
+ fun:g_object_newv
+ fun:g_object_new
+ fun:g_dbus_message_new
+ fun:g_dbus_message_new_from_blob
+ fun:_g_dbus_worker_do_read_cb
+ fun:g_simple_async_result_complete
+ fun:complete_in_idle_cb
+ fun:g_idle_dispatch
+ fun:g_main_dispatch
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ ...
+ obj:/lib64/libgcrypt.so.11.7.0
+ fun:egg_dh_gen_pair
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:parse_value_from_blob
+ fun:g_dbus_message_new_from_blob
+ fun:_g_dbus_worker_do_read_cb
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_dbus_message_new
+ fun:g_dbus_message_new_from_blob
+ fun:_g_dbus_worker_do_read_cb
+ fun:g_simple_async_result_complete
+ fun:complete_in_idle_cb
+ fun:g_idle_dispatch
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_variant_get
+ fun:g_dbus_message_to_gerror
+ fun:decode_method_reply
+ fun:g_dbus_connection_call_done
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_dbus_message_set_header
+ fun:g_dbus_message_new_from_blob
+ fun:_g_dbus_worker_do_read_cb
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_malloc_n
+ fun:g_main_context_iterate
+ fun:g_main_loop_run
+ fun:gdbus_shared_thread_func
+ fun:g_thread_proxy
+ fun:start_thread
+ fun:clone
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_slice_alloc
+ fun:g_list_prepend
+ fun:g_queue_push_head
+ fun:g_main_context_push_thread_default
+ fun:gdbus_shared_thread_func
+ fun:g_thread_proxy
+ fun:start_thread
+ fun:clone
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_slice_alloc
+ fun:g_slice_alloc0
+ fun:get_dispatch
+ fun:g_main_dispatch
+ fun:g_main_context_dispatch
+ fun:g_main_context_iterate
+ fun:g_main_loop_run
+ fun:g_dbus_connection_send_message_with_reply_sync
+ fun:g_dbus_connection_call_sync_internal
+ fun:g_dbus_connection_call_sync
+ fun:initable_init
+ fun:g_initable_init
+ fun:g_bus_get_sync
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_slice_alloc
+ fun:g_slice_alloc0
+ fun:get_dispatch
+ fun:g_main_dispatch
+ fun:g_main_context_dispatch
+ fun:g_main_context_iterate
+ fun:g_main_loop_run
+ fun:gdbus_shared_thread_func
+ fun:g_thread_proxy
+ fun:start_thread
+ fun:clone
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_malloc_n
+ fun:g_main_context_iterate
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:realloc
+ fun:standard_realloc
+ fun:g_realloc
+ fun:_g_dbus_worker_do_read_unlocked
+ fun:_g_dbus_worker_do_initial_read
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_g_socket_output_stream_new
+ fun:g_socket_connection_get_output_stream
+ fun:g_io_stream_get_output_stream
+ fun:_g_dbus_auth_run_client
+}
+{
+ _g_dbus_worker_do_initial_read
+ Memcheck:Leak
+ ...
+ fun:_g_dbus_worker_do_read_unlocked
+ fun:_g_dbus_worker_do_initial_read
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_unix_socket_address_new_with_type
+ fun:g_dbus_address_connect
+ fun:g_dbus_address_try_connect_one
+ fun:g_dbus_address_get_stream_sync
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_g_socket_input_stream_new
+ fun:g_socket_connection_get_input_stream
+ fun:g_io_stream_get_input_stream
+ fun:_g_dbus_auth_run_client
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_g_dbus_worker_close
+ fun:_g_dbus_worker_stop
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_simple_async_result_complete_in_idle
+ fun:_g_socket_read_with_control_messages_ready
+ fun:_g_socket_read_with_control_messages
+ fun:_g_dbus_worker_do_read_unlocked
+ fun:_g_dbus_worker_do_read_cb
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_source_new
+ fun:g_idle_source_new
+ fun:g_simple_async_result_complete_in_idle
+ fun:g_socket_connection_close_async
+ fun:g_io_stream_close_async
+ ...
+ fun:gdbus_shared_thread_func
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_simple_async_result_new
+ fun:g_socket_connection_close_async
+ fun:g_io_stream_close_async
+ fun:maybe_write_next_message
+ fun:write_message_in_idle_cb
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_socket_connection_factory_create_connection
+ ...
+ fun:initable_init
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_socket_client_connect
+ fun:g_dbus_address_connect
+ fun:g_dbus_address_try_connect_one
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_g_dbus_worker_new
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_g_socket_read_with_control_messages
+ fun:_g_dbus_worker_do_read_unlocked
+ fun:_g_dbus_worker_do_read_cb
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_socket_receive_message
+ fun:_g_socket_read_with_control_messages_ready
+ fun:_g_socket_read_with_control_messages
+ fun:_g_dbus_worker_do_read_unlocked
+ fun:_g_dbus_worker_do_read_cb
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:maybe_write_next_message
+ ...
+ fun:gdbus_shared_thread_func
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:remove_match_rule
+ fun:unsubscribe_id_internal
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_object_new
+ fun:get_uninitialized_connection
+ fun:g_bus_get_sync
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_dbus_connection_signal_subscribe
+ fun:async_initable_init_first
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_dbus_connection_send_message_with_reply_unlocked
+ fun:g_dbus_connection_send_message_with_reply
+ fun:g_dbus_connection_send_message_with_reply_sync
+ fun:g_dbus_connection_call_sync_internal
+ fun:g_dbus_connection_call_sync
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_g_dbus_auth_new
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_g_dbus_auth_run_client
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_g_dbus_auth_init
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_variant_dup_string
+ ...
+ fun:g_variant_get
+ ...
+ fun:g_initable_init
+ fun:g_bus_get_sync
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_main_context_push_thread_default
+ ...
+ fun:gdbus_shared_thread_func
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_main_context_add_poll_unlocked
+ ...
+ fun:g_main_loop_run
+ fun:gdbus_shared_thread_func
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:g_malloc
+ fun:g_memdup
+ fun:g_hash_table_insert_node
+ fun:handler_insert
+ fun:g_signal_connect_data
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_cond_new_posix_impl
+ fun:g_async_queue_pop_intern_unlocked
+ fun:g_thread_pool_thread_proxy
+ fun:g_thread_create_proxy
+ fun:start_thread
+ fun:clone
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:g_thread_create_full
+ fun:g_thread_pool_start_thread
+ fun:g_thread_pool_push
+}
+{
+ thread_memory_from_self
+ Memcheck:Leak
+ ...
+ fun:thread_memory_from_self
+ ...
+ fun:g_object_new
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_slice_alloc
+ fun:g_slice_alloc0
+ fun:get_dispatch
+ fun:g_main_dispatch
+ fun:g_main_context_dispatch
+ fun:g_main_context_iterate
+ fun:g_main_loop_run
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_memdup
+ fun:g_hash_table_insert_node
+ fun:g_hash_table_insert_internal
+ fun:g_hash_table_insert
+ fun:handler_list_ensure
+ fun:handler_insert
+ fun:g_signal_connect_data
+}