[ovs-dev] [PATCHv2 1/5] system-common-macros: Allow quotes in NS_EXEC().
Daniele Di Proietto
diproiettod at vmware.com
Mon Aug 17 14:38:17 UTC 2015
Acked-by: Daniele Di Proietto <diproiettod at vmware.com>
On 12/08/2015 22:01, "Joe Stringer" <joestringer at nicira.com> wrote:
>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?
If you mean empty lines, I can confirm that. I'm not a m4 expert, but
applying the following incremental removes those:
diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 91792af..2761c08 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -27,8 +27,7 @@ m4_define([ADD_NAMESPACES],
m4_define([NS_EXEC],
[ip netns exec $1 sh << NS_EXEC_HEREDOC
$2
-NS_EXEC_HEREDOC]
-)
+NS_EXEC_HEREDOC])
# NS_CHECK_EXEC([namespace], [command], other_params...)
#
>---
> 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