[v1,07/24] docker: allow "cc" command to run in user context

Message ID 20180410193919.28026-8-alex.bennee@linaro.org
State New
Headers show
Series
  • fix building of tests/tcg
Related show

Commit Message

Alex Bennée April 10, 2018, 7:39 p.m.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 tests/docker/docker.py | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.16.2

Comments

Fam Zheng April 12, 2018, 8:08 a.m. | #1
On Tue, 04/10 20:39, Alex Bennée wrote:
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  tests/docker/docker.py | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> index 9444f4bea4..f79213044d 100755

> --- a/tests/docker/docker.py

> +++ b/tests/docker/docker.py

> @@ -399,6 +399,8 @@ class CcCommand(SubCommand):

>                              help="The docker image in which to run cc")

>          parser.add_argument("--cc",

>                              help="The compiler executable to call")

> +        parser.add_argument("--user",

> +                            help="The user-id to run under")

>          parser.add_argument("--source-path", "-s", nargs="*", dest="paths",

>                              help="""Extra paths to (ro) mount into container for

>                              reading sources""")

> @@ -414,6 +416,9 @@ class CcCommand(SubCommand):

>              for p in args.paths:

>                  cmd += ["-v", "%s:%s:ro,z" % (p, p)]

>  

> +        if args.user:

> +            cmd += ["-u", args.user]

> +

>          cmd += [args.image]

>  

>          # The compile command we are running

> -- 

> 2.16.2

> 


Reviewed-by: Fam Zheng <famz@redhat.com>
Philippe Mathieu-Daudé April 16, 2018, 12:02 a.m. | #2
On 04/10/2018 04:39 PM, Alex Bennée wrote:
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>  tests/docker/docker.py | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> index 9444f4bea4..f79213044d 100755

> --- a/tests/docker/docker.py

> +++ b/tests/docker/docker.py

> @@ -399,6 +399,8 @@ class CcCommand(SubCommand):

>                              help="The docker image in which to run cc")

>          parser.add_argument("--cc",

>                              help="The compiler executable to call")

> +        parser.add_argument("--user",

> +                            help="The user-id to run under")

>          parser.add_argument("--source-path", "-s", nargs="*", dest="paths",

>                              help="""Extra paths to (ro) mount into container for

>                              reading sources""")

> @@ -414,6 +416,9 @@ class CcCommand(SubCommand):

>              for p in args.paths:

>                  cmd += ["-v", "%s:%s:ro,z" % (p, p)]

>  

> +        if args.user:

> +            cmd += ["-u", args.user]

> +

>          cmd += [args.image]

>  

>          # The compile command we are running

>

Patch

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 9444f4bea4..f79213044d 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -399,6 +399,8 @@  class CcCommand(SubCommand):
                             help="The docker image in which to run cc")
         parser.add_argument("--cc",
                             help="The compiler executable to call")
+        parser.add_argument("--user",
+                            help="The user-id to run under")
         parser.add_argument("--source-path", "-s", nargs="*", dest="paths",
                             help="""Extra paths to (ro) mount into container for
                             reading sources""")
@@ -414,6 +416,9 @@  class CcCommand(SubCommand):
             for p in args.paths:
                 cmd += ["-v", "%s:%s:ro,z" % (p, p)]
 
+        if args.user:
+            cmd += ["-u", args.user]
+
         cmd += [args.image]
 
         # The compile command we are running