[asterisk-commits] mjordan: testsuite/asterisk/trunk r3761 - in /asterisk/trunk/tests/funcs: ./ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 4 10:11:22 CDT 2013


Author: mjordan
Date: Sat May  4 10:11:20 2013
New Revision: 3761

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3761
Log:
Add a test for GLOBAL/SHARED functions

This patch adds a test for the functions in func_global.
This includes setting a global variable via the GLOBAL function,
as well as sharing a variable between channels using the SHARED
function.

Added:
    asterisk/trunk/tests/funcs/func_global/
    asterisk/trunk/tests/funcs/func_global/configs/
    asterisk/trunk/tests/funcs/func_global/configs/ast1/
    asterisk/trunk/tests/funcs/func_global/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/funcs/func_global/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/funcs/tests.yaml

Added: asterisk/trunk/tests/funcs/func_global/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/funcs/func_global/configs/ast1/extensions.conf?view=auto&rev=3761
==============================================================================
--- asterisk/trunk/tests/funcs/func_global/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/funcs/func_global/configs/ast1/extensions.conf Sat May  4 10:11:20 2013
@@ -1,0 +1,34 @@
+[default]
+
+exten => echo,1,NoOp()
+	same => n,Answer()
+	same => n,Echo()
+
+exten => test,1,NoOp()
+	same => n,Answer()
+	same => n,Set(GLOBAL(global_channel)=${CHANNEL})
+	same => n,Set(SHARED(foo)=bar)
+	same => n,Originate(Local/newchan at default,exten,default,echo,1)
+	same => n,Set(test_counter=0)
+	same => n(loop),GotoIf($[${SHARED(foo,${CHANNEL})}=baz]?pass:)
+	same => n,Wait(1)
+	same => n,Set(test_counter=${INC(test_counter)})
+	same => n,GotoIf($[${test_counter}=5]?fail:loop)
+	same => n(fail),NoOp()
+	same => n,UserEvent(TestResult,Status:fail)
+	same => n,Hangup()
+	same => n(pass),NoOp()
+	same => n,UserEvent(TestResult,Status:pass)
+	same => n,Hangup()
+
+exten => newchan,1,NoOp()
+	same => n,Answer()
+	same => n,Set(shared_channel=${GLOBAL(global_channel)})
+	same => n,Set(foo=${SHARED(foo,${shared_channel})})
+	same => n,GotoIf($[${foo}=bar]?pass:fail)
+	same => n(fail),NoOp()
+	same => n,UserEvent(TestResult,Status:fail)
+	same => n,Hangup()
+	same => n(pass),NoOp()
+	same => n,Set(SHARED(foo,${shared_channel})=baz)
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/funcs/func_global/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/funcs/func_global/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/funcs/func_global/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/funcs/func_global/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/funcs/func_global/test-config.yaml?view=auto&rev=3761
==============================================================================
--- asterisk/trunk/tests/funcs/func_global/test-config.yaml (added)
+++ asterisk/trunk/tests/funcs/func_global/test-config.yaml Sat May  4 10:11:20 2013
@@ -1,0 +1,58 @@
+testinfo:
+    summary:     'Tests for GLOBAL and SHARED functions'
+    description: |
+        'This test exercises the functions contained in the func_global module,
+        including the GLOBAL and SHARED functions. This includes setting and
+        retrieving global variables as well as variables shared between
+        channels.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'SimpleTestCase.SimpleTestCase'
+    modules:
+        -
+            config-section: ami-object-config
+            typename: 'ami.AMIEventModule'
+
+
+test-object-config:
+    spawn-after-hangup: True
+    ignore-originate-failures: True
+    test-iterations:
+        -
+            channel: 'Local/test at default'
+            application: 'Echo'
+
+ami-object-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'TestResult'
+        requirements:
+            match:
+                Status: 'pass'
+        count: '1'
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'SHARED(foo)'
+        requirements:
+            -
+                match:
+                    Value: 'bar'
+            -
+                match:
+                    Value: 'baz'
+
+
+properties:
+    minversion: '1.8.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk : 'func_global'

Propchange: asterisk/trunk/tests/funcs/func_global/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/funcs/func_global/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/funcs/func_global/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/funcs/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/funcs/tests.yaml?view=diff&rev=3761&r1=3760&r2=3761
==============================================================================
--- asterisk/trunk/tests/funcs/tests.yaml (original)
+++ asterisk/trunk/tests/funcs/tests.yaml Sat May  4 10:11:20 2013
@@ -3,3 +3,4 @@
     - test: 'func_jitterbuffer'
     - test: 'func_srv'
     - test: 'func_presencestate'
+    - test: 'func_global'




More information about the asterisk-commits mailing list