[asterisk-commits] pabelanger: testsuite/asterisk/trunk r945 - in /asterisk/trunk: ./ tests/ tes...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 24 15:09:16 CST 2010


Author: pabelanger
Date: Wed Nov 24 15:09:11 2010
New Revision: 945

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=945
Log:
Recursive tests.yaml (dir option)

This patch adds a new options to tests.yaml; 'dir'.  This allows for recursive
tests.yaml files helping to clean up directory structures.

tests/tests.yaml
---
tests:
    - test : 'example'
    - dir : 'manager'
    - test : 'rfc2833_dtmf_detect'
    ...

tests/manager/tests.yaml
---
tests:
    - test: 'login'
    - test: 'action-events-response'
    - test: 'response-time'

Review: https://reviewboard.asterisk.org/r/1036/

Added:
    asterisk/trunk/tests/cdr/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/cdr/tests.yaml
    asterisk/trunk/tests/chanspy/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/chanspy/tests.yaml
    asterisk/trunk/tests/fastagi/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/fastagi/tests.yaml
    asterisk/trunk/tests/fax/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/fax/tests.yaml
    asterisk/trunk/tests/iax2/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/iax2/tests.yaml
    asterisk/trunk/tests/manager/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/manager/tests.yaml
    asterisk/trunk/tests/pbx/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/pbx/tests.yaml
    asterisk/trunk/tests/queues/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/queues/tests.yaml
    asterisk/trunk/tests/sip/tests.yaml
      - copied unchanged from r944, asterisk/team/pabelanger/tests_yaml/tests/sip/tests.yaml
Modified:
    asterisk/trunk/runtests.py
    asterisk/trunk/tests/tests.yaml

Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=945&r1=944&r2=945
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Wed Nov 24 15:09:11 2010
@@ -23,7 +23,7 @@
 from asterisk import utils
 
 
-TESTS_CONFIG = "tests/tests.yaml"
+TESTS_CONFIG = "tests.yaml"
 TEST_RESULTS = "asterisk-test-suite-report.xml"
 
 BIG_WARNING = "\n" \
@@ -125,13 +125,13 @@
         self.did_run = True
         start_time = time.time()
         cmd = [
-            "tests/%s/run-test" % self.test_name,
+            "%s/run-test" % self.test_name,
             "-v", str(self.ast_version)
         ]
         if os.path.exists(cmd[0]) and os.access(cmd[0], os.X_OK):
             print "Running %s ..." % cmd
             try:
-                f = open("tests/%s/test-output.txt" % self.test_name, "w")
+                f = open("%s/test-output.txt" % self.test_name, "w")
             except IOError:
                 print "FAILURE: Failed to open file for test output"
                 return
@@ -181,7 +181,7 @@
                         properties["maxversion"]
 
     def __parse_config(self):
-        test_config = "tests/%s/test-config.yaml" % self.test_name
+        test_config = "%s/test-config.yaml" % self.test_name
         try:
             f = open(test_config, "r")
         except IOError:
@@ -231,27 +231,38 @@
 
 class TestSuite:
     def __init__(self, ast_version, options):
-        try:
-            f = open(TESTS_CONFIG, "r")
-        except IOError:
-            print "Failed to open %s" % TESTS_CONFIG
-            return
-        except:
-            print "Unexpected error: %s" % sys.exc_info()[0]
-            return
-
         self.options = options
 
-        self.config = yaml.load(f)
-        f.close()
+        self.tests = []
+        self.tests = self._parse_test_yaml("tests", ast_version)
 
         self.total_time = 0.0
         self.total_count = 0
         self.total_failures = 0
 
-        self.tests = [
-            TestConfig(t["test"], ast_version) for t in self.config["tests"]
-        ]
+    def _parse_test_yaml(self, test_dir, ast_version):
+        tests = []
+        try:
+            f = open("%s/%s" % (test_dir, TESTS_CONFIG), "r")
+        except IOError:
+            print "Failed to open %s" % TESTS_CONFIG
+            return
+        except:
+            print "Unexpected error: %s" % sys.exc_info()[0]
+            return
+
+        config = yaml.load(f)
+        f.close()
+
+        for t in config["tests"]:
+            for val in t:
+                path = "%s/%s" % (test_dir, t[val])
+                if val == "test":
+                    tests.append(TestConfig(path, ast_version))
+                elif val == "dir":
+                    tests += self._parse_test_yaml(path, ast_version)
+
+        return tests
 
     def list_tests(self):
         print "Configured tests:"
@@ -328,7 +339,7 @@
                 continue
             f.write(">\n\t\t<failure><![CDATA[\n")
             try:
-                test_output = open("tests/%s/test-output.txt" % t.test_name, "r")
+                test_output = open("%s/test-output.txt" % t.test_name, "r")
                 f.write("%s" % test_output.read())
                 test_output.close()
             except IOError:

Modified: asterisk/trunk/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/tests.yaml?view=diff&rev=945&r1=944&r2=945
==============================================================================
--- asterisk/trunk/tests/tests.yaml (original)
+++ asterisk/trunk/tests/tests.yaml Wed Nov 24 15:09:11 2010
@@ -1,24 +1,11 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
     - test: 'example'
-    - test: 'manager/login'
-    - test: 'manager/action-events-response'
-    - test: 'manager/response-time'
+    - dir: 'manager'
     - test: 'rfc2833_dtmf_detect'
     - test: 'sip_channel_params'
-    - test: 'iax2/basic-call'
-    - test: 'cdr/console_dial_sip_answer'
-    - test: 'cdr/console_dial_sip_busy'
-    - test: 'cdr/console_dial_sip_congestion'
-    - test: 'cdr/console_dial_sip_transfer'
-    - test: 'cdr/console_fork_after_busy_forward'
-    - test: 'cdr/console_fork_before_dial'
-    - test: 'cdr/cdr_unanswered_yes'
-    - test: 'cdr/cdr_userfield'
-    - test: 'cdr/nocdr'
-    - test: 'cdr/app_queue'
-    - test: 'cdr/blind-transfer-accountcode'
-    - test: 'cdr/originate-cdr-disposition'
+    - dir: 'iax2'
+    - dir: 'cdr'
     - test: 'directed_pickup'
     - test: 'func_srv'
     - test: 'sip_outbound_address'
@@ -30,7 +17,7 @@
     # Temporarily disabled while failures are debugged
     #- test: 'sip_one_legged_transfer_v6'
     - test: 'sip_register'
-    - test: 'sip/handle_response_refer'
+    - dir: 'sip'
     - test: 'udptl'
     - test: 'udptl_v6'
     # Temporarily disabled while failures are debugged
@@ -43,34 +30,8 @@
     - test: 'callparking_retrieval'
     - test: 'mixmonitor'
     - test: 'mixmonitor_audiohook_inherit'
-    - test: 'chanspy/chanspy_barge'
-    - test: 'queues/queue_baseline'
-    - test: 'queues/position_priority_maxlen'
-    - test: 'queues/macro_gosub_test'
-    # Temporarily disabled while failures are debugged
-    #- test: 'queues/ringinuse_and_pause'
-    # Temporarily disabled while failures are debugged
-    #- test: 'queues/wrapup_time'
-    - test: 'fastagi/connect'
-    - test: 'fastagi/channel-status'
-    - test: 'fastagi/hangup'
-    - test: 'fastagi/stream-file'
-    - test: 'fastagi/control-stream-file'
-    - test: 'fastagi/database'
-    - test: 'fastagi/execute'
-    - test: 'fastagi/get-data'
-    - test: 'fastagi/record-file'
-    - test: 'fastagi/say-alpha'
-    - test: 'fastagi/say-date'
-    - test: 'fastagi/say-datetime'
-    - test: 'fastagi/say-time'
-    - test: 'fastagi/say-digits'
-    - test: 'fastagi/say-number'
-    - test: 'fastagi/say-phonetic'
-    # Requires patch to StarPy.
-    #- test: 'fastagi/wait-for-digit'
-    - test: 'pbx/call-files'
-    # Temporarily disabled while failures are debugged
-    #- test: 'pbx/call-files2'
-    - test: 'fax/local_channel_t38_queryoption'
-
+    - dir: 'chanspy'
+    - dir: 'queues'
+    - dir: 'fastagi'
+    - dir: 'pbx'
+    - dir: 'fax'




More information about the asterisk-commits mailing list