[ovs-dev] [PATCHv2 1/5] system-common-macros: Allow quotes in NS_EXEC().

Joe Stringer joestringer at nicira.com
Wed Aug 12 21:01:26 UTC 2015


This allows arbitrary commands to be passed into the NS_EXEC macro to be
executed within a namespace, including commands that have quotes and
commands chained together.

Signed-off-by: Joe Stringer <joestringer at nicira.com>
---
Daniele, thanks for the suggestion, this seems to work pretty well. My
only complaint is that the test logs seem to end up with a bunch of
extra whitespaces printed after these commands. Do you have any insight
into why this might be?
---
 tests/system-common-macros.at | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 1321e58..198592c 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -25,7 +25,9 @@ m4_define([ADD_NAMESPACES],
 #
 # Execute 'command' in 'namespace'
 m4_define([NS_EXEC],
-    [ip netns exec $1 bash -c "$2"]
+    [ip netns exec $1 sh << NS_EXEC_HEREDOC
+$2
+NS_EXEC_HEREDOC]
 )
 
 # NS_CHECK_EXEC([namespace], [command], other_params...)
-- 
2.1.4




More information about the dev mailing list