app/test: shorten execution time
[dpdk.git] / app / test / autotest_test_funcs.py
index b48c522..b60b941 100644 (file)
@@ -1,36 +1,35 @@
 #!/usr/bin/python
 
 #   BSD LICENSE
-# 
-#   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
 #   All rights reserved.
-# 
-#   Redistribution and use in source and binary forms, with or without 
-#   modification, are permitted provided that the following conditions 
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
 #   are met:
-# 
-#     * Redistributions of source code must retain the above copyright 
+#
+#     * Redistributions of source code must retain the above copyright
 #       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright 
-#       notice, this list of conditions and the following disclaimer in 
-#       the documentation and/or other materials provided with the 
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
 #       distribution.
-#     * Neither the name of Intel Corporation nor the names of its 
-#       contributors may be used to endorse or promote products derived 
+#     * Neither the name of Intel Corporation nor the names of its
+#       contributors may be used to endorse or promote products derived
 #       from this software without specific prior written permission.
-# 
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# 
 
 # Test functions
 
@@ -60,7 +59,7 @@ def dump_autotest(child, test_name):
 # reads output and waits for Test OK
 def memory_autotest(child, test_name):
        child.sendline(test_name)
-       regexp = "phys:0x[0-9a-f]*, len:0x([0-9a-f]*), virt:0x[0-9a-f]*, socket_id:[0-9]*"
+       regexp = "phys:0x[0-9a-f]*, len:([0-9]*), virt:0x[0-9a-f]*, socket_id:[0-9]*"
        index = child.expect([regexp, pexpect.TIMEOUT], timeout = 180)
        if index != 0:
                return -1, "Fail [Timeout]"
@@ -84,7 +83,7 @@ def spinlock_autotest(child, test_name):
                        "Test Failed",
                        "Hello from core ([0-9]*) !",
                        "Hello from within recursive locks from ([0-9]*) !",
-               pexpect.TIMEOUT], timeout = 20)
+               pexpect.TIMEOUT], timeout = 5)
                # ok
                if index == 0:
                        break
@@ -145,19 +144,16 @@ def logs_autotest(child, test_name):
        i = 0
        child.sendline(test_name)
 
+       # logs sequence is printed twice because of history dump
        log_list = [
-               "TESTAPP1: this is a debug level message",
-               "TESTAPP1: this is a info level message",
-               "TESTAPP1: this is a warning level message",
-               "TESTAPP2: this is a info level message",
-               "TESTAPP2: this is a warning level message",
-               "TESTAPP1: this is a debug level message",
-               "TESTAPP1: this is a debug level message",
-               "TESTAPP1: this is a info level message",
-               "TESTAPP1: this is a warning level message",
-               "TESTAPP2: this is a info level message",
-               "TESTAPP2: this is a warning level message",
-               "TESTAPP1: this is a debug level message",
+               "TESTAPP1: error message",
+               "TESTAPP1: critical message",
+               "TESTAPP2: critical message",
+               "TESTAPP1: error message",
+               "TESTAPP1: error message",
+               "TESTAPP1: critical message",
+               "TESTAPP2: critical message",
+               "TESTAPP1: error message",
        ]
 
        for log_msg in log_list:
@@ -182,18 +178,27 @@ def timer_autotest(child, test_name):
        i = 0
        child.sendline(test_name)
 
-       index = child.expect(["Start timer stress tests \(20 seconds\)",
+       index = child.expect(["Start timer stress tests",
                "Test Failed",
-               pexpect.TIMEOUT], timeout = 10)
+               pexpect.TIMEOUT], timeout = 5)
 
        if index == 1:
                return -1, "Fail"
        elif index == 2:
                return -1, "Fail [Timeout]"
 
-       index = child.expect(["Start timer basic tests \(20 seconds\)",
+       index = child.expect(["Start timer stress tests 2",
                "Test Failed",
-               pexpect.TIMEOUT], timeout = 40)
+               pexpect.TIMEOUT], timeout = 5)
+
+       if index == 1:
+               return -1, "Fail"
+       elif index == 2:
+               return -1, "Fail [Timeout]"
+
+       index = child.expect(["Start timer basic tests",
+               "Test Failed",
+               pexpect.TIMEOUT], timeout = 5)
 
        if index == 1:
                return -1, "Fail"
@@ -273,7 +278,7 @@ def timer_autotest(child, test_name):
 def ring_autotest(child, test_name):
        child.sendline(test_name)
        index = child.expect(["Test OK", "Test Failed",
-               pexpect.TIMEOUT], timeout = 15)
+               pexpect.TIMEOUT], timeout = 2)
        if index == 1:
                return -1, "Fail"
        elif index == 2:
@@ -287,4 +292,3 @@ def ring_autotest(child, test_name):
                return -1, "Fail [Bad watermark]"
 
        return 0, "Success"
-