test suite reviews and discussions
 help / color / mirror / Atom feed
From: Owen Hilyard <ohilyard@iol.unh.edu>
To: dts@dpdk.org
Cc: david.marchand@redhat.com, thomas@monjalon.net,
	ferruh.yigit@intel.com, arybchenko@solarflare.com,
	shys@mellanox.com, stephen@networkplumber.org,
	mb@smartsharesystems.com, lylavoie@iol.unh.edu,
	Owen Hilyard <ohilyard@iol.unh.edu>
Subject: [dts] [PATCH v2] mtu update: add invalid values test case
Date: Mon, 29 Jun 2020 11:59:02 -0400
Message-ID: <20200629155902.41036-1-ohilyard@iol.unh.edu> (raw)
In-Reply-To: <20200616212119.37730-1-ohilyard@iol.unh.edu>

add a test case which tries to set the mtu to several invalid values
add documented for aformentioned test case.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
 test_plans/mtu_update_test_plan.rst |  6 ++++
 tests/TestSuite_mtu_update.py       | 43 ++++++++++++++++++++---------
 2 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/test_plans/mtu_update_test_plan.rst b/test_plans/mtu_update_test_plan.rst
index b62ec15..70e5c04 100644
--- a/test_plans/mtu_update_test_plan.rst
+++ b/test_plans/mtu_update_test_plan.rst
@@ -152,3 +152,9 @@ Send a packet with size 1600 bytes ::
     ############################################################################
 
 Verify that TX-bytes on port 0 and RX-bytes on port 1 are 1500
+
+Test Case: MTU Checks Invalid Values
+=====================================
+This test case consists of attempting to set the MTU of ports to invalid
+values through TestPmd. Values include the range [0, 63], -1, 2 ^ 128,
+strings_should't_work, 1.2, a null character and 10000.
diff --git a/tests/TestSuite_mtu_update.py b/tests/TestSuite_mtu_update.py
index 6e425dc..0547494 100644
--- a/tests/TestSuite_mtu_update.py
+++ b/tests/TestSuite_mtu_update.py
@@ -34,25 +34,14 @@
 DPDK Test suite.
 MTU Checks example.
 """
-import os
-import subprocess
 from time import sleep
-from typing import List, Tuple
+from typing import Tuple
 
-import utils
 from pmd_output import PmdOutput
-from test_case import TestCase
-
-from pktgen_base import TRANSMIT_S_BURST
 
 import utils
-import re
 import time
 from test_case import TestCase
-from pktgen import TRANSMIT_CONT
-
-from framework.packet import Packet
-from framework.settings import HEADER_SIZE
 
 ETHER_HEADER_LEN = 18
 IP_HEADER_LEN = 20
@@ -112,7 +101,6 @@ class TestMtuUpdate(TestCase):
                                      f'Ether(dst=dutmac, src="52:00:00:00:00:00")/IP()/Raw(load="\x50"*{padding})')
         return out
 
-
     def send_packet_of_size_to_tx_port(self, pktsize, received=True):
         """
         Send 1 packet to portid
@@ -185,6 +173,12 @@ class TestMtuUpdate(TestCase):
         clear up.
         """
         self.dut.kill_all()
+        self.pmdout.start_testpmd("Default")
+        self.exec("port stop all")
+        for port in self.dut_ports:
+            self.exec(f"port config mtu {port} 1500")
+        self.exec("port start all")
+        self.pmdout.quit()
 
     def admin_tester_port(self, local_port, status):
         """
@@ -208,6 +202,7 @@ class TestMtuUpdate(TestCase):
         @return: None
         """
         self.admin_tester_port(self.tester.get_local_port(self.tx_port), f"mtu {mtu:d}")
+
     #
     #
     #
@@ -264,3 +259,25 @@ class TestMtuUpdate(TestCase):
          then being sent packets of size 8999 and 9000.
         """
         self.helper_test_mut_checks(9000)
+
+    def test_mtu_checks_invalid_values(self):
+        """
+        Checks that invalid arguments are rejected.
+        """
+        self.pmdout.start_testpmd("Default")
+        self.exec("port stop all")
+        for port in self.dut_ports:
+            self.exec(f"port config mtu {port} 1500")
+            for invalid_arg in -1, 2 ** 128, "strings_should't_work", 1.2, '\0':
+                self.verify("Bad arguments" in self.exec(f"port config mtu {port :d} {invalid_arg}"),
+                            f"MTU {invalid_arg} was accepted when it shouldn't have been.")
+                mtu: int = int(self.pmdout.get_detail_from_port_info("MTU: ", "\d+", port))
+            for to_low_arg in range(0, 64):
+                self.verify("mtu cannot be less than 64" in self.exec(f"port config mtu {port :d} {to_low_arg}"),
+                            f"MTU {to_low_arg} was accepted when it shouldn't have been.")
+            # Check 10000, which should barely be to high for most NICS
+            self.verify("is not in valid range" in self.exec(f"port config mtu {port :d} 10000"),
+                        f"MTU 10000 was accepted when it shouldn't have been.")
+
+        self.exec("port start all")
+        self.pmdout.quit()
-- 
2.25.1


  parent reply	other threads:[~2020-06-29 15:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 21:21 [dts] [PATCH] added mtu update test suite and test plan Owen Hilyard
2020-06-19  6:19 ` Tu, Lijuan
2020-06-29 15:59 ` Owen Hilyard [this message]
2020-06-29 16:00   ` [dts] [PATCH v2] mtu update: add invalid values test case Owen Hilyard

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=20200629155902.41036-1-ohilyard@iol.unh.edu \
    --to=ohilyard@iol.unh.edu \
    --cc=arybchenko@solarflare.com \
    --cc=david.marchand@redhat.com \
    --cc=dts@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=lylavoie@iol.unh.edu \
    --cc=mb@smartsharesystems.com \
    --cc=shys@mellanox.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git