[Asterisk-code-review] test_config.py: Use faster method for checking IPv6 support in pjsua (testsuite[13])

Sean Bright asteriskteam at digium.com
Wed Jan 8 13:28:48 CST 2020


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/13583 )


Change subject: test_config.py: Use faster method for checking IPv6 support in pjsua
......................................................................

test_config.py: Use faster method for checking IPv6 support in pjsua

When running `pjsua --help` there is a long delay after the command
completes while pjsua_destroy2() is executing. There does not seem to be
a combination of command line flags that will prevent that from occurring.

Instead, we grep the pjsua binary for the '--ipv6' command line flag
which would not be present if pjsua was not built with IPv6 support.

This shaves about 1 second off of a ./run-tests -l

Change-Id: I59071a363611dff192ef3df80ecd262184d1bbf2
---
M lib/python/asterisk/test_config.py
1 file changed, 3 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/83/13583/1

diff --git a/lib/python/asterisk/test_config.py b/lib/python/asterisk/test_config.py
index b395e63..12e150a 100644
--- a/lib/python/asterisk/test_config.py
+++ b/lib/python/asterisk/test_config.py
@@ -220,14 +220,11 @@
         To do this, we run pjsua --help and parse the output to determine if
         --ipv6 is a valid option
         """
-        if test_suite_utils.which('pjsua') is None:
+        pjsua_bin = test_suite_utils.which('pjsua')
+        if pjsua_bin is None:
             return False
 
-        help_output = subprocess.Popen(['pjsua', '--help'],
-                                       stdout=subprocess.PIPE).communicate()[0]
-        if help_output.find('--ipv6') == -1:
-            return False
-        return True
+        return subprocess.call(['grep', pjsua_bin, '-qe', '--ipv6']) == 0
 
     def depend_fax(self):
         """Checks if Asterisk contains the necessary modules for fax tests"""

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/13583
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-Change-Id: I59071a363611dff192ef3df80ecd262184d1bbf2
Gerrit-Change-Number: 13583
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200108/2da53cb7/attachment.html>


More information about the asterisk-code-review mailing list