[ovs-dev] [PATCH 1/2] test: Reverse the order of commands added by ON_EXIT macro

Andy Zhou azhou at nicira.com
Sat Feb 7 00:31:34 UTC 2015


Executing clean-up commands in the reverse order of their addition
seems to be better for most of the cleanup situations. For example,
in kmod tests, we should remove name spaces before remove kernel
modules.

Signed-off-by: Andy Zhou <azhou at nicira.com>
---
 tests/ovs-macros.at | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index 0581512..4a3d552 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -92,7 +92,6 @@ dnl Adds the shell COMMANDS to a collection executed when the current test
 dnl completes, as a cleanup action.  (The most common use is to kill a
 dnl daemon started by the test.  This is important to prevent tests that
 dnl start daemons from hanging at exit.)
-m4_define([ON_EXIT], [trap '. ./cleanup' 0; cat >>cleanup <<'EOF'
-$1
-EOF
+dnl The commands will be added will be tht first one to excute.
+m4_define([ON_EXIT], [trap '. ./cleanup' 0; (echo '$1'; cat cleanup) > __cleanup; mv __cleanup cleanup
 ])
-- 
1.9.1




More information about the dev mailing list