[asterisk-commits] sgriepentrog: testsuite/asterisk/trunk r5942 - in /asterisk/trunk: ./ lib/pyt...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 18 09:49:09 CST 2014
Author: sgriepentrog
Date: Tue Nov 18 09:48:55 2014
New Revision: 5942
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5942
Log:
testsuite: add basic valgrind support
This adds very basic support for running Asterisk
instances under Valgrind, which is convenient for
manual test runs but does not yet include parsing
the output for failures.
1) Testsuite CLI flag '-V' enables valgrind:
./runtests -V -t tests/test...
2) Valgrind output is picked up by error logging
and shown after test run.
3) Works with multiple Asterisk instances.
Reviewboard: https://reviewboard.asterisk.org/r/4090/
Modified:
asterisk/trunk/lib/python/asterisk/asterisk.py
asterisk/trunk/lib/python/asterisk/test_case.py
asterisk/trunk/runtests.py
Modified: asterisk/trunk/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/asterisk.py?view=diff&rev=5942&r1=5941&r2=5942
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Tue Nov 18 09:48:55 2014
@@ -332,7 +332,7 @@
def __wait_fully_booted_error(cli_command):
"""Errback for CLI command waitfullybooted"""
- if time.time() - self.__start_asterisk_time > 5:
+ if time.time() - self.__start_asterisk_time > 90:
msg = "Asterisk core waitfullybooted for %s failed" % self.host
LOGGER.error(msg)
self._start_deferred.errback(Exception(msg))
@@ -350,6 +350,14 @@
"-f", "-g", "-q", "-m", "-n",
"-C", "%s" % os.path.join(self.astetcdir, "asterisk.conf")
]
+
+ if os.getenv("VALGRIND_ENABLE") == "true":
+ valgrind_path = test_suite_utils.which('valgrind')
+ if valgrind_path:
+ cmd = [valgrind_path] + cmd
+ else:
+ LOGGER.error('Valgrind not found')
+
# Make the start/stop deferreds - this method will return
# the start deferred, and pass the stop deferred to the AsteriskProtocol
@@ -455,7 +463,7 @@
else:
# Schedule a kill. If we don't gracefully shut down Asterisk, this
# will ensure that the test is stopped.
- self._stop_cancel_tokens.append(reactor.callLater(10, __send_kill))
+ self._stop_cancel_tokens.append(reactor.callLater(200, __send_kill))
# Start by asking to stop gracefully.
__send_stop_gracefully()
Modified: asterisk/trunk/lib/python/asterisk/test_case.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/test_case.py?view=diff&rev=5942&r1=5941&r2=5942
==============================================================================
--- asterisk/trunk/lib/python/asterisk/test_case.py (original)
+++ asterisk/trunk/lib/python/asterisk/test_case.py Tue Nov 18 09:48:55 2014
@@ -137,6 +137,9 @@
self._ami_callbacks = []
self._pcap_callbacks = []
self._stop_deferred = None
+
+ if os.getenv("VALGRIND_ENABLE") == "true":
+ self.reactor_timeout *= 20
# Pull additional configuration from YAML config if possible
if test_config:
Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=5942&r1=5941&r2=5942
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Tue Nov 18 09:48:55 2014
@@ -497,6 +497,9 @@
parser.add_option("-n", "--dry-run", action="store_true",
dest="dry_run", default=False,
help="Only show which tests would be run.")
+ parser.add_option("-V", "--valgrind", action="store_true",
+ dest="valgrind", default=False,
+ help="Run Asterisk under Valgrind")
(options, args) = parser.parse_args(argv)
ast_version = AsteriskVersion(options.version)
@@ -516,6 +519,9 @@
if options.list_tags:
test_suite.list_tags()
return 0
+
+ if options.valgrind:
+ os.environ["VALGRIND_ENABLE"] = "true"
print "Running tests for Asterisk %s ...\n" % str(ast_version)
More information about the asterisk-commits
mailing list