All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] sandbox: Return '-c command' exit value as sandbox exit code
@ 2015-02-06 21:37 Joe Hershberger
  2015-02-10 19:50 ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Hershberger @ 2015-02-06 21:37 UTC (permalink / raw)
  To: u-boot

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>

---

 arch/sandbox/cpu/start.c         |  6 ++++--
 arch/sandbox/cpu/state.c         |  5 -----
 arch/sandbox/include/asm/state.h | 15 ---------------
 3 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 097f29a..ec01040 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -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;
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index ba73b7e..033958c 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -13,11 +13,6 @@
 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;
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index 32d55cc..a0c24ba 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -10,13 +10,6 @@
 #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 */
@@ -139,13 +131,6 @@ struct sandbox_state_io {
 	}
 
 /**
- * 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.
  *
  * @return pointer to state
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] sandbox: Return '-c command' exit value as sandbox exit code
  2015-02-06 21:37 [U-Boot] [PATCH] sandbox: Return '-c command' exit value as sandbox exit code Joe Hershberger
@ 2015-02-10 19:50 ` Simon Glass
  2015-02-15 21:40   ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2015-02-10 19:50 UTC (permalink / raw)
  To: u-boot

On 6 February 2015 at 14:37, Joe Hershberger <joe.hershberger@ni.com> wrote:
>
> 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>
>
> ---
>
>  arch/sandbox/cpu/start.c         |  6 ++++--
>  arch/sandbox/cpu/state.c         |  5 -----
>  arch/sandbox/include/asm/state.h | 15 ---------------
>  3 files changed, 4 insertions(+), 22 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] sandbox: Return '-c command' exit value as sandbox exit code
  2015-02-10 19:50 ` Simon Glass
@ 2015-02-15 21:40   ` Simon Glass
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Glass @ 2015-02-15 21:40 UTC (permalink / raw)
  To: u-boot

On 10 February 2015 at 12:50, Simon Glass <sjg@chromium.org> wrote:
> On 6 February 2015 at 14:37, Joe Hershberger <joe.hershberger@ni.com> wrote:
>>
>> 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>
>>
>> ---
>>
>>  arch/sandbox/cpu/start.c         |  6 ++++--
>>  arch/sandbox/cpu/state.c         |  5 -----
>>  arch/sandbox/include/asm/state.h | 15 ---------------
>>  3 files changed, 4 insertions(+), 22 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-x86/sandbox.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-15 21:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-06 21:37 [U-Boot] [PATCH] sandbox: Return '-c command' exit value as sandbox exit code Joe Hershberger
2015-02-10 19:50 ` Simon Glass
2015-02-15 21:40   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.