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

Friendly Automation asteriskteam at digium.com
Tue Jan 14 08:06:05 CST 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/13579 )

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, 5 insertions(+), 8 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/lib/python/asterisk/test_config.py b/lib/python/asterisk/test_config.py
index b395e63..6a0a13d 100644
--- a/lib/python/asterisk/test_config.py
+++ b/lib/python/asterisk/test_config.py
@@ -217,17 +217,14 @@
     def depend_pjsuav6(self):
         """This tests if pjsua was compiled with IPv6 support.
 
-        To do this, we run pjsua --help and parse the output to determine if
-        --ipv6 is a valid option
+        To do this, we check if the '--ipv6' command line flag is present
+        in the pjsua binary
         """
-        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/+/13579
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I59071a363611dff192ef3df80ecd262184d1bbf2
Gerrit-Change-Number: 13579
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200114/fb6302f3/attachment.html>


More information about the asterisk-code-review mailing list