]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
sandbox: Return '-c command' exit value as sandbox exit code
authorJoe Hershberger <joe.hershberger@ni.com>
Fri, 6 Feb 2015 21:37:31 +0000 (15:37 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 11:52:19 +0000 (13:52 +0200)
When a command is passed into sandbox using the '-c' argument the
command is run directly. This is most helpful when running tests (such
as test-dm.sh). Previously the exit code was an unused enum. Change it
to be the actual return code from the command so that the script calling
sandbox can know if the command succeeded (tests passed).  Also remove
the now completely unused "exit_state" in sandbox.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/start.c
arch/sandbox/cpu/state.c
arch/sandbox/include/asm/state.h

index 097f29a2901b7348171359c596ba53036a738d0f..ec010402d77f47f40b2ca3950d4cb9a5e52355c4 100644 (file)
@@ -78,11 +78,13 @@ int sandbox_main_loop_init(void)
 
        /* Execute command if required */
        if (state->cmd) {
+               int retval;
+
                cli_init();
 
-               run_command_list(state->cmd, -1, 0);
+               retval = run_command_list(state->cmd, -1, 0);
                if (!state->interactive)
-                       os_exit(state->exit_type);
+                       os_exit(retval);
        }
 
        return 0;
index ba73b7e251040831f45a38d29132479b605c0abc..033958ce74235b26ecf374a69c83b11175c7b56c 100644 (file)
 static struct sandbox_state main_state;
 static struct sandbox_state *state;    /* Pointer to current state record */
 
-void state_record_exit(enum exit_type_id exit_type)
-{
-       state->exit_type = exit_type;
-}
-
 static int state_ensure_space(int extra_size)
 {
        void *blob = state->state_fdt;
index 32d55ccc4c241deacdcf394daac81859d234657d..a0c24ba1e053fec66990626812332a60302b6276 100644 (file)
 #include <stdbool.h>
 #include <linux/stringify.h>
 
-/* How we exited U-Boot */
-enum exit_type_id {
-       STATE_EXIT_NORMAL,
-       STATE_EXIT_COLD_REBOOT,
-       STATE_EXIT_POWER_OFF,
-};
-
 /**
  * Selects the behavior of the serial terminal.
  *
@@ -50,7 +43,6 @@ struct sandbox_state {
        const char *cmd;                /* Command to execute */
        bool interactive;               /* Enable cmdline after execute */
        const char *fdt_fname;          /* Filename of FDT binary */
-       enum exit_type_id exit_type;    /* How we exited U-Boot */
        const char *parse_err;          /* Error to report from parsing */
        int argc;                       /* Program arguments */
        char **argv;                    /* Command line arguments */
@@ -138,13 +130,6 @@ struct sandbox_state_io {
                .compat = _compat, \
        }
 
-/**
- * Record the exit type to be reported by the test program.
- *
- * @param exit_type    Exit type to record
- */
-void state_record_exit(enum exit_type_id exit_type);
-
 /**
  * Gets a pointer to the current state.
  *