diff options
-rw-r--r-- | tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json | 26 | ||||
-rwxr-xr-x | tools/testing/selftests/tc-testing/tdc_multibatch.py | 26 |
2 files changed, 49 insertions, 3 deletions
diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json b/tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json index 102a6a3f08df..8316634a0cd7 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json +++ b/tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json | |||
@@ -121,5 +121,31 @@ | |||
121 | "$TC qdisc del dev $DEV2 ingress", | 121 | "$TC qdisc del dev $DEV2 ingress", |
122 | "/bin/rm -rf $BATCH_DIR" | 122 | "/bin/rm -rf $BATCH_DIR" |
123 | ] | 123 | ] |
124 | }, | ||
125 | { | ||
126 | "id": "ab62", | ||
127 | "name": "Add and delete from same tp with 10 tc instances", | ||
128 | "category": [ | ||
129 | "filter", | ||
130 | "flower", | ||
131 | "concurrency" | ||
132 | ], | ||
133 | "setup": [ | ||
134 | "/bin/mkdir $BATCH_DIR", | ||
135 | "$TC qdisc add dev $DEV2 ingress", | ||
136 | "./tdc_multibatch.py -x init_ $DEV2 $BATCH_DIR 100000 5 add", | ||
137 | "find $BATCH_DIR/init_* -print | xargs -n 1 -P 5 $TC -b", | ||
138 | "./tdc_multibatch.py -x par_ -a 500001 -m 5 $DEV2 $BATCH_DIR 100000 5 add", | ||
139 | "./tdc_multibatch.py -x par_ $DEV2 $BATCH_DIR 100000 5 del" | ||
140 | ], | ||
141 | "cmdUnderTest": "find $BATCH_DIR/par_* -print | xargs -n 1 -P 10 $TC -b", | ||
142 | "expExitCode": "0", | ||
143 | "verifyCmd": "$TC -s filter show dev $DEV2 ingress", | ||
144 | "matchPattern": "filter protocol ip pref 1 flower chain 0 handle", | ||
145 | "matchCount": "500000", | ||
146 | "teardown": [ | ||
147 | "$TC qdisc del dev $DEV2 ingress", | ||
148 | "/bin/rm -rf $BATCH_DIR" | ||
149 | ] | ||
124 | } | 150 | } |
125 | ] | 151 | ] |
diff --git a/tools/testing/selftests/tc-testing/tdc_multibatch.py b/tools/testing/selftests/tc-testing/tdc_multibatch.py index 0d8be39b5580..5e7237952e49 100755 --- a/tools/testing/selftests/tc-testing/tdc_multibatch.py +++ b/tools/testing/selftests/tc-testing/tdc_multibatch.py | |||
@@ -22,24 +22,44 @@ parser.add_argument( | |||
22 | choices=['add', 'del', 'replace'], | 22 | choices=['add', 'del', 'replace'], |
23 | help="operation to perform on filters") | 23 | help="operation to perform on filters") |
24 | parser.add_argument( | 24 | parser.add_argument( |
25 | "-x", | ||
26 | "--file_prefix", | ||
27 | default="", | ||
28 | help="prefix for generated batch file names") | ||
29 | parser.add_argument( | ||
25 | "-d", | 30 | "-d", |
26 | "--duplicate_handles", | 31 | "--duplicate_handles", |
27 | action="store_true", | 32 | action="store_true", |
28 | help="duplicate filter handle range in all files") | 33 | help="duplicate filter handle range in all files") |
34 | parser.add_argument( | ||
35 | "-a", | ||
36 | "--handle_start", | ||
37 | type=int, | ||
38 | default=1, | ||
39 | help="start handle range from (default: 1)") | ||
40 | parser.add_argument( | ||
41 | "-m", | ||
42 | "--mac_prefix", | ||
43 | type=int, | ||
44 | default=0, | ||
45 | choices=range(0, 256), | ||
46 | help="add this value to third byte of source MAC address of flower filter" | ||
47 | "(default: 0)") | ||
29 | args = parser.parse_args() | 48 | args = parser.parse_args() |
30 | 49 | ||
31 | device = args.device | 50 | device = args.device |
32 | dir = args.dir | 51 | dir = args.dir |
33 | file_prefix = args.operation + "_" | 52 | file_prefix = args.file_prefix + args.operation + "_" |
34 | num_filters = args.num_filters | 53 | num_filters = args.num_filters |
35 | num_files = args.num_files | 54 | num_files = args.num_files |
36 | operation = args.operation | 55 | operation = args.operation |
37 | duplicate_handles = args.duplicate_handles | 56 | duplicate_handles = args.duplicate_handles |
38 | handle = 1 | 57 | handle = args.handle_start |
58 | mac_prefix = args.mac_prefix | ||
39 | 59 | ||
40 | for i in range(num_files): | 60 | for i in range(num_files): |
41 | file = dir + '/' + file_prefix + str(i) | 61 | file = dir + '/' + file_prefix + str(i) |
42 | os.system("./tdc_batch.py -n {} -a {} -e {} -m {} {} {}".format( | 62 | os.system("./tdc_batch.py -n {} -a {} -e {} -m {} {} {}".format( |
43 | num_filters, handle, operation, i, device, file)) | 63 | num_filters, handle, operation, i + mac_prefix, device, file)) |
44 | if not duplicate_handles: | 64 | if not duplicate_handles: |
45 | handle += num_filters | 65 | handle += num_filters |