[asterisk-commits] kharwell: testsuite/asterisk/trunk r4454 - in /asterisk/trunk: configs/ lib/p...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 13 15:32:23 CST 2013


Author: kharwell
Date: Fri Dec 13 15:32:11 2013
New Revision: 4454

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4454
Log:
pjsip tests: interactions with chan_sip cause test failures

While chan_sip and chan_pjsip can be loaded and used at the same time it was
causing problems in the testsuite because their defaults try to bind to the
same host:port.  So for the testsuite made is so any test that depends on
res_pjsip will "noload" chan_sip.  Instead of manipulating every current
res_pjsip test (through their own modules.conf or config setting), this fix
checks to see if the test requires/depends on res_pjsip and if it does it
appends a noload => chan_sip.so to the copied modules.conf for that test.

This functionality is configured via the newly added conflicts.txt file.
Any new conflicts that may arise hopefully can reuse the mechanism.

(closes issue ASTERISK-22887)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3060/

Added:
    asterisk/trunk/configs/conflicts.txt   (with props)
    asterisk/trunk/configs/modules.conf   (with props)
Modified:
    asterisk/trunk/lib/python/asterisk/TestCase.py
    asterisk/trunk/lib/python/asterisk/TestConfig.py
    asterisk/trunk/lib/python/asterisk/asterisk.py
    asterisk/trunk/tests/apps/chanspy/chanspy_barge/test-config.yaml
    asterisk/trunk/tests/apps/chanspy/chanspy_w_mixmonitor/test-config.yaml
    asterisk/trunk/tests/apps/confbridge/confbridge_dynamic_menus/test-config.yaml
    asterisk/trunk/tests/apps/confbridge/confbridge_nominal/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_answer/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_busy/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_congestion/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_dtmf_hangup_cancel/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_hangup/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_no_answer/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_busy/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_cancel/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_congestion/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_no_answer/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_unavail/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_busy/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_congestion/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_no_answer/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_unavail/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_timeout/test-config.yaml
    asterisk/trunk/tests/apps/dial/dial_unavail/test-config.yaml
    asterisk/trunk/tests/apps/directory/directory_attendant_exit/test-config.yaml
    asterisk/trunk/tests/apps/directory/directory_context_operator_exit/test-config.yaml
    asterisk/trunk/tests/apps/directory/directory_operator_exit/test-config.yaml
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml
    asterisk/trunk/tests/apps/queues/ringinuse_and_pause/test-config.yaml
    asterisk/trunk/tests/apps/queues/set_penalty/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/authenticate_extensions/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/authenticate_invalid_mailbox/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/authenticate_invalid_password/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/authenticate_nominal/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_callback/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_delete/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_dialout/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_envelope/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_forward/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_forward_hangup/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_forward_with_prepend/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_new_user/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_new_user_hangup/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_options_change_password/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_options_record_busy/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_options_record_name/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_options_record_temp/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_options_record_unavail/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_reply/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/check_voicemail_while_leaving_msg/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/test-config.yaml
    asterisk/trunk/tests/bridge/atxfer_nominal/test-config.yaml
    asterisk/trunk/tests/bridge/atxfer_threeway_nominal/test-config.yaml
    asterisk/trunk/tests/bridge/blindxfer_nominal/test-config.yaml
    asterisk/trunk/tests/bridge/blonde_nominal/test-config.yaml
    asterisk/trunk/tests/cdr/app_dial_G_flag/test-config.yaml
    asterisk/trunk/tests/cdr/app_queue/test-config.yaml
    asterisk/trunk/tests/cdr/cdr_manipulation/cdr_fork_end_time/test-config.yaml
    asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_after_busy_forward/test-config.yaml
    asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_before_dial/test-config.yaml
    asterisk/trunk/tests/cdr/cdr_originate_sip_congestion_log/test-config.yaml
    asterisk/trunk/tests/cdr/cdr_properties/blind-transfer-accountcode/test-config.yaml
    asterisk/trunk/tests/cdr/console_dial_sip_answer/test-config.yaml
    asterisk/trunk/tests/cdr/console_dial_sip_busy/test-config.yaml
    asterisk/trunk/tests/cdr/console_dial_sip_congestion/test-config.yaml
    asterisk/trunk/tests/cdr/console_dial_sip_transfer/test-config.yaml
    asterisk/trunk/tests/cdr/originate-cdr-disposition/test-config.yaml
    asterisk/trunk/tests/channels/SIP/SDP_attribute_passthrough/test-config.yaml
    asterisk/trunk/tests/channels/SIP/SDP_offer_answer/test-config.yaml
    asterisk/trunk/tests/channels/SIP/acl_call/test-config.yaml
    asterisk/trunk/tests/channels/SIP/alwaysauthreject/test-config.yaml
    asterisk/trunk/tests/channels/SIP/custom_info/test-config.yaml
    asterisk/trunk/tests/channels/SIP/device_state_notification/test-config.yaml
    asterisk/trunk/tests/channels/SIP/directrtpsetup/test-config.yaml
    asterisk/trunk/tests/channels/SIP/generic_ccss/test-config.yaml
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/test-config.yaml
    asterisk/trunk/tests/channels/SIP/handle_response_refer/test-config.yaml
    asterisk/trunk/tests/channels/SIP/hangupcause/test-config.yaml
    asterisk/trunk/tests/channels/SIP/header_parsing/test-config.yaml
    asterisk/trunk/tests/channels/SIP/info_dtmf/test-config.yaml
    asterisk/trunk/tests/channels/SIP/invite_no_totag/test-config.yaml
    asterisk/trunk/tests/channels/SIP/message_auth/test-config.yaml
    asterisk/trunk/tests/channels/SIP/message_auth_cust_hdr/test-config.yaml
    asterisk/trunk/tests/channels/SIP/message_disabled/test-config.yaml
    asterisk/trunk/tests/channels/SIP/message_from_call/test-config.yaml
    asterisk/trunk/tests/channels/SIP/message_mark_all_outbound/test-config.yaml
    asterisk/trunk/tests/channels/SIP/message_send_ami/test-config.yaml
    asterisk/trunk/tests/channels/SIP/message_unauth/test-config.yaml
    asterisk/trunk/tests/channels/SIP/message_unauth_from/test-config.yaml
    asterisk/trunk/tests/channels/SIP/nat_supertest/test-config.yaml
    asterisk/trunk/tests/channels/SIP/noload_res_srtp/test-config.yaml
    asterisk/trunk/tests/channels/SIP/noload_res_srtp_attempt_srtp/test-config.yaml
    asterisk/trunk/tests/channels/SIP/options/test-config.yaml
    asterisk/trunk/tests/channels/SIP/path/test-config.yaml
    asterisk/trunk/tests/channels/SIP/pcap_demo/test-config.yaml
    asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml
    asterisk/trunk/tests/channels/SIP/realtime_sipregs/test-config.yaml
    asterisk/trunk/tests/channels/SIP/refer_replaces_to_self/test-config.yaml
    asterisk/trunk/tests/channels/SIP/rfc2833_dtmf_detect/test-config.yaml
    asterisk/trunk/tests/channels/SIP/secure_bridge_media/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/check_require/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uac_multiple_422_accept/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uac_multiple_422_originate/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uac_se_below_minse/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_minimum_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/large_minse_large_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/large_minse_no_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/medium_minse_large_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/medium_minse_medium_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/medium_minse_no_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/no_minse_large_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/no_minse_medium_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/no_minse_no_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/no_minse_small_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/small_minse_large_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/small_minse_medium_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/small_minse_no_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/session_timers/uas_originate/small_minse_small_se/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip2cause/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer_v6/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_refer_only/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_refer_only/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_with_reinvite/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_cause/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_channel_params/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/nominal_state_change/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_custom_presence/resubscribe/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_hold/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_hold_direct_media/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_hold_no_moh/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer_v6/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_outbound_proxy/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_register/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_register_domain_acl/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_srtp/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_tls_call/test-config.yaml
    asterisk/trunk/tests/channels/SIP/sip_tls_register/test-config.yaml
    asterisk/trunk/tests/channels/SIP/subscribe/test-config.yaml
    asterisk/trunk/tests/channels/SIP/use_contact_from_200/test-config.yaml
    asterisk/trunk/tests/channels/local/local_app/test-config.yaml
    asterisk/trunk/tests/channels/local/local_call/test-config.yaml
    asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml
    asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml
    asterisk/trunk/tests/channels/pjsip/registration/outbound/forbidden_retry/test-config.yaml
    asterisk/trunk/tests/fax/directmedia_reinvite_t38/test-config.yaml
    asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml
    asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml
    asterisk/trunk/tests/fax/gateway_mix2/test-config.yaml
    asterisk/trunk/tests/fax/gateway_mix3/test-config.yaml
    asterisk/trunk/tests/fax/gateway_mix4/test-config.yaml
    asterisk/trunk/tests/fax/gateway_native_t38/test-config.yaml
    asterisk/trunk/tests/fax/gateway_native_t38_ced/test-config.yaml
    asterisk/trunk/tests/fax/gateway_no_t38/test-config.yaml
    asterisk/trunk/tests/fax/gateway_t38_g711/test-config.yaml
    asterisk/trunk/tests/fax/gateway_timeout1/test-config.yaml
    asterisk/trunk/tests/fax/gateway_timeout2/test-config.yaml
    asterisk/trunk/tests/fax/gateway_timeout3/test-config.yaml
    asterisk/trunk/tests/fax/gateway_timeout4/test-config.yaml
    asterisk/trunk/tests/fax/gateway_timeout5/test-config.yaml
    asterisk/trunk/tests/fax/local_channel_t38_queryoption/test-config.yaml
    asterisk/trunk/tests/fax/voxfax_g711/test-config.yaml
    asterisk/trunk/tests/feature_call_pickup/test-config.yaml
    asterisk/trunk/tests/funcs/func_jitterbuffer/test-config.yaml
    asterisk/trunk/tests/masquerade/test-config.yaml
    asterisk/trunk/tests/pbx/merge_contexts/test-config.yaml
    asterisk/trunk/tests/pbx/pbx_lua_background/test-config.yaml
    asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml
    asterisk/trunk/tests/regressions/M18882/test-config.yaml
    asterisk/trunk/tests/udptl/test-config.yaml
    asterisk/trunk/tests/udptl_v6/test-config.yaml

Added: asterisk/trunk/configs/conflicts.txt
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/configs/conflicts.txt?view=auto&rev=4454
==============================================================================
--- asterisk/trunk/configs/conflicts.txt (added)
+++ asterisk/trunk/configs/conflicts.txt Fri Dec 13 15:32:11 2013
@@ -1,0 +1,13 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; this file contains a key/value mapping of conflicts between loadable modules.
+;;
+;; if a test has a dependency (the key) it will not load the associated comma
+;; separated list of modules (the value).
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; chan_sip and chan_pjsip don't play nice with each other unless configured
+;; correctly so don't load chan_sip if it is a chan/res_pjsip test.
+res_pjsip=chan_sip.so
+
+;; and don't load chan_pjsip if the test uses chan_sip
+chan_sip=chan_pjsip.so,res_pjsip.so,res_pjsip_pubsub.so,res_pjsip_session.so

Propchange: asterisk/trunk/configs/conflicts.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/configs/conflicts.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/configs/conflicts.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/configs/modules.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/configs/modules.conf?view=auto&rev=4454
==============================================================================
--- asterisk/trunk/configs/modules.conf (added)
+++ asterisk/trunk/configs/modules.conf Fri Dec 13 15:32:11 2013
@@ -1,0 +1,10 @@
+; Do not delete -
+; May be appended with noloads due to conflicts (see conflicts.txt)
+
+[modules]
+autoload=yes
+
+noload => chan_alsa.so
+noload => chan_oss.so
+noload => chan_console.so
+

Propchange: asterisk/trunk/configs/modules.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/configs/modules.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/configs/modules.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestCase.py?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestCase.py Fri Dec 13 15:32:11 2013
@@ -188,10 +188,11 @@
             """ If a base configuration for this Asterisk instance has been
             provided, install it first"""
             if base_configs_path:
-                self.ast[c].install_configs("%s/ast%d" % (base_configs_path, c + 1))
+                self.ast[c].install_configs("%s/ast%d" % (base_configs_path, c + 1),
+                                            self.test_config.get_deps())
             """ Copy test specific config files """
             self.ast[c].install_configs("%s/configs/ast%d" %
-                    (self.test_name, c + 1))
+                    (self.test_name, c + 1), self.test_config.get_deps())
 
     def create_ami_factory(self, count=1, username="user", secret="mysecret", port=5038):
         """
@@ -301,7 +302,7 @@
         start_defers = []
         for index, item in enumerate(self.ast):
             logger.info("Starting Asterisk instance %d" % (index + 1))
-            temp_defer = self.ast[index].start()
+            temp_defer = self.ast[index].start(self.test_config.get_deps())
             start_defers.append(temp_defer)
 
         d = defer.DeferredList(start_defers, consumeErrors=True)

Modified: asterisk/trunk/lib/python/asterisk/TestConfig.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestConfig.py?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestConfig.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestConfig.py Fri Dec 13 15:32:11 2013
@@ -393,6 +393,21 @@
 
         return conditions
 
+    def get_deps(self):
+        if not self.config:
+            return []
+
+        if not "properties" in self.config:
+            raise ValueError("%s: Missing properties section" % self.test_name)
+
+        if not self.deps:
+            self.deps = [
+                Dependency(d)
+                for d in self.config["properties"].get("dependencies") or []
+            ]
+        return self.deps
+
+
     def check_deps(self, ast_version):
         """
         Check whether or not a test should execute based on its configured dependencies
@@ -405,14 +420,6 @@
 
         if not self.config:
             return False
-
-        if not "properties" in self.config:
-            raise ValueError("%s: Missing properties section" % self.test_name)
-
-        self.deps = [
-            Dependency(d)
-                for d in self.config["properties"].get("dependencies") or []
-        ]
 
         if self.forced_version is not None:
             ast_version = self.forced_version
@@ -434,7 +441,7 @@
             if not self.feature_check[f]:
                 self.can_run = False
 
-        for d in self.deps:
+        for d in self.get_deps():
             if d.met is False:
                 self.can_run = False
                 break

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=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Fri Dec 13 15:32:11 2013
@@ -1,3 +1,4 @@
+
 #!/usr/bin/env python
 """ Asterisk Instances in Python.
 
@@ -247,7 +248,7 @@
                 for (var, val) in c.options:
                     self.directories[var] = val
 
-    def start(self):
+    def start(self, deps=None):
         """ Start this instance of Asterisk.
 
         Returns:
@@ -286,7 +287,7 @@
                 logger.debug("Asterisk core waitfullybooted failed, attempting again...")
                 reactor.callLater(1, __execute_wait_fully_booted)
 
-        self.install_configs(os.getcwd() + "/configs")
+        self.install_configs(os.getcwd() + "/configs", deps)
         self.__setup_configs()
 
         self.cmd = [
@@ -410,7 +411,7 @@
 
         return self.__stop_deferred
 
-    def install_configs(self, cfg_path):
+    def install_configs(self, cfg_path, deps=None):
         """Installs all files located in the configuration directory for this
         instance of Asterisk.
 
@@ -438,6 +439,9 @@
         if not self.__configs_installed and cfg_path != ("%s/configs" % os.getcwd()):
             """ Do a one-time installation of the base configs """
             self.install_configs("%s/configs" % os.getcwd())
+            # the default modules.conf should be installed now, so append conflicts
+            # this can be overriden of course by a test specific modules.conf
+            self.__append_modules_conf(deps)
             self.__configs_installed = True
 
         if not os.access(cfg_path, os.F_OK):
@@ -692,6 +696,44 @@
 
         f.close()
 
+    def __get_module_conflicts(self, deps):
+        if not deps:
+            return []
+
+        conflicts = []
+        try:
+            with open(os.getcwd() + '/configs/' + 'conflicts.txt', 'r') as f:
+                for line in f:
+                    line = line.strip()
+                    if not line or line[0] == ';':
+                        continue
+
+                    key, val = line.split('=')
+                    if next((d for d in deps if key == d.name), None):
+                        for v in val.split(','):
+                            conflicts.append(v.strip())
+        except:
+            pass
+        return conflicts
+
+    def __append_modules_conf(self, deps):
+        conflicts = self.__get_module_conflicts(deps)
+
+        if not conflicts:
+            return
+
+        modules_conf = os.path.join(self.astetcdir, "modules.conf")
+        try:
+            with open(modules_conf, "a") as f:
+                for c in conflicts:
+                    f.write('noload => %s\n' % c)
+        except IOError:
+            logger.error("Failed to open %s" % modules_conf)
+            return
+        except:
+            logger.error("Unexpected error: %s" % sys.exc_info()[0])
+            return
+
     def __mirror_dir(self, ast_dir_name, ast_dir_path, cache):
         self.__makedirs(ast_dir_path)
         dirs_only = ["astrundir", "astlogdir", "astspooldir"]

Modified: asterisk/trunk/tests/apps/chanspy/chanspy_barge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/chanspy/chanspy_barge/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/chanspy/chanspy_barge/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/chanspy/chanspy_barge/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -17,6 +17,7 @@
         - python : 'starpy'
         - app : 'pjsua'
         - asterisk : 'app_talkdetect'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - chanspy

Modified: asterisk/trunk/tests/apps/chanspy/chanspy_w_mixmonitor/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/chanspy/chanspy_w_mixmonitor/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/chanspy/chanspy_w_mixmonitor/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/chanspy/chanspy_w_mixmonitor/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -16,6 +16,7 @@
         - python : 'starpy'
         - app : 'pjsua'
         - asterisk : 'app_talkdetect'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - chanspy

Modified: asterisk/trunk/tests/apps/confbridge/confbridge_dynamic_menus/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/confbridge/confbridge_dynamic_menus/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/confbridge/confbridge_dynamic_menus/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/confbridge/confbridge_dynamic_menus/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -388,4 +388,6 @@
       - asterisk : 'app_confbridge'
       - asterisk : 'app_senddtmf'
       - asterisk : 'app_playback'
-
+      - asterisk : 'chan_sip'
+
+

Modified: asterisk/trunk/tests/apps/confbridge/confbridge_nominal/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/confbridge/confbridge_nominal/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/confbridge/confbridge_nominal/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/confbridge/confbridge_nominal/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -18,3 +18,4 @@
         - asterisk : 'app_confbridge'
         - asterisk : 'app_senddtmf'
         - asterisk : 'app_playback'
+        - asterisk : 'chan_sip'

Modified: asterisk/trunk/tests/apps/dial/dial_answer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_answer/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_answer/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_answer/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_busy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_busy/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_busy/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_busy/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_congestion/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_congestion/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_congestion/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_congestion/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_dtmf_hangup_cancel/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_dtmf_hangup_cancel/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_dtmf_hangup_cancel/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_dtmf_hangup_cancel/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -10,6 +10,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_hangup/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_hangup/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_hangup/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_hangup/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -10,6 +10,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_no_answer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_no_answer/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_no_answer/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_no_answer/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_busy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_busy/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_busy/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_busy/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_cancel/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_cancel/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_cancel/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_cancel/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -10,6 +10,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_congestion/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_congestion/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_congestion/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_congestion/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_no_answer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_no_answer/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_no_answer/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_no_answer/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_unavail/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_unavail/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_unavail/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_all_unavail/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -10,6 +10,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_busy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_busy/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_busy/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_busy/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_congestion/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_congestion/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_congestion/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_congestion/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_no_answer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_no_answer/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_no_answer/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_no_answer/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_unavail/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_unavail/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_unavail/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_parallel/dial_parallel_single_unavail/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_timeout/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_timeout/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_timeout/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_timeout/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -10,6 +10,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'
+        - asterisk : 'chan_sip'
     tags:
         - SIP
         - dial

Modified: asterisk/trunk/tests/apps/dial/dial_unavail/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/dial/dial_unavail/test-config.yaml?view=diff&rev=4454&r1=4453&r2=4454
==============================================================================
--- asterisk/trunk/tests/apps/dial/dial_unavail/test-config.yaml (original)
+++ asterisk/trunk/tests/apps/dial/dial_unavail/test-config.yaml Fri Dec 13 15:32:11 2013
@@ -9,6 +9,7 @@
         - python : 'twisted'
         - python : 'starpy'
         - app : 'sipp'

[... 2325 lines stripped ...]



More information about the asterisk-commits mailing list