All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] runfvp: exit with the return code of the FVP binary
@ 2021-06-11 15:32 Ross Burton
  2021-06-11 15:32 ` [PATCH 2/3] runfvp: pass arbitrary options after -- to " Ross Burton
  2021-06-11 15:32 ` [PATCH 3/3] runfvp: drop --parameter, users can use -- --parameter Ross Burton
  0 siblings, 2 replies; 3+ messages in thread
From: Ross Burton @ 2021-06-11 15:32 UTC (permalink / raw)
  To: meta-arm

Change-Id: If79e31e61110161c9a13dd512b0146d1d515d77a
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/runfvp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/runfvp b/scripts/runfvp
index d0e97d0..4ef0bfc 100755
--- a/scripts/runfvp
+++ b/scripts/runfvp
@@ -154,7 +154,7 @@ def runfvp(args):
             logger.error(f"{fvp_process.args[0]} quit with code {fvp_process.returncode}:")
             logger.error(output)
     else:
-        subprocess.run(cli)
+        sys.exit(subprocess.run(cli).returncode)
 
 if __name__ == "__main__":
     runfvp(sys.argv)
-- 
2.25.1


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

* [PATCH 2/3] runfvp: pass arbitrary options after -- to the FVP binary
  2021-06-11 15:32 [PATCH 1/3] runfvp: exit with the return code of the FVP binary Ross Burton
@ 2021-06-11 15:32 ` Ross Burton
  2021-06-11 15:32 ` [PATCH 3/3] runfvp: drop --parameter, users can use -- --parameter Ross Burton
  1 sibling, 0 replies; 3+ messages in thread
From: Ross Burton @ 2021-06-11 15:32 UTC (permalink / raw)
  To: meta-arm

To allow passing arbitrary options to the FVP binary, split the passed
options on --.  Anything before the separator is handled by runfvp,
anything afterwards is passed as-is to the FVP binary.

Change-Id: I686b2fb79d217e26988753be7bd067c638d69eac
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/runfvp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/scripts/runfvp b/scripts/runfvp
index 4ef0bfc..4761270 100755
--- a/scripts/runfvp
+++ b/scripts/runfvp
@@ -46,9 +46,18 @@ def runfvp(args):
     group.add_argument("-c", "--console", action="store_true", help="Attach the first uart to stdin/stdout")
     parser.add_argument("-C", "--parameter", action="append", default=[], help="Extra configuration parameters for FVP")
     parser.add_argument("--verbose", action="store_true", help="Output verbose logging")
+    parser.usage = f"{parser.format_usage().strip()} -- [ arguments passed to FVP ]"
     # TODO option for telnet vs netcat
 
-    args = parser.parse_args()
+    try:
+        i = sys.argv.index("--")
+        arguments = sys.argv[1:i]
+        fvp_args = sys.argv[i+1:]
+    except ValueError:
+        arguments = sys.argv[1:]
+        fvp_args = []
+
+    args = parser.parse_args(args=arguments)
     logging.basicConfig(level=args.verbose and logging.DEBUG or logging.WARNING)
     logger.debug(f"Parsed arguments are {vars(args)}")
 
@@ -120,10 +129,13 @@ def runfvp(args):
 
     cli.extend(config["args"])
 
-    # Finally add the user's extra arguments
+    # Add any explicit --parameter calls
     for param in args.parameter:
         cli.extend(["--parameter", param])
 
+    # Finally add the user's extra arguments
+    cli.extend(fvp_args)
+
     logger.debug(f"Constructed FVP call: {cli}")
     if args.console:
         expected_terminal = config["console"]
-- 
2.25.1


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

* [PATCH 3/3] runfvp: drop --parameter, users can use -- --parameter
  2021-06-11 15:32 [PATCH 1/3] runfvp: exit with the return code of the FVP binary Ross Burton
  2021-06-11 15:32 ` [PATCH 2/3] runfvp: pass arbitrary options after -- to " Ross Burton
@ 2021-06-11 15:32 ` Ross Burton
  1 sibling, 0 replies; 3+ messages in thread
From: Ross Burton @ 2021-06-11 15:32 UTC (permalink / raw)
  To: meta-arm

Now that arbitrary parameters can be passed to the FVP binary, runfvp
doesn't need to handle --parameter itself.

Anyone using runfvp --parameter should simply use runfvp -- --parameter.

Change-Id: I8a79200fe927c253308731e7e0cb228e53cd989a
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/runfvp | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/scripts/runfvp b/scripts/runfvp
index 4761270..be04768 100755
--- a/scripts/runfvp
+++ b/scripts/runfvp
@@ -44,7 +44,6 @@ def runfvp(args):
     group = parser.add_mutually_exclusive_group()
     group.add_argument("-t", "--terminals", choices=terminal_map.keys(), default="xterm", help="Automatically start terminals")
     group.add_argument("-c", "--console", action="store_true", help="Attach the first uart to stdin/stdout")
-    parser.add_argument("-C", "--parameter", action="append", default=[], help="Extra configuration parameters for FVP")
     parser.add_argument("--verbose", action="store_true", help="Output verbose logging")
     parser.usage = f"{parser.format_usage().strip()} -- [ arguments passed to FVP ]"
     # TODO option for telnet vs netcat
@@ -129,10 +128,6 @@ def runfvp(args):
 
     cli.extend(config["args"])
 
-    # Add any explicit --parameter calls
-    for param in args.parameter:
-        cli.extend(["--parameter", param])
-
     # Finally add the user's extra arguments
     cli.extend(fvp_args)
 
-- 
2.25.1


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

end of thread, other threads:[~2021-06-11 15:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 15:32 [PATCH 1/3] runfvp: exit with the return code of the FVP binary Ross Burton
2021-06-11 15:32 ` [PATCH 2/3] runfvp: pass arbitrary options after -- to " Ross Burton
2021-06-11 15:32 ` [PATCH 3/3] runfvp: drop --parameter, users can use -- --parameter Ross Burton

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.