[Asterisk-code-review] runtests: Add an option (-k|--keep-core) to keep a core file (testsuite[master])

Matt Jordan asteriskteam at digium.com
Sun Oct 4 20:17:15 CDT 2015


Matt Jordan has uploaded a new change for review.

  https://gerrit.asterisk.org/1373

Change subject: runtests: Add an option (-k|--keep-core) to keep a core file
......................................................................

runtests: Add an option (-k|--keep-core) to keep a core file

Sometimes, when the Test Suite is being used to diagnose some particularly
heinous crash in Asterisk, it is useful to keep the core file generated from
the crashing instance. By default, the Test Suite removes these core files.
This is a good default option to have; the Test Suite is run on CI build
agents, and in the past we ran into situations where the generated core files
caused the disk to run out of memory (particularly when someone commits a
change that causes Asterisk to crash on startup/shutdown).

This patch adds a command line option, -k or --keep-core, that lets you
override this behaviour when running the Test Suite. This makes it a bit
easier to diagnose problems when running the Test Suite locally.

Change-Id: I5a468e98811b1ff814fdb64aa6808eba3c17460b
---
M runtests.py
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/73/1373/1

diff --git a/runtests.py b/runtests.py
index 13bd8bc..ee4f7c1 100755
--- a/runtests.py
+++ b/runtests.py
@@ -196,7 +196,8 @@
             finally:
                 dest_file.close()
                 try:
-                    os.unlink(core)
+                    if not self.options.keep_core: 
+                        os.unlink(core)
                 except OSError, e:
                     print "Error removing core file: %s: " \
                           "Beware of the stale core file in CWD!" % (e,)
@@ -607,6 +608,9 @@
     parser.add_option("-v", "--version",
                       dest="version", default=None,
                       help="Specify the version of Asterisk rather then detecting it.")
+    parser.add_option("-k", "--keep-core", action="store_true",
+                      dest="keep_core", default=False,
+                      help="Keep the 'core' file if Asterisk crashes.")
     parser.add_option("-L", "--list-tags", action="store_true",
                       dest="list_tags", default=False,
                       help="List available tags")

-- 
To view, visit https://gerrit.asterisk.org/1373
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a468e98811b1ff814fdb64aa6808eba3c17460b
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list