aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Bates <lucasb@mojatatu.com>2018-03-26 10:46:14 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-27 10:52:07 -0400
commitcd464197f2378499db134d6c44af3b4e3c0c14b5 (patch)
treeee5e050e83da80c020d399523d7b8f8c1b2998e1
parente1a22d13eb1f302afd692583777e27828d375a39 (diff)
tc-testing: Correct compound statements for namespace execution
If tdc is executing test cases inside a namespace, only the first command in a compound statement will be executed inside the namespace by tdc. As a result, the subsequent commands are not executed inside the namespace and the test will fail. Example: for i in {x..y}; do args="foo"; done && tc actions add $args The namespace execution feature will prepend 'ip netns exec' to the command: ip netns exec tcut for i in {x..y}; do args="foo"; done && \ tc actions add $args So the actual tc command is not parsed by the shell as being part of the namespace execution. Enclosing these compound statements inside a bash invocation with proper escape characters resolves the problem by creating a subshell inside the namespace. Signed-off-by: Lucas Bates <lucasb@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--tools/testing/selftests/tc-testing/tc-tests/actions/gact.json10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/gact.json b/tools/testing/selftests/tc-testing/tc-tests/actions/gact.json
index ae96d0350d7e..68c91023cdb9 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/gact.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/gact.json
@@ -481,7 +481,7 @@
481 255 481 255
482 ] 482 ]
483 ], 483 ],
484 "cmdUnderTest": "for i in `seq 1 32`; do cmd=\"action pass index $i \"; args=\"$args$cmd\"; done && $TC actions add $args", 484 "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action pass index \\$i \\\"; args=\"\\$args\\$cmd\"; done && $TC actions add \\$args\"",
485 "expExitCode": "0", 485 "expExitCode": "0",
486 "verifyCmd": "$TC actions list action gact", 486 "verifyCmd": "$TC actions list action gact",
487 "matchPattern": "^[ \t]+index [0-9]+ ref", 487 "matchPattern": "^[ \t]+index [0-9]+ ref",
@@ -505,7 +505,7 @@
505 255 505 255
506 ] 506 ]
507 ], 507 ],
508 "cmdUnderTest": "for i in `seq 1 32`; do cmd=\"action continue index $i cookie aabbccddeeff112233445566778800a1 \"; args=\"$args$cmd\"; done && $TC actions add $args", 508 "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action continue index \\$i cookie aabbccddeeff112233445566778800a1 \\\"; args=\"\\$args\\$cmd\"; done && $TC actions add \\$args\"",
509 "expExitCode": "0", 509 "expExitCode": "0",
510 "verifyCmd": "$TC actions list action gact", 510 "verifyCmd": "$TC actions list action gact",
511 "matchPattern": "^[ \t]+index [0-9]+ ref", 511 "matchPattern": "^[ \t]+index [0-9]+ ref",
@@ -528,13 +528,13 @@
528 1, 528 1,
529 255 529 255
530 ], 530 ],
531 "for i in `seq 1 32`; do cmd=\"action continue index $i \"; args=\"$args$cmd\"; done && $TC actions add $args" 531 "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action continue index \\$i \\\"; args=\\\"\\$args\\$cmd\\\"; done && $TC actions add \\$args\""
532 ], 532 ],
533 "cmdUnderTest": "for i in `seq 1 32`; do cmd=\"action gact index $i \"; args=\"$args$cmd\"; done && $TC actions del $args", 533 "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action gact index \\$i \\\"; args=\"\\$args\\$cmd\"; done && $TC actions del \\$args\"",
534 "expExitCode": "0", 534 "expExitCode": "0",
535 "verifyCmd": "$TC actions list action gact", 535 "verifyCmd": "$TC actions list action gact",
536 "matchPattern": "^[ \t]+index [0-9]+ ref", 536 "matchPattern": "^[ \t]+index [0-9]+ ref",
537 "matchCount": "0", 537 "matchCount": "0",
538 "teardown": [] 538 "teardown": []
539 } 539 }
540] \ No newline at end of file 540]