X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Fautotest_test_funcs.py;h=6c717bddb4642c1c4fd9f21a8f282d7300ea9ca7;hb=cf1e803508009917f41dd5bb347e4140043afe03;hp=31cc0f5ee4fee23fb87f849ce19f8948fdf16914;hpb=90cb27276a2157c33323d48ff068e7ecf4821131;p=dpdk.git diff --git a/app/test/autotest_test_funcs.py b/app/test/autotest_test_funcs.py index 31cc0f5ee4..6c717bddb4 100644 --- a/app/test/autotest_test_funcs.py +++ b/app/test/autotest_test_funcs.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2010-2014 Intel Corporation @@ -12,13 +13,16 @@ import pexpect def default_autotest(child, test_name): child.sendline(test_name) result = child.expect(["Test OK", "Test Failed", - "Command not found", pexpect.TIMEOUT], timeout=900) + "Command not found", pexpect.TIMEOUT, + "Test Skipped"], timeout=900) if result == 1: return -1, "Fail" elif result == 2: return -1, "Fail [Not found]" elif result == 3: return -1, "Fail [Timeout]" + elif result == 4: + return 0, "Skipped [Not Run]" return 0, "Success" # autotest used to run dump commands @@ -102,7 +106,7 @@ def rwlock_autotest(child, test_name): index = child.expect(["Test OK", "Test Failed", "Hello from core ([0-9]*) !", - "Global write lock taken on master " + "Global write lock taken on main " "core ([0-9]*)", pexpect.TIMEOUT], timeout=10) # ok @@ -164,6 +168,38 @@ def ticketlock_autotest(child, test_name): return 0, "Success" +def mcslock_autotest(child, test_name): + i = 0 + ir = 0 + child.sendline(test_name) + while True: + index = child.expect(["Test OK", + "Test Failed", + "lcore ([0-9]*) state: ([0-1])" + "MCS lock taken on core ([0-9]*)", + "MCS lock released on core ([0-9]*)", + pexpect.TIMEOUT], timeout=5) + # ok + if index == 0: + break + + # message, check ordering + elif index == 2: + if int(child.match.groups()[0]) < i: + return -1, "Fail [Bad order]" + i = int(child.match.groups()[0]) + elif index == 3: + if int(child.match.groups()[0]) < ir: + return -1, "Fail [Bad order]" + ir = int(child.match.groups()[0]) + + # fail + elif index == 4: + return -1, "Fail [Timeout]" + elif index == 1: + return -1, "Fail" + + return 0, "Success" def logs_autotest(child, test_name): child.sendline(test_name)