From: haifeng <haifengx.tang@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] add unit_test_cmdline ,unit_test_dump and unit_test_eal test suite and testplan
Date: Mon, 25 May 2015 15:55:03 +0800 [thread overview]
Message-ID: <1432540503-14108-1-git-send-email-haifengx.tang@intel.com> (raw)
From: TangHaifeng <haifengx.tang@intel.com>
---
test_plans/unit_tests_cmdline_test_plan.rst | 38 +++
test_plans/unit_tests_dump_test_plan.rst | 169 +++++++++++
test_plans/unit_tests_eal_test_plan.rst | 315 +++++++++++++++++++++
tests/TestSuite_unit_tests_cmdline.py | 60 ++++
tests/TestSuite_unit_tests_dump.py | 181 ++++++++++++
tests/TestSuite_unit_tests_eal.py | 409 +++++++++++++++++++++++++++
6 files changed, 1172 insertions(+), 0 deletions(-)
create mode 100644 test_plans/unit_tests_cmdline_test_plan.rst
create mode 100644 test_plans/unit_tests_dump_test_plan.rst
create mode 100644 test_plans/unit_tests_eal_test_plan.rst
create mode 100644 tests/TestSuite_unit_tests_cmdline.py
create mode 100644 tests/TestSuite_unit_tests_dump.py
create mode 100644 tests/TestSuite_unit_tests_eal.py
diff --git a/test_plans/unit_tests_cmdline_test_plan.rst b/test_plans/unit_tests_cmdline_test_plan.rst
new file mode 100644
index 0000000..95702e0
--- /dev/null
+++ b/test_plans/unit_tests_cmdline_test_plan.rst
@@ -0,0 +1,38 @@
+.. Copyright (c) <2010>, Intel Corporation
+ All rights reserved.
+
+ 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
+ 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
+ distribution.
+
+ - 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 OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+==================
+Cmdline Autotests
+==================
+
+
+TODO.
diff --git a/test_plans/unit_tests_dump_test_plan.rst b/test_plans/unit_tests_dump_test_plan.rst
new file mode 100644
index 0000000..23dd993
--- /dev/null
+++ b/test_plans/unit_tests_dump_test_plan.rst
@@ -0,0 +1,169 @@
+.. Copyright (c) <2014>, Intel Corporation
+ All rights reserved.
+
+ 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
+ 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
+ distribution.
+
+ - 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 OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=========================
+Dump log history Autotest
+=========================
+
+This is the test plan for dump history log of Intel® DPDK .
+
+This section explains how to run the unit tests for dump history log. The test
+can be launched independently using the command line interface.
+This test is implemented as a linuxapp environment application.
+
+The complete test suite is launched automatically using a python-expect
+script (launched using ``make test``) that sends commands to
+the application and checks the results. A test report is displayed on
+stdout.
+
+The steps to run the unit test manually are as follow::
+
+ # make -C ./app/test/
+ # ./app/test/test -n 1 -c ffff
+ RTE>> dump_log_history
+
+The final output of the test will be the initial log of DPDK.
+
+==================
+Dump ring Autotest
+==================
+
+This is the test plan for dump the elements of Intel® DPDK ring.
+
+This section explains how to run the unit tests for dump elements of ring.
+The test can be launched independently using the command line interface.
+This test is implemented as a linuxapp environment application.
+
+The complete test suite is launched automatically using a python-expect
+script (launched using ``make test``) that sends commands to
+the application and checks the results. A test report is displayed on
+stdout.
+
+The steps to run the unit test manually are as follow::
+
+ # make -C ./app/test/
+ # ./app/test/test -n 1 -c ffff
+ RTE>> dump_ring
+
+The final output of the test will be detail elements of DPDK ring.
+
+=====================
+Dump mempool Autotest
+=====================
+
+This is the test plan for dump the elements of Intel® DPDK mempool.
+
+This section explains how to run the unit tests for dump elements of mempool.
+The test can be launched independently using the command line interface.
+This test is implemented as a linuxapp environment application.
+
+The complete test suite is launched automatically using a python-expect
+script (launched using ``make test``) that sends commands to
+the application and checks the results. A test report is displayed on
+stdout.
+
+The steps to run the unit test manually are as follow::
+
+ # make -C ./app/test/
+ # ./app/test/test -n 1 -c ffff
+ RTE>> dump_mempool
+
+The final output of the test will be detail elements of DPDK mempool.
+
+=============================
+Dump Physical memory Autotest
+=============================
+
+This is the test plan for dump the elements of Intel® DPDK physical memory.
+
+This section explains how to run the unit tests for dump elements of memory.
+The test can be launched independently using the command line interface.
+This test is implemented as a linuxapp environment application.
+
+The complete test suite is launched automatically using a python-expect
+script (launched using ``make test``) that sends commands to
+the application and checks the results. A test report is displayed on
+stdout.
+
+The steps to run the unit test manually are as follow::
+
+ # make -C ./app/test/
+ # ./app/test/test -n 1 -c ffff
+ RTE>> dump_physmem
+
+The final output of the test will be detail elements of DPDK physical memory.
+
+=====================
+Dump Memzone Autotest
+=====================
+
+This is the test plan for dump the elements of Intel® DPDK memzone.
+
+This section explains how to run the unit tests for dump elements of memzone.
+The test can be launched independently using the command line interface.
+This test is implemented as a linuxapp environment application.
+
+The complete test suite is launched automatically using a python-expect
+script (launched using ``make test``) that sends commands to
+the application and checks the results. A test report is displayed on
+stdout.
+
+The steps to run the unit test manually are as follow::
+
+ # make -C ./app/test/
+ # ./app/test/test -n 1 -c ffff
+ RTE>> dump_memzone
+
+The final output of the test will be detail elements of DPDK memzone.
+
+================
+Dump Struct size
+================
+
+This is the test plan for dump the size of Intel® DPDK structure.
+
+This section explains how to run the unit tests for dump structure size.
+The test can be launched independently using the command line interface.
+This test is implemented as a linuxapp environment application.
+
+The complete test suite is launched automatically using a python-expect
+script (launched using ``make test``) that sends commands to
+the application and checks the results. A test report is displayed on
+stdout.
+
+The steps to run the unit test manually are as follow::
+
+ # make -C ./app/test/
+ # ./app/test/test -n 1 -c ffff
+ RTE>> dump_struct_sizes
+
+The final output of the test will be the size of DPDK structure.
diff --git a/test_plans/unit_tests_eal_test_plan.rst b/test_plans/unit_tests_eal_test_plan.rst
new file mode 100644
index 0000000..c1f8950
--- /dev/null
+++ b/test_plans/unit_tests_eal_test_plan.rst
@@ -0,0 +1,315 @@
+.. Copyright (c) <2010>, Intel Corporation
+ All rights reserved.
+
+ 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
+ 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
+ distribution.
+
+ - 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 OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=============
+EAL Autotests
+=============
+
+This section describes the tests that are done to validate the EAL. Each
+test can be launched independently using the command line
+interface. These tests are implemented as a linuxapp environment
+application.
+
+The complete test suite is launched automatically using a python-expect
+script (launched using ``make test``) that sends commands to
+the application and checks the results. A test report is displayed on
+stdout.
+
+Version
+=======
+
+To Be Filled
+
+
+Common
+=======
+
+To Be Filled
+
+Eal_fs
+======
+
+To Be Filled
+
+Memory
+======
+
+- Dump the mapped memory. The python-expect script checks that at
+ least one line is dumped.
+
+- Check that memory size is different than 0.
+
+- Try to read all memory; it should not segfault.
+
+PCI
+===
+
+- Register a driver with a ``devinit()`` function.
+
+- Dump all PCI devices.
+
+- Check that the ``devinit()`` function is called at least once.
+
+Per-lcore Variables and lcore Launch
+====================================
+
+- Use ``rte_eal_mp_remote_launch()`` to call ``assign_vars()`` on
+ every available lcore. In this function, a per-lcore variable is
+ assigned to the lcore_id.
+
+- Use ``rte_eal_mp_remote_launch()`` to call ``display_vars()`` on
+ every available lcore. The function checks that the variable is
+ correctly set, or returns -1.
+
+- If at least one per-core variable was not correct, the test function
+ returns -1.
+
+Spinlock
+========
+
+- There is a global spinlock and a table of spinlocks (one per lcore).
+
+- The test function takes all of these locks and launches the
+ ``test_spinlock_per_core()`` function on each core (except the master).
+
+ - The function takes the global lock, displays something, then releases
+ the global lock.
+ - The function takes the per-lcore lock, displays something, then releases
+ the per-core lock.
+
+- The main function unlocks the per-lcore locks sequentially and
+ waits between each lock. This triggers the display of a message
+ for each core, in the correct order. The autotest script checks that
+ this order is correct.
+
+Rwlock
+======
+
+- There is a global rwlock and a table of rwlocks (one per lcore).
+
+- The test function takes all of these locks and launches the
+ ``test_rwlock_per_core()`` function on each core (except the master).
+
+ - The function takes the global write lock, display something,
+ then releases the global lock.
+ - Then, it takes the per-lcore write lock, display something, and
+ releases the per-core lock.
+ - Finally, a read lock is taken during 100 ms, then released.
+
+- The main function unlocks the per-lcore locks sequentially and
+ waits between each lock. This triggers the display of a message
+ for each core, in the correct order.
+
+ Then, it tries to take the global write lock and display the last
+ message. The autotest script checks that the message order is correct.
+
+Atomic Variables
+================
+
+- The main test function performs three subtests. The first test
+ checks that the usual inc/dec/add/sub functions are working
+ correctly:
+
+ - Initialize 32-bit and 64-bit atomic variables to specific
+ values.
+
+ - These variables are incremented and decremented on each core at
+ the same time in ``test_atomic_usual()``.
+
+ - The function checks that once all lcores finish their function,
+ the value of the atomic variables are still the same.
+
+- The second test verifies the behavior of "test and set" functions.
+
+ - Initialize 32-bit and 64-bit atomic variables to zero.
+
+ - Invoke ``test_atomic_tas()`` on each lcore before doing anything
+ else. The cores are awaiting synchronizatioin using the ``while
+ (rte_atomic32_read(&val) == 0)`` statement which is triggered by the
+ main test function. Then all cores do an
+ ``rte_atomicXX_test_and_set()`` at the same time. If it is successful,
+ it increments another atomic counter.
+
+ - The main function checks that the atomic counter was incremented
+ twice only (one for 32-bit and one for 64-bit values).
+
+- Test "add/sub and return"
+
+ - Initialize 32-bit and 64-bit atomic variables to zero.
+
+ - Invoke ``test_atomic_addsub_return()`` on each lcore. Before doing
+ anything else, the cores are waiting a synchro. Each lcore does
+ this operation several times::
+
+ tmp = atomic_add_return(&a, 1);
+ atomic_add(&count, tmp);
+ tmp = atomic_sub_return(&a, 1);
+ atomic_sub(&count, tmp+1);
+
+ - At the end of the test, the *count* value must be 0.
+
+Prefetch
+========
+
+Just test that the macro can be called and validate the compilation.
+The test always return success.
+
+Byteorder functions
+===================
+
+Check the result of optimized byte swap functions for each size (16-,
+32- and 64-bit).
+
+Cycles Test
+===========
+
+- Loop N times and check that the timer alway increments and
+ never decrements during this loop.
+
+- Wait one second using rte_usleep() and check that the increment
+ of cycles is correct with regard to the frequency of the timer.
+
+Logs
+====
+
+- Enable log types.
+- Set log level.
+- Execute logging functions with different types and levels; some should
+ not be displayed.
+
+Memzone
+=======
+
+- Search for three reserved zones or reserve them if they do not exist:
+
+ - One is on any socket id.
+ - The second is on socket 0.
+ - The last one is on socket 1 (if socket 1 exists).
+
+- Check that the zones exist.
+
+- Check that the zones are cache-aligned.
+
+- Check that zones do not overlap.
+
+- Check that the zones are on the correct socket id.
+
+- Check that a lookup of the first zone returns the same pointer.
+
+- Check that it is not possible to create another zone with the
+ same name as an existing zone.
+
+Memcpy
+======
+
+Create two buffers, and initialise one with random values. These are copied
+to the second buffer and then compared to see if the copy was successfull.
+The bytes outside the copied area are also checked to make sure they were not
+changed.
+
+This is repeated for a number of different sizes and offsets, with
+the second buffer being cleared before each test.
+
+Debug test
+==========
+
+- Call rte_dump_stack() and rte_dump_registers().
+
+Alarm
+=====
+
+- Check that the callback for the alarm can to be called.
+- Check that it is not possible to set alarm with invalid time value.
+- Check that it is not possible to set alarm without a callback.
+- Check that it is not possible to cancel alarm without a callback pointer.
+- Check that multiple callbacks for the alarm can be called.
+- Check that the number of removed and unremoved alarms are correct.
+- Check that no callback is called if all alarm removed.
+- Check that it is not possible to cancel an alarm within the callback itself.
+- Check that the callback which is the head of all is able to be removed.
+- Check that all alarms for the same callback can be cancelled.
+
+
+CPU flags
+=========
+
+- Using the rte_cpu_get_flag_enabled() checks for CPU features from different CPUID tables
+- Checks if rte_cpu_get_flag_enabled() properly fails on trying to check for invalid feature
+
+
+Errno
+=====
+
+Performs validation on the error message strings provided by the rte_strerror() call, to ensure that suitable strings are returned for the rte-specific error codes, as well as ensuring that for standard error codes the correct error message is returned.
+
+Interrupts
+==========
+- Check that the callback for the specific interrupt can be called.
+- Check that it is not possible to register a callback to an invalid interrupt handle.
+- Check that it is not possible to register no callback to an interrupt handle.
+- Check that it is not possible to unregister a callback to an invalid interrupt handle.
+- Check that multiple callbacks are registered to the same interrupt handle.
+- Check that it is not possible to unregister a callback with invalid parameter.
+- Check that it is not possible to enable an interrupt with invalid handle or wrong handle type.
+- Check that it is not possible to disable an interrupt with invalid handle or wrong handle type.
+
+
+Multiprocess
+============
+
+Validates that a secondary Intel DPDK instance can be run alongside a primary when the appropriate EAL command-line flags are passed. Also validates that secondary processes cannot interfere with primary processes by creating memory objects, such as mempools or rings.
+
+String
+======
+
+Performs validation on the new string functions provided in rte_string_fns.h, ensuring that all values returned are NULL terminated, and that suitable errors are returned when called with invalid parameters.
+
+Tailq
+=====
+
+Validates that we can create and perform lookups on named tail queues within the EAL for various object types. Also ensures appropriate error codes are returned from the functions if invalid parameters are passed.
+
+Devargs
+=======
+To Be Filled
+
+Kvargs
+======
+To Be Filled
+
+Acl
+===
+To Be Filled
+
+Link_bonding
+============
+To Be Filled
diff --git a/tests/TestSuite_unit_tests_cmdline.py b/tests/TestSuite_unit_tests_cmdline.py
new file mode 100644
index 0000000..8a13703
--- /dev/null
+++ b/tests/TestSuite_unit_tests_cmdline.py
@@ -0,0 +1,60 @@
+# <COPYRIGHT_TAG>
+
+"""
+DPDK Test suite.
+
+Cmdline autotest
+
+"""
+
+from test_case import TestCase
+
+#
+#
+# Test class.
+#
+
+
+class TestUnitTestsCmdline(TestCase):
+
+ #
+ #
+ #
+ # Test cases.
+ #
+
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ """
+ out = self.dut.build_dpdk_apps('./app/test/')
+ self.verify('make: Leaving directory' in out, "Compilation failed")
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ pass
+
+ def test_cmdline(self):
+ """
+ Run cmdline autotests in RTE comand line.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("cmdline_autotest", "RTE>>", 10)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+ return 'SUCCESS'
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ """
+ pass
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ pass
diff --git a/tests/TestSuite_unit_tests_dump.py b/tests/TestSuite_unit_tests_dump.py
new file mode 100644
index 0000000..ffcb158
--- /dev/null
+++ b/tests/TestSuite_unit_tests_dump.py
@@ -0,0 +1,181 @@
+# <COPYRIGHT_TAG>
+import re
+
+"""
+DPDK Test suite.
+
+Run Inter-VM share memory autotests
+"""
+
+
+from test_case import TestCase
+
+#
+#
+# Test class.
+#
+
+
+class TestUnitTestsDump(TestCase):
+
+ #
+ #
+ #
+ # Test cases.
+ #
+
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ Nothing to do here.
+ """
+ # Based on h/w type, choose how many ports to use
+ self.dut_ports = self.dut.get_ports(self.nic)
+ self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
+
+ def set_up(self):
+ """
+ Run before each test case.
+ Nothing to do here.
+ """
+ pass
+
+ def test_log_dump(self):
+ """
+ Run history log dump test case.
+ """
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff" % (self.target), "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("dump_log_history", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+ self.verify("EAL" in out, "Test failed")
+
+ def test_ring_dump(self):
+ """
+ Run history log dump test case.
+ """
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff" % (self.target), "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("dump_ring", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+ elements = ['ring', 'address', 'flags', 'size', 'ct', 'ch', 'pt', 'ph', 'used', 'avail', 'watermark']
+ match_regex = "ring <(.*?)>@0x(.*)\r\n"
+ for element in elements[2:]:
+ match_regex += " %s=(\d*)\r\n" % element
+ m = re.compile(r"%s" % match_regex, re.S)
+ result = m.search(out)
+ ring_info = dict(zip(elements, result.groups()))
+
+ self.verify(ring_info['ring'] == 'MP_log_history', "Test failed")
+
+ def test_mempool_dump(self):
+ """
+ Run mempool dump test case.
+ """
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff" % (self.target), "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("dump_mempool", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+ elements = ['mempool', 'address', 'flags', 'ring', 'phys_addr', 'size', 'header_size', 'elt_size',
+ 'trailer_size', 'total_obj_size', 'private_data_size', 'pg_num', 'pg_shift', 'pg_mask',
+ 'elt_va_start', 'elt_va_end', 'elt_pa\[0\]', 'avg bytes/object'
+ ]
+ match_regex = "mempool <(.*?)>@0x(.*?)\r\n"
+ for element in elements[2:]:
+ match_regex += " %s=(.*?)\r\n" % element
+ m = re.compile(r"%s" % match_regex, re.S)
+ result = m.search(out)
+ mempool_info = dict(zip(elements, result.groups()))
+
+ self.verify(mempool_info['mempool'] == 'log_history', "Test failed")
+
+ def test_physmem_dump(self):
+ """
+ Run physical memory dump test case.
+ """
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff" % (self.target), "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("dump_physmem", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+ elements = ['Segment', 'phys', 'len', 'virt', 'socket_id', 'hugepage_sz', 'nchannel', 'nrank']
+ match_regex = "Segment (\d)+:"
+ for element in elements[1:-1]:
+ match_regex += " %s:(.*?)," % element
+ match_regex += " %s:(.*?)\n" % elements[-1]
+ m = re.compile(r"%s" % match_regex, re.DOTALL)
+ results = m.findall(out)
+ phy_info = []
+ for result in results:
+ phy_info.append(dict(zip(elements, result)))
+
+ self.verify(len(phy_info) > 0, "Test failed")
+
+ def test_memzone_dump(self):
+ """
+ Run memzone dump test case.
+ """
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff" % (self.target), "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("dump_memzone", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+
+ elements = ['Zone', 'name', 'phys', 'len', 'virt', 'socket_id', 'flags']
+ match_regex = "Zone (\d):"
+ for element in elements[1:-1]:
+ match_regex += " %s:(.*?)," % element
+ match_regex += " %s:(.*?)\n" % elements[-1]
+ m = re.compile(r"%s" % match_regex, re.DOTALL)
+ results = m.findall(out)
+
+ memzone_info = []
+ for result in results:
+ memzone_info.append(dict(zip(elements, result)))
+
+ self.verify(len(memzone_info) > 0, "Test failed")
+
+ def test_dump_struct_size(self):
+ """
+ Run struct size dump test case.
+ """
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff" % (self.target), "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("dump_struct_sizes", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+
+ elements = ['struct rte_mbuf', 'struct rte_mempool', 'struct rte_ring']
+ match_regex = ""
+ for element in elements[:-1]:
+ match_regex += "sizeof\(%s\) = (\d+)\r\n" % element
+ match_regex += "sizeof\(%s\) = (\d+)" % elements[-1]
+ m = re.compile(r"%s" % match_regex, re.S)
+ result = m.search(out)
+ struct_info = dict(zip(elements, result.groups()))
+
+ def test_dump_devargs(self):
+ """
+ Run devargs dump test case.
+ """
+ test_port = self.dut_ports[0]
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff -b 0000:%s"
+ % (self.target, self.dut.ports_info[test_port]['pci']), "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("dump_devargs", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+ black_str = "PCI blacklist 0000:%s" % self.dut.ports_info[test_port]['pci']
+ self.verify(black_str in out, "Dump black list failed")
+
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff -w 0000:%s"
+ % (self.target, self.dut.ports_info[test_port]['pci']), "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("dump_devargs", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+
+ white_str = "PCI whitelist 0000:%s" % self.dut.ports_info[test_port]['pci']
+ self.verify(white_str in out, "Dump white list failed")
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ Stop application test after every case.
+ """
+ self.dut.kill_all()
+ pass
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ Nothing to do here.
+ """
+ pass
diff --git a/tests/TestSuite_unit_tests_eal.py b/tests/TestSuite_unit_tests_eal.py
new file mode 100644
index 0000000..e36adc5
--- /dev/null
+++ b/tests/TestSuite_unit_tests_eal.py
@@ -0,0 +1,409 @@
+# <COPYRIGHT_TAG>
+
+"""
+DPDK Test suite.
+
+EAL autotest.
+
+"""
+
+import dts
+
+
+from test_case import TestCase
+
+#
+#
+# Test class.
+#
+
+
+class TestUnitTestsEal(TestCase):
+
+ #
+ #
+ #
+ # Test cases.
+ #
+
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ """
+ out = self.dut.build_dpdk_apps('./app/test/')
+ self.verify('make: Leaving directory' in out, "Compilation failed")
+ [arch, machine, self.env, toolchain] = self.target.split('-')
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ pass
+
+ def test_version(self):
+ """
+ Run version autotest.
+ """
+
+ self.dut.send_expect("%s ./app/test/test -n 1 -c ffff" % self.dut.taskset(1),
+ "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("version_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_memcopy(self):
+ """
+ Run memcopy autotest.
+ """
+
+ self.dut.send_expect("%s ./app/test/test -n 1 -c ffff" % self.dut.taskset(1),
+ "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("memcpy_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_common(self):
+ """
+ Run common autotest.
+ """
+
+ self.dut.send_expect("%s ./app/test/test -n 1 -c ffff" % self.dut.taskset(1),
+ "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("common_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_eal_fs(self):
+ """
+ Run memcopy autotest.
+ """
+
+ self.dut.send_expect("%s ./app/test/test -n 1 -c ffff" % self.dut.taskset(1),
+ "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("eal_fs_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_memcpy(self):
+ """
+ Run memcopy autotest.
+ """
+
+ self.dut.send_expect("%s ./app/test/test -n 1 -c ffff" % self.dut.taskset(1),
+ "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("memcpy_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_memcpy_perf(self):
+ """
+ Run memcopy performance autotest.
+ """
+ self.dut.send_expect("%s ./app/test/test -n 1 -c ffff" % self.dut.taskset(1),
+ "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("memcpy_perf_autotest", "RTE>>", 240)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_hash(self):
+ """
+ Run hash autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("hash_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_hash_perf(self):
+ """
+ Run has performance autotest.
+ """
+
+ self.dut.send_expect("%s ./app/test/test -n 1 -c fffe" % self.dut.taskset(1),
+ "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("hash_perf_autotest", "RTE>>", 600)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_malloc(self):
+ """
+ Run malloc autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("malloc_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_func_reentrancy(self):
+ """
+ Run function reentrancy autotest.
+ """
+
+ if self.dut.architecture == "x86_64":
+ cmdline = "./app/test/test -n 1 -c ffff"
+ else:
+ # mask cores only on socket 0
+ cmdline = "%s ./app/test/test -n 1 -c 5555" % self.dut.taskset(1)
+ self.dut.send_expect(cmdline, "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("func_reentrancy_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_pci(self):
+ """
+ Run pci autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("pci_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_atomic(self):
+ """
+ Run atomic autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("atomic_autotest", "RTE>>", 30)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_memory(self):
+ """
+ Run memory autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect('memory_autotest', "RTE>>", 20)
+ regexp = "phys:0x[0-9a-f]*, len:([0-9a-f]*), virt:0x[0-9a-f]*, socket_id:[0-9]*"
+ match = dts.regexp(out, regexp)
+ size = int(match, 16)
+ self.verify(size > 0, "bad size")
+ self.dut.send_expect("quit", "# ")
+
+ def test_lcore_launch(self):
+ """
+ Run lcore autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("per_lcore_autotest", "RTE>>", 20)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_spinlock(self):
+ """
+ Run spinlock autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("spinlock_autotest", "RTE>>", 120)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_rwlock(self):
+ """
+ Run rwlock autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("rwlock_autotest", "RTE>>", 20)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_prefetch(self):
+ """
+ Run prefetch autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("prefetch_autotest", "RTE>>", 20)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_byteorder(self):
+ """
+ Run byte order autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("byteorder_autotest", "RTE>>", 10)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_cycles(self):
+ """
+ Run cycles autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("cycles_autotest", "RTE>>", 20)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_logs(self):
+ """
+ Run logs autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("logs_autotest", "RTE>>", 10)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_memzone(self):
+ """
+ Run memzone autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("memzone_autotest", "RTE>>", 10)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_debug(self):
+ """
+ Run debug autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("debug_autotest", "RTE>>", 10)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_flags(self):
+ """
+ Run eal flags autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff -m 64", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("eal_flags_autotest", "RTE>>", 40)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_alarm(self):
+ """
+ Run alarm autotest.
+ """
+
+ self.verify(self.env == "linuxapp", "Alarm only supported in linux env")
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("alarm_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_cpuflags(self):
+ """
+ Run CPU flags autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("cpuflags_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_errno(self):
+ """
+ Run errno autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*TE>>|RT.*E>>|RTE.*>>|RTE>.*>", 20)
+ out = self.dut.send_expect("errno_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_interrupts(self):
+ """
+ Run interrupt autotest.
+ """
+
+ self.verify(self.env == "linuxapp", "Interrupt only supported in linux env")
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*TE>>|RT.*E>>|RTE.*>>|RTE>.*>", 20)
+ out = self.dut.send_expect("interrupt_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_multiprocess(self):
+ """
+ Run multiprocess autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff -m 64", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("multiprocess_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_string(self):
+ """
+ Run string autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("string_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_tailq(self):
+ """
+ Run tailq autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("tailq_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_devargs(self):
+ """
+ Run devargs autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("devargs_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_kvargs(self):
+ """
+ Run kvargs autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("kvargs_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_acl(self):
+ """
+ Run acl autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("acl_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def test_link_bonding(self):
+ """
+ Run acl autotest.
+ """
+
+ self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", 10)
+ out = self.dut.send_expect("link_bonding_autotest", "RTE>>", 60)
+ self.dut.send_expect("quit", "# ")
+ self.verify("Test OK" in out, "Test failed")
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ """
+ pass
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ pass
--
1.7.4.4
next reply other threads:[~2015-05-25 7:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-25 7:55 haifeng [this message]
2015-05-25 8:01 ` [dts] [PATCH] add unit_test_cmdline , unit_test_dump " Xu, HuilongX
2015-05-25 8:05 ` Xu, HuilongX
2015-05-25 8:38 ` Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432540503-14108-1-git-send-email-haifengx.tang@intel.com \
--to=haifengx.tang@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).