diff mbox

[U-Boot] unit-test: clean up evironment after Hush tests

Message ID 1393563688-16588-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren Feb. 28, 2014, 5:01 a.m. UTC
Delete the temporary variables that are used to save unit-test results
from the environment after running the test. This prevents polluting
the environment, or growing it too much.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
 test/command_ut.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Simon Glass March 2, 2014, 12:12 a.m. UTC | #1
On 27 February 2014 22:01, Stephen Warren <swarren@wwwdotorg.org> wrote:

> Delete the temporary variables that are used to save unit-test results
> from the environment after running the test. This prevents polluting
> the environment, or growing it too much.
>
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
>

Acked-by: Simon Glass <sjg@chromium.org>
Tom Rini March 7, 2014, 10:27 p.m. UTC | #2
On Thu, Feb 27, 2014 at 10:01:28PM -0700, Stephen Warren wrote:

> Delete the temporary variables that are used to save unit-test results
> from the environment after running the test. This prevents polluting
> the environment, or growing it too much.
> 
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/test/command_ut.c b/test/command_ut.c
index 56041e9..b6b6976 100644
--- a/test/command_ut.c
+++ b/test/command_ut.c
@@ -65,7 +65,8 @@  static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	run_command("if test " expr " ; then " \
 			"setenv " #name "_" #expected_result " y; else " \
 			"setenv " #name "_" #expected_result " n; fi", 0); \
-	assert(!strcmp(#expected_result, getenv(#name "_" #expected_result)));
+	assert(!strcmp(#expected_result, getenv(#name "_" #expected_result))); \
+	setenv(#name "_" #expected_result, NULL);
 
 	/* Basic operators */
 	HUSH_TEST(streq, "aaa = aaa", y);