]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
unit-test: clean up evironment after Hush tests
authorStephen Warren <swarren@wwwdotorg.org>
Fri, 28 Feb 2014 05:01:28 +0000 (22:01 -0700)
committerTom Rini <trini@ti.com>
Fri, 7 Mar 2014 15:59:06 +0000 (10:59 -0500)
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>
test/command_ut.c

index 620a297d45ac3e3b3d051b580b76c817b2e4c301..4f420569a2d045b13e09aba5a9d0545390c67ac2 100644 (file)
@@ -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);