diff mbox series

[net-next,v2,5/6] selftests: qdiscs: RED: Add taildrop tests

Message ID 20200311173356.38181-6-petrm@mellanox.com
State Changes Requested
Delegated to: David Miller
Headers show
Series RED: Introduce an ECN tail-dropping mode | expand

Commit Message

Petr Machata March 11, 2020, 5:33 p.m. UTC
Add tests for the new "taildrop" flag.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---

Notes:
    v2:
    - Require nsPlugin in each RED test
    - Match end-of-line to catch cases of more flags reported than
      requested
    - Add a test for creation of non-ECN taildrop, which should fail

 .../tc-testing/tc-tests/qdiscs/red.json       | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)

Comments

Roman Mashak March 12, 2020, 2:21 a.m. UTC | #1
Petr Machata <petrm@mellanox.com> writes:

> Add tests for the new "taildrop" flag.
>
> Signed-off-by: Petr Machata <petrm@mellanox.com>
> ---
>
> Notes:
>     v2:
>     - Require nsPlugin in each RED test
>     - Match end-of-line to catch cases of more flags reported than
>       requested
>     - Add a test for creation of non-ECN taildrop, which should fail
>
>  .../tc-testing/tc-tests/qdiscs/red.json       | 68 +++++++++++++++++++
>  1 file changed, 68 insertions(+)
>
> diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
> index b70a54464897..72676073c658 100644
> --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
> +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
> @@ -113,5 +113,73 @@
>              "$TC qdisc del dev $DUMMY handle 1: root",
>              "$IP link del dev $DUMMY type dummy"
>          ]
> +    },
> +    {
> +        "id": "53e8",
> +        "name": "Create RED with flags ECN, taildrop",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn taildrop limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn taildrop $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    },
> +    {
> +        "id": "d091",
> +        "name": "Fail to create RED with only taildrop flag",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red taildrop limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "2",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red",
> +        "matchCount": "0",
> +        "teardown": [
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    },
> +    {
> +        "id": "af8e",
> +        "name": "Create RED with flags ECN, taildrop, harddrop",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn harddrop taildrop limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn harddrop taildrop $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
>      }
>  ]

Reviewed-by: Roman Mashak <mrv@mojatatu.com>
diff mbox series

Patch

diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
index b70a54464897..72676073c658 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
@@ -113,5 +113,73 @@ 
             "$TC qdisc del dev $DUMMY handle 1: root",
             "$IP link del dev $DUMMY type dummy"
         ]
+    },
+    {
+        "id": "53e8",
+        "name": "Create RED with flags ECN, taildrop",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn taildrop limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn taildrop $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    },
+    {
+        "id": "d091",
+        "name": "Fail to create RED with only taildrop flag",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red taildrop limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "2",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red",
+        "matchCount": "0",
+        "teardown": [
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    },
+    {
+        "id": "af8e",
+        "name": "Create RED with flags ECN, taildrop, harddrop",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn harddrop taildrop limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn harddrop taildrop $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
     }
 ]