mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2025-01-03 02:28:53 +00:00
Makefile.am: Add check-memory target for valgrind testing
Update the test-driver to accomodate this and figure out how best to implement this. Fix up 'make recheck' as well.
This commit is contained in:
parent
b00658d308
commit
f089662a9f
1
.gitignore
vendored
1
.gitignore
vendored
@ -45,6 +45,7 @@ stamp*
|
|||||||
/build/m4/*
|
/build/m4/*
|
||||||
!/build/m4/vapigen.m4
|
!/build/m4/vapigen.m4
|
||||||
/build/valgrind-suppressions
|
/build/valgrind-suppressions
|
||||||
|
/build/test-driver
|
||||||
|
|
||||||
/docs/man/secret-tool.1
|
/docs/man/secret-tool.1
|
||||||
/docs/reference/libsecret/version.xml
|
/docs/reference/libsecret/version.xml
|
||||||
|
78
Makefile.am
78
Makefile.am
@ -30,12 +30,6 @@ dist-hook:
|
|||||||
echo A git clone is required to generate a ChangeLog >&2; \
|
echo A git clone is required to generate a ChangeLog >&2; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check-memory:
|
|
||||||
@for subdir in $(SUBDIRS); do \
|
|
||||||
test -d $(builddir)/$$subdir/tests && \
|
|
||||||
make -C $(builddir)/$$subdir/tests check-memory; \
|
|
||||||
done
|
|
||||||
|
|
||||||
upload-release: $(DIST_ARCHIVES)
|
upload-release: $(DIST_ARCHIVES)
|
||||||
scp $(DIST_ARCHIVES) master.gnome.org:
|
scp $(DIST_ARCHIVES) master.gnome.org:
|
||||||
|
|
||||||
@ -56,18 +50,47 @@ dist-hook: dist-check-valac
|
|||||||
distcleancheck_listfiles = \
|
distcleancheck_listfiles = \
|
||||||
find . -name '*.gc[dn][oa]' -prune -o -type f -print
|
find . -name '*.gc[dn][oa]' -prune -o -type f -print
|
||||||
|
|
||||||
TEST_SUPPRESSIONS = $(top_builddir)/build/valgrind-suppressions
|
TESTS_ENVIRONMENT = LD_LIBRARY_PATH=$(builddir)/.libs GI_TYPELIB_PATH=$(builddir)
|
||||||
|
TEST_EXTENSIONS = .py .js
|
||||||
|
|
||||||
perform-memcheck: $(TEST_PROGS) $(TEST_SUPPRESSIONS)
|
# Default executable tests
|
||||||
@make -C $(top_builddir)/build all
|
LOG_DRIVER = $(srcdir)/build/tap-driver
|
||||||
@for test in $(TEST_PROGS); do \
|
LOG_DRIVER_FLAGS = --format=tap
|
||||||
G_SLICE=always-malloc libtool --mode=execute \
|
LOG_COMPILER = $(srcdir)/build/tap-gtester
|
||||||
valgrind --trace-children=no --gen-suppressions=all \
|
|
||||||
--suppressions=$(TEST_SUPPRESSIONS) \
|
# Python tests
|
||||||
--leak-check=full --show-reachable=yes --num-callers=16 \
|
PY_LOG_DRIVER = $(srcdir)/build/tap-driver
|
||||||
--quiet --error-exitcode=33 \
|
PY_LOG_DRIVER_FLAGS = --format=tap
|
||||||
$(builddir)/$$test; \
|
PY_LOG_COMPILER = $(srcdir)/build/tap-unittest
|
||||||
done
|
|
||||||
|
# Javascript tests
|
||||||
|
JS_LOG_DRIVER = $(srcdir)/build/tap-driver
|
||||||
|
JS_LOG_DRIVER_FLAGS = --format=simple
|
||||||
|
JS_LOG_COMPILER = gjs
|
||||||
|
|
||||||
|
VALGRIND_ARGS = --trace-children=no --quiet --error-exitcode=33 \
|
||||||
|
--suppressions=valgrind-suppressions --gen-suppressions=all \
|
||||||
|
--num-callers=16
|
||||||
|
VALGRIND_SUPPRESSIONS = \
|
||||||
|
build/gcrypt.supp \
|
||||||
|
build/glib.supp \
|
||||||
|
build/pthread.supp \
|
||||||
|
build/unknown.supp \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
valgrind-suppressions: $(VALGRIND_SUPPRESSIONS)
|
||||||
|
$(AM_V_GEN) cat $^ > $@
|
||||||
|
|
||||||
|
check-memory: valgrind-suppressions
|
||||||
|
$(MAKE) LOG_FLAGS="-- libtool --mode=execute valgrind $(VALGRIND_ARGS)" \
|
||||||
|
PY_LOG_DRIVER_FLAGS="--missing=no-python-valgrind" \
|
||||||
|
JS_LOG_DRIVER_FLAGS="--missing=no-gjs-valgrind" \
|
||||||
|
$(AM_MAKEFLAGS) check
|
||||||
|
recheck-memory: valgrind-suppressions
|
||||||
|
$(MAKE) LOG_FLAGS="-- libtool --mode=execute valgrind $(VALGRIND_ARGS)" \
|
||||||
|
PY_LOG_DRIVER_FLAGS="--missing=no-python-valgrind" \
|
||||||
|
JS_LOG_DRIVER_FLAGS="--missing=no-gjs-valgrind" \
|
||||||
|
$(AM_MAKEFLAGS) recheck
|
||||||
|
|
||||||
if WITH_COVERAGE
|
if WITH_COVERAGE
|
||||||
coverage:
|
coverage:
|
||||||
@ -142,22 +165,17 @@ CLEANFILES = \
|
|||||||
$(typelibs_DATA) \
|
$(typelibs_DATA) \
|
||||||
$(BUILT_SOURCES) \
|
$(BUILT_SOURCES) \
|
||||||
$(vapi_DATA) \
|
$(vapi_DATA) \
|
||||||
$(man_MANS)
|
$(man_MANS) \
|
||||||
|
valgrind-suppressions
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
COPYING.TESTS
|
COPYING.TESTS \
|
||||||
|
build/valgrind \
|
||||||
|
build/tap-gtester \
|
||||||
|
build/tap-driver \
|
||||||
|
build/tap-unittest \
|
||||||
|
$(VALGRIND_SUPPRESSIONS)
|
||||||
|
|
||||||
LOG_DRIVER = $(srcdir)/build/test-driver --format=tap
|
|
||||||
LOG_COMPILER = $(srcdir)/build/tap-gtester
|
|
||||||
|
|
||||||
TESTS_ENVIRONMENT = LD_LIBRARY_PATH=$(builddir)/.libs GI_TYPELIB_PATH=$(builddir)
|
|
||||||
TEST_EXTENSIONS = .py .js
|
|
||||||
PY_LOG_DRIVER = $(srcdir)/build/test-driver --format=tap
|
|
||||||
PY_LOG_COMPILER = $(srcdir)/build/tap-unittest
|
|
||||||
JS_LOG_DRIVER = $(srcdir)/build/test-driver --format=simple
|
|
||||||
JS_LOG_COMPILER = gjs
|
|
||||||
|
|
||||||
include build/Makefile.am
|
|
||||||
include egg/Makefile.am
|
include egg/Makefile.am
|
||||||
include libsecret/Makefile.am
|
include libsecret/Makefile.am
|
||||||
include tool/Makefile.am
|
include tool/Makefile.am
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
SUPPRESSIONS = \
|
|
||||||
build/gcrypt.supp \
|
|
||||||
build/glib.supp \
|
|
||||||
build/pthread.supp \
|
|
||||||
build/unknown.supp \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
valgrind-suppressions: $(SUPPRESSIONS)
|
|
||||||
$(AM_V_GEN) cat $^ > $@
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
build/valgrind \
|
|
||||||
build/tap-compiler \
|
|
||||||
build/tap-driver \
|
|
||||||
build/tap-unittest \
|
|
||||||
build/test-driver \
|
|
||||||
$(SUPPRESSIONS)
|
|
||||||
|
|
||||||
CLEANFILES += \
|
|
||||||
valgrind-suppressions \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
nodist_noinst_DATA += valgrind-suppressions
|
|
@ -39,6 +39,7 @@ class Driver:
|
|||||||
self.argv = args.command
|
self.argv = args.command
|
||||||
self.test_name = args.test_name
|
self.test_name = args.test_name
|
||||||
self.log = open(args.log_file, "w")
|
self.log = open(args.log_file, "w")
|
||||||
|
self.log.write("# %s\n" % " ".join(sys.argv))
|
||||||
self.trs = open(args.trs_file, "w")
|
self.trs = open(args.trs_file, "w")
|
||||||
self.color_tests = args.color_tests
|
self.color_tests = args.color_tests
|
||||||
self.expect_failure = args.expect_failure
|
self.expect_failure = args.expect_failure
|
||||||
@ -90,7 +91,7 @@ class Driver:
|
|||||||
else:
|
else:
|
||||||
self.report("SKIP", *args)
|
self.report("SKIP", *args)
|
||||||
|
|
||||||
def report_error(self, description):
|
def report_error(self, description=""):
|
||||||
self.report("ERROR", "", description)
|
self.report("ERROR", "", description)
|
||||||
|
|
||||||
def process(self, output):
|
def process(self, output):
|
||||||
@ -126,6 +127,7 @@ class Driver:
|
|||||||
proc.wait()
|
proc.wait()
|
||||||
return proc.returncode
|
return proc.returncode
|
||||||
|
|
||||||
|
|
||||||
class TapDriver(Driver):
|
class TapDriver(Driver):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
Driver.__init__(self, args)
|
Driver.__init__(self, args)
|
||||||
@ -195,9 +197,6 @@ class TapDriver(Driver):
|
|||||||
self.output += "\n"
|
self.output += "\n"
|
||||||
(ready, unused, self.output) = self.output.rpartition("\n")
|
(ready, unused, self.output) = self.output.rpartition("\n")
|
||||||
for line in ready.split("\n"):
|
for line in ready.split("\n"):
|
||||||
self.log.write(line)
|
|
||||||
self.log.write("\n")
|
|
||||||
|
|
||||||
if line.startswith("ok "):
|
if line.startswith("ok "):
|
||||||
self.consume_test_line(True, line[3:])
|
self.consume_test_line(True, line[3:])
|
||||||
elif line.startswith("not ok "):
|
elif line.startswith("not ok "):
|
||||||
@ -223,13 +222,14 @@ class TapDriver(Driver):
|
|||||||
if code != "SKIP":
|
if code != "SKIP":
|
||||||
skipped = False
|
skipped = False
|
||||||
|
|
||||||
|
if not self.errored and returncode:
|
||||||
|
self.report_error("process failed: %d" % returncode)
|
||||||
|
self.errored = True
|
||||||
|
|
||||||
# Check the plan
|
# Check the plan
|
||||||
if not self.errored:
|
if not self.errored:
|
||||||
if not self.test_plan:
|
if not self.test_plan:
|
||||||
if not self.bail_out:
|
if not self.bail_out:
|
||||||
if returncode:
|
|
||||||
self.report_error("Test process failed: %d" % returncode)
|
|
||||||
else:
|
|
||||||
self.report_error("Didn't receive a TAP test plan")
|
self.report_error("Didn't receive a TAP test plan")
|
||||||
else:
|
else:
|
||||||
for i in range(self.test_plan[0], self.test_plan[1] + 1):
|
for i in range(self.test_plan[0], self.test_plan[1] + 1):
|
||||||
@ -244,7 +244,7 @@ class TapDriver(Driver):
|
|||||||
if self.errored:
|
if self.errored:
|
||||||
self.trs.write(":global-test-result: ERROR\n")
|
self.trs.write(":global-test-result: ERROR\n")
|
||||||
self.trs.write(":test-global-result: ERROR\n")
|
self.trs.write(":test-global-result: ERROR\n")
|
||||||
self.trs.write(":recheck: no\n")
|
self.trs.write(":recheck: yes\n")
|
||||||
elif failed:
|
elif failed:
|
||||||
self.trs.write(":global-test-result: FAIL\n")
|
self.trs.write(":global-test-result: FAIL\n")
|
||||||
self.trs.write(":test-global-result: FAIL\n")
|
self.trs.write(":test-global-result: FAIL\n")
|
||||||
@ -253,11 +253,16 @@ class TapDriver(Driver):
|
|||||||
self.trs.write(":global-test-result: SKIP\n")
|
self.trs.write(":global-test-result: SKIP\n")
|
||||||
self.trs.write(":test-global-result: SKIP\n")
|
self.trs.write(":test-global-result: SKIP\n")
|
||||||
self.trs.write(":recheck: no\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:
|
if self.errored or failed:
|
||||||
self.trs.write(":copy-in-global-log: yes\n")
|
self.trs.write(":copy-in-global-log: yes\n")
|
||||||
|
|
||||||
# Process result code
|
# Process result code
|
||||||
return self.errored and 1 or 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
class SimpleDriver(Driver):
|
class SimpleDriver(Driver):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
@ -270,30 +275,40 @@ class SimpleDriver(Driver):
|
|||||||
self.trs.write(":global-test-result: PASS\n")
|
self.trs.write(":global-test-result: PASS\n")
|
||||||
self.trs.write(":test-global-result: PASS\n")
|
self.trs.write(":test-global-result: PASS\n")
|
||||||
self.trs.write(":recheck: no\n")
|
self.trs.write(":recheck: no\n")
|
||||||
return 0
|
|
||||||
elif returncode == 77:
|
elif returncode == 77:
|
||||||
self.result_skip()
|
self.result_skip()
|
||||||
self.trs.write(":global-test-result: SKIP\n")
|
self.trs.write(":global-test-result: SKIP\n")
|
||||||
self.trs.write(":test-global-result: SKIP\n")
|
self.trs.write(":test-global-result: SKIP\n")
|
||||||
self.trs.write(":recheck: no\n")
|
self.trs.write(":recheck: no\n")
|
||||||
return 0
|
|
||||||
elif returncode == 99:
|
elif returncode == 99:
|
||||||
self.result_error()
|
self.report_error()
|
||||||
self.trs.write(":global-test-result: ERROR\n")
|
self.trs.write(":global-test-result: ERROR\n")
|
||||||
self.trs.write(":test-global-result: ERROR\n")
|
self.trs.write(":test-global-result: ERROR\n")
|
||||||
self.trs.write(":copy-in-global-log: yes\n")
|
self.trs.write(":copy-in-global-log: yes\n")
|
||||||
self.trs.write(":recheck: no\n")
|
self.trs.write(":recheck: yes\n")
|
||||||
return 1
|
|
||||||
else:
|
else:
|
||||||
self.result_fail()
|
self.result_fail()
|
||||||
self.trs.write(":global-test-result: FAIL\n")
|
self.trs.write(":global-test-result: FAIL\n")
|
||||||
self.trs.write(":test-global-result: FAIL\n")
|
self.trs.write(":test-global-result: FAIL\n")
|
||||||
self.trs.write(":copy-in-global-log: yes\n")
|
self.trs.write(":copy-in-global-log: yes\n")
|
||||||
self.trs.write(":recheck: yes\n")
|
self.trs.write(":recheck: yes\n")
|
||||||
return 0
|
|
||||||
|
|
||||||
# Process result code
|
# Process result code
|
||||||
return self.errored and 1 or 0
|
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):
|
class YesNoAction(argparse.Action):
|
||||||
def __init__(self, option_strings, dest, **kwargs):
|
def __init__(self, option_strings, dest, **kwargs):
|
||||||
@ -305,10 +320,13 @@ class YesNoAction(argparse.Action):
|
|||||||
else:
|
else:
|
||||||
setattr(namespace, self.dest, False)
|
setattr(namespace, self.dest, False)
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
parser = argparse.ArgumentParser(description='Automake TAP driver')
|
parser = argparse.ArgumentParser(description='Automake TAP driver')
|
||||||
parser.add_argument('--format', metavar='FORMAT', choices=[ "simple", "tap" ],
|
parser.add_argument('--format', metavar='FORMAT', choices=[ "simple", "tap" ],
|
||||||
default="simple", help='The type of test to drive')
|
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',
|
parser.add_argument('--test-name', metavar='NAME',
|
||||||
help='The name of the test')
|
help='The name of the test')
|
||||||
parser.add_argument('--log-file', metavar='PATH.log', required=True,
|
parser.add_argument('--log-file', metavar='PATH.log', required=True,
|
||||||
@ -327,7 +345,9 @@ def main(argv):
|
|||||||
|
|
||||||
if not args.test_name:
|
if not args.test_name:
|
||||||
args.test_name = os.path.basename(args.command[0])
|
args.test_name = os.path.basename(args.command[0])
|
||||||
if args.format == "simple":
|
if args.missing:
|
||||||
|
driver = MissingDriver(args)
|
||||||
|
elif args.format == "simple":
|
||||||
driver = SimpleDriver(args)
|
driver = SimpleDriver(args)
|
||||||
elif args.format == "tap":
|
elif args.format == "tap":
|
||||||
driver = TapDriver(args)
|
driver = TapDriver(args)
|
@ -80,7 +80,8 @@ class GTestCompiler(NullCompiler):
|
|||||||
print "not ok %d %s", (self.test_num, self.test_name)
|
print "not ok %d %s", (self.test_num, self.test_name)
|
||||||
self.test_name = None
|
self.test_name = None
|
||||||
elif cmd == "skipping":
|
elif cmd == "skipping":
|
||||||
print "ok %d # skip -- %s" % (self.test_num, self.test_name)
|
if "/subprocess" not in data:
|
||||||
|
print "ok %d # skip -- %s" % (self.test_num, data)
|
||||||
self.test_name = None
|
self.test_name = None
|
||||||
elif data:
|
elif data:
|
||||||
print "# %s: %s" % (cmd, data)
|
print "# %s: %s" % (cmd, data)
|
||||||
@ -97,7 +98,8 @@ class GTestCompiler(NullCompiler):
|
|||||||
output += proc.stdout.read()
|
output += proc.stdout.read()
|
||||||
proc.wait()
|
proc.wait()
|
||||||
if proc.returncode:
|
if proc.returncode:
|
||||||
raise subprocess.CalledProcessError(proc.returncode, self.command)
|
sys.stderr.write("tap-gtester: listing GTest tests failed: %d\n" % proc.returncode)
|
||||||
|
return proc.returncode
|
||||||
self.test_remaining = []
|
self.test_remaining = []
|
||||||
for line in output.split("\n"):
|
for line in output.split("\n"):
|
||||||
if line.startswith("/"):
|
if line.startswith("/"):
|
||||||
@ -130,7 +132,7 @@ class GTestCompiler(NullCompiler):
|
|||||||
result = self.process(proc)
|
result = self.process(proc)
|
||||||
|
|
||||||
# The various exit codes and signals we continue for
|
# The various exit codes and signals we continue for
|
||||||
if result not in [ 0, 1, -4, -5, -6, -7, -8, -11 ]:
|
if result not in [ 0, 1, -4, -5, -6, -7, -8, -11, 33 ]:
|
||||||
break
|
break
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user