[asterisk-commits] sgriepentrog: testsuite/asterisk/trunk r4278 - in /asterisk/trunk/tests: ./ d...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 22 10:44:36 CDT 2013
Author: sgriepentrog
Date: Tue Oct 22 10:44:35 2013
New Revision: 4278
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4278
Log:
Move dialplan test into pbx test subdir
This relocates the dialplan test into pbx subdirectory where it belongs. There is no other change other than to update the test lists in both directories appropriately.
There is no issue associated with this change.
Added:
asterisk/trunk/tests/pbx/dialplan/
asterisk/trunk/tests/pbx/dialplan/configs/
asterisk/trunk/tests/pbx/dialplan/configs/ast1/
asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/pbx/dialplan/test-config.yaml (with props)
Removed:
asterisk/trunk/tests/dialplan/
Modified:
asterisk/trunk/tests/pbx/tests.yaml
asterisk/trunk/tests/tests.yaml
Added: asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf?view=auto&rev=4278
==============================================================================
--- asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf Tue Oct 22 10:44:35 2013
@@ -1,0 +1,327 @@
+; The run-test script will call into the [test] context and iteratively
+; execute a test within this dialplan. Each test, when finished, should
+; execute a Goto statement to return to test,start,top.
+;
+; Tests are organized by dialplan function and can be added below.
+
+; ------------------------------------------------------------------
+; Context used to connect the local channel with the tests
+; ------------------------------------------------------------------
+[DialContext]
+
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+
+; ------------------------------------------------------------------
+; The main test context
+; ------------------------------------------------------------------
+[test]
+exten => s,1,NoOp()
+ same => n,Goto(start,1)
+
+; Start of a test. Each test should begin by starting at the top
+; label in this extension.
+exten => start,1,NoOp()
+ same => n,Set(TestCounter=0)
+ same => n,Set(Result=OK)
+ same => n(top),NoOp()
+ same => n,GotoIf($[${Result} != OK]?result_fail,1)
+ same => n,Set(TestCounter=${INC(TestCounter)})
+ same => n,UserEvent(TestStatus,message: Starting test ${TestCounter})
+ same => n,NoOp(Starting test ${TestCounter})
+
+ ; test numerical extensions
+ same => n,ExecIf($[${TestCounter} = 1]?Goto(patterns,100,1))
+ same => n,ExecIf($[${TestCounter} = 2]?Goto(patterns,101,1))
+ same => n,ExecIf($[${TestCounter} = 3]?Goto(patterns,106,1))
+ same => n,ExecIf($[${TestCounter} = 10]?Goto(patterns,155,1))
+ same => n,ExecIf($[${TestCounter} = 11]?Goto(patterns,255,1))
+
+ ; test alpha extensions
+ same => n,ExecIf($[${TestCounter} = 4]?Goto(patterns,abc,1))
+ same => n,ExecIf($[${TestCounter} = 5]?Goto(patterns,abc0,1))
+ same => n,ExecIf($[${TestCounter} = 6]?Goto(patterns,abc2,1))
+ same => n,ExecIf($[${TestCounter} = 7]?Goto(patterns,cba,1))
+ same => n,ExecIf($[${TestCounter} = 8]?Goto(patterns,cbaz,1))
+ same => n,ExecIf($[${TestCounter} = 9]?Goto(patterns,cbazy,1))
+
+ ; test ignoring dash (Added as a result of ASTERISK-19205)
+ same => n,ExecIf($[${TestCounter} = 15]?Goto(patterns,RG-10111-9999,1))
+ same => n,ExecIf($[${TestCounter} = 16]?Goto(patterns,RG-20111-9999,1))
+ same => n,ExecIf($[${TestCounter} = 17]?Goto(patterns,foo-1,1))
+ same => n,ExecIf($[${TestCounter} = 18]?Goto(patterns,foo-2,1))
+ same => n,ExecIf($[${TestCounter} = 19]?Goto(patterns,foo-,1))
+ same => n,ExecIf($[${TestCounter} = 20]?Goto(patterns,bar-1,1))
+ same => n,ExecIf($[${TestCounter} = 21]?Goto(patterns,bar-2,1))
+
+ ; test subtle matching order of sets of the same size starting with the same char.
+ same => n,ExecIf($[${TestCounter} = 22]?Goto(patterns,Set-2,1))
+
+ ; test ignoring empty set
+ same => n,ExecIf($[${TestCounter} = 23]?Goto(patterns,955,1))
+
+ ; end of pattern match testing
+
+ ; test dialplan functions
+ same => n,ExecIf($[${TestCounter} = 12]?Goto(base64,start,1))
+ same => n,ExecIf($[${TestCounter} = 13]?Goto(aes,start,1))
+ same => n,ExecIf($[${TestCounter} = 14]?Goto(len,start,1))
+
+ ' GoSub testing
+ same => n,ExecIf($[${TestCounter} = 24]?Goto(gosubtest,start,1))
+
+ ; ---------------------------------------------------------------
+ ; NOTE: Add additional dialplan tests before the
+ ; Goto(result_pass,1) statement
+ ; ---------------------------------------------------------------
+
+ same => n,Goto(result_pass,1)
+
+exten => result_pass,1,NoOp()
+ same => n,UserEvent(TestResult,Result: Success)
+ same => n,Set(ResultSent=OK)
+ same => n,Hangup()
+
+exten => result_fail,1,NoOp()
+ same => n,UserEvent(TestResult,Result: Fail,message: Test ${TestCounter} failed.)
+ same => n,Set(ResultSent=OK)
+ same => n,Hangup()
+
+exten => h,1,NoOp()
+ same => n,GotoIf($[${ResultSent} = OK]?done)
+ same => n,UserEvent(TestResult,Result: Fail,message: Unexpected hangup on test ${TestCounter}.)
+ same => n(done),NoOp()
+
+; ---------------------------------------------------------------
+; Pattern matching tests
+; ---------------------------------------------------------------
+[patterns]
+exten => i,1,NoOp(Invalid exten)
+ same => n,Set(Result=Fail)
+ same => n,Goto(test,start,top)
+
+; *** Patterns to match
+exten => 100,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '100')
+ same => n,Set(Result=${IF($[${TestCounter} = 1]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _1X[0-5],1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_1X[0-5]')
+ same => n,Set(Result=${IF($[${TestCounter} = 2]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _1XX,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_1XX')
+ same => n,Set(Result=${IF($[${TestCounter} = 3]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => abc,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on 'abc')
+ same => n,Set(Result=${IF($[${TestCounter} = 4]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _[a][b][c]X,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_[a][b][c]X')
+ same => n,Set(Result=${IF($[${TestCounter} = 5]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _[a][b][c]N,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_[a][b][c]N')
+ same => n,Set(Result=${IF($[${TestCounter} = 6]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => cba,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on 'cba')
+ same => n,Set(Result=${IF($[${TestCounter} = 7]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _[c][b][a]!,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_[c][b][a]!')
+ same => n,Set(Result=${IF($[${TestCounter} = 8]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _[c][b][a][z].,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_[c][b][a][z].')
+ same => n,Set(Result=${IF($[${TestCounter} = 9]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _1[5][0-5],1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_1[5][0-5]')
+ same => n,Set(Result=${IF($[${TestCounter} = 10]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _[1-2][5][0-5],1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_[1-2][5][0-5]')
+ same => n,Set(Result=${IF($[${TestCounter} = 11]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _RG-101-.,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_RG-101-.')
+ same => n,Set(Result=Fail)
+ same => n,Goto(test,start,top)
+
+exten => _RG-10111-.,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_RG-10111-.')
+ same => n,Set(Result=${IF($[${TestCounter} = 15]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _RG-201.,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_RG-201.')
+ same => n,Set(Result=Fail)
+ same => n,Goto(test,start,top)
+
+exten => _RG-20111.,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_RG-20111.')
+ same => n,Set(Result=${IF($[${TestCounter} = 16]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => foo-1,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on 'foo-1')
+ same => n,Set(Result=${IF($[${TestCounter} = 17]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _foo-!,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_foo-!')
+ same => n,Set(Result=${IF($[${TestCounter} = 18 | ${TestCounter} = 19]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => bar-1,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on 'bar-1')
+ same => n,Set(Result=${IF($[${TestCounter} = 20]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _bar.,1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_bar.')
+ same => n,Set(Result=${IF($[${TestCounter} = 21]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _Set-[0-9],1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_Set-[0-9]')
+ same => n,Set(Result=${IF($[${TestCounter} = 22]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+exten => _Set-[02-9a],1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_Set-[02-9a]')
+ same => n,Set(Result=Fail)
+ same => n,Goto(test,start,top)
+
+exten => _9[]5[0-5],1,NoOp()
+ same => n,NoOp(Extension '${EXTEN}' matched on '_9[]5[0-5]')
+ same => n,Set(Result=${IF($[${TestCounter} = 23]?OK:Fail)})
+ same => n,Goto(test,start,top)
+
+; ---------------------------------------------------------------
+; Encryption
+; ---------------------------------------------------------------
+[base64]
+exten => start,1,NoOp()
+ same => n,Set(Encoded=YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODk=)
+ same => n,Set(Decoded=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789)
+ same => n,Set(EncodingResult=${BASE64_ENCODE(${Decoded})})
+ same => n,Set(Result=${IF($["${EncodingResult}" = "${Encoded}"]?OK:Fail)})
+ same => n,GotoIf($[${Result} = Fail]?test,result_fail,1)
+ same => n,Set(DecodingResult=${BASE64_DECODE(${Encoded})})
+ same => n,Set(Result=${IF($["${DecodingResult}" = "${Decoded}"]?OK:Fail)})
+ same => n,GotoIf($[${Result} = Fail]?test,result_fail,1)
+ same => n,Goto(test,start,top)
+
+[aes]
+exten => start,1,NoOp()
+ same => n,Set(Key=1qaz2wsx3edc4rfv)
+ same => n,Set(Encoded=KfAgilzmckUn1bH3NNLFHKfHA36w2EAHJvJvWqEQSSwdLroipj/Cp+dVt2FtjxBXT30cQcQiM0Plgb20pTqPAw==)
+ same => n,Set(Decoded=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789)
+ same => n,Set(EncodingResult=${AES_ENCRYPT(${Key},${Decoded})})
+ same => n,Set(Result=${IF($["${EncodingResult}" = "${Encoded}"]?OK:Fail)})
+ same => n,GotoIf($[${Result} = Fail]?test,result_fail,1)
+ same => n,Set(DecodingResult=${AES_DECRYPT(${Key},${Encoded})})
+ same => n,Set(Result=${IF($["${DecodingResult}" = "${Decoded}"]?OK:Fail)})
+ same => n,GotoIf($[${Result} = Fail]?test,result_fail,1)
+ same => n,Goto(test,start,top)
+
+; ------------------------------------------------------------------
+; STRING (LEN, CUT, ISNULL, EXISTS)
+; ------------------------------------------------------------------
+
+[len]
+exten => start,1,NoOp()
+ ; note that the \ here gets removed by the config parser
+ same => n,Set(MyStr=\;)
+ same => n,Set(LenResult=${LEN(${MyStr})})
+ same => n,Set(Result=${IF($["${LenResult}" = "1"]?OK:Fail)})
+ same => n,GotoIf($[${Result} = Fail]?test,result_fail,1)
+ same => n,Set(MyStr=)
+ same => n,Set(LenResult=${LEN(${MyStr})})
+ same => n,Set(Result=${IF($["${LenResult}" = "0"]?OK:Fail)})
+ same => n,GotoIf($[${Result} = Fail]?test,result_fail,1)
+ same => n,Set(MyStr=asdf)
+ same => n,Set(LenResult=${LEN(${MyStr})})
+ same => n,Set(Result=${IF($["${LenResult}" = "4"]?OK:Fail)})
+ same => n,GotoIf($[${Result} = Fail]?test,result_fail,1)
+ same => n,Goto(test,start,top)
+
+; ------------------------------------------------------------------
+; GoSub, Return, LOCAL, LOCAL_PEEK
+; ------------------------------------------------------------------
+
+[gosubtest]
+exten => start,1,NoOp()
+ same => n,Set(GoSubCounter=1)
+ same => n,Gosub(gosubtest,subroutine,1(${GoSubCounter}))
+ same => n,GotoIf($[${GOSUB_RETVAL}=1]?test,start,top)
+ same => n,Goto(test,result_fail,1)
+
+exten => subroutine,1,NoOp()
+ same => n,Set(LocalCounter=${LOCAL(ARG1)})
+ same => n,Set(LocalCounter=${INC(LocalCounter)})
+ same => n,GotoIf($[${LocalCounter}=100]?return:continue)
+ same => n(return),Return(1)
+ same => n(continue),Gosub(1(${LocalCounter}))
+ same => n,GotoIf($[${GOSUB_RETVAL}=1]?return)
+ same => n,Return(0)
+
+; ------------------------------------------------------------------
+; REPLACE()
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; IF
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; DIGESTS (MD5, SHA1)
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; DEC / INC
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; SHELL
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; FIELDNUM / FIELDQTY
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; AstDB functions
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; POP, PUSH, SHIFT, UNSHIFT
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; URIENCODE, URIDECODE
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; VALID_EXTEN
+; ------------------------------------------------------------------
+
+; ------------------------------------------------------------------
+; While / ExitWhile
+; ------------------------------------------------------------------
+
Propchange: asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/pbx/dialplan/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/pbx/dialplan/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/dialplan/test-config.yaml?view=auto&rev=4278
==============================================================================
--- asterisk/trunk/tests/pbx/dialplan/test-config.yaml (added)
+++ asterisk/trunk/tests/pbx/dialplan/test-config.yaml Tue Oct 22 10:44:35 2013
@@ -1,0 +1,46 @@
+testinfo:
+ summary: 'Test a variety of dialplan functions and features'
+ description: |
+ This test verifies a number of dialplan specific functions and features. This includes,
+ but is not limited to, pattern matching, Goto, GotoIf, math functions, string functions,
+ looping, etc.
+
+test-modules:
+ test-object:
+ config-section: test-config
+ typename: 'SimpleTestCase.SimpleTestCase'
+ modules:
+ -
+ config-section: 'ami-config'
+ typename: 'ami.AMIEventModule'
+
+test-config:
+ spawn-after-hangup: True
+ expected_events: 0
+ test-iterations:
+ -
+ channel: 'Local/s at DialContext'
+ context: 'test'
+ exten: 's'
+ priority: '1'
+
+ami-config:
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'TestResult'
+ requirements:
+ match:
+ Result: 'Success'
+ count: '>1'
+
+properties:
+ minversion: '1.8.20.0'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ - asterisk : 'res_crypto'
+ tags:
+ - dialplan
Propchange: asterisk/trunk/tests/pbx/dialplan/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/pbx/dialplan/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/pbx/dialplan/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/pbx/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/tests.yaml?view=diff&rev=4278&r1=4277&r2=4278
==============================================================================
--- asterisk/trunk/tests/pbx/tests.yaml (original)
+++ asterisk/trunk/tests/pbx/tests.yaml Tue Oct 22 10:44:35 2013
@@ -1,5 +1,6 @@
# Enter tests here in the order they should be considered for execution:
tests:
+ - test: 'dialplan'
- test: 'call-files'
- test: 'pbx_lua_goto'
- test: 'pbx_lua_background'
Modified: asterisk/trunk/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/tests.yaml?view=diff&rev=4278&r1=4277&r2=4278
==============================================================================
--- asterisk/trunk/tests/tests.yaml (original)
+++ asterisk/trunk/tests/tests.yaml Tue Oct 22 10:44:35 2013
@@ -4,7 +4,6 @@
- test: 'dynamic-modules'
- dir: 'manager'
- dir: 'cdr'
- - test: 'dialplan'
- dir: 'channels'
- test: 'udptl'
- test: 'udptl_v6'
More information about the asterisk-commits
mailing list