Commit 88153e29 authored by Victor Nogueira's avatar Victor Nogueira Committed by Jakub Kicinski
Browse files

selftests: tc-testing: Add testcases to test new flush behaviour



Add tdc test cases to verify new flush behaviour is correct, which do
the following:

- Try to flush only one action which is being referenced by a filter
- Try to flush three actions where the last one (index 3) is being
  referenced by a filter

Signed-off-by: default avatarVictor Nogueira <victor@mojatatu.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 76b39b94
Loading
Loading
Loading
Loading
+77 −0
Original line number Diff line number Diff line
@@ -609,5 +609,82 @@
        "teardown": [
            "$TC actions flush action gact"
        ]
    },
    {
        "id": "7f52",
        "name": "Try to flush action which is referenced by filter",
        "category": [
            "actions",
            "gact"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            [
                "$TC actions flush action gact",
                0,
                1,
                255
            ],
            "$TC qdisc add dev $DEV1 ingress",
            "$TC actions add action pass index 1",
            "$TC filter add dev $DEV1 protocol all ingress prio 1 handle 0x1234 matchall action gact index 1"
        ],
        "cmdUnderTest": "$TC actions flush action gact",
        "expExitCode": "1",
        "verifyCmd": "$TC actions ls action gact",
        "matchPattern": "total acts 1.*action order [0-9]*: gact action pass.*index 1 ref 2 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress",
            [
                "sleep 1; $TC actions flush action gact",
                0,
                1
            ]
        ]
    },
    {
        "id": "ae1e",
        "name": "Try to flush actions when last one is referenced by filter",
        "category": [
            "actions",
            "gact"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            [
                "$TC actions flush action gact",
                0,
                1,
                255
            ],
            "$TC qdisc add dev $DEV1 ingress",
	    [
                "$TC actions add action pass index 1",
		0,
		1,
		255
	    ],
            "$TC actions add action reclassify index 2",
            "$TC actions add action drop index 3",
            "$TC filter add dev $DEV1 protocol all ingress prio 1 handle 0x1234 matchall action gact index 3"
        ],
        "cmdUnderTest": "$TC actions flush action gact",
        "expExitCode": "0",
        "verifyCmd": "$TC actions ls action gact",
        "matchPattern": "total acts 1.*action order [0-9]*: gact action drop.*index 3 ref 2 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress",
            [
                "sleep 1; $TC actions flush action gact",
                0,
                1
            ]
        ]
    }
]