arm/lib: pass the PATH to fvp runner
PATCH v3 1/2 arm/lib: pass the PATH to fvp runner
When running an FVP machine the model executable need to be found in the PATH environement.
At the moment the script doesn't provide any PATH to the subprocess.
Add PATH to the allowed environement variable to be forwaded.
--- meta-arm/lib/fvp/runner.py | 2 +- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
meta-arm/lib/fvp/runner.py +1 -1
@@ -91,7 +91,7 @@ class FVPRunner: # Pass through environment variables needed for GUI applications, such # as xterm, to work. env = config['env'] - for name in ('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY'): + for name in ('DISPLAY', 'PATH', 'WAYLAND_DISPLAY', 'XAUTHORITY'): if name in os.environ: env[name] = os.environ[name]
meta-arm/lib/oeqa/selftest/cases/runfvp.py +2 -2
@@ -108,7 +108,7 @@ class RunnerTests(OESelftestTestCase): stderr=unittest.mock.ANY, env={"FOO":"BAR"}) - @unittest.mock.patch.dict(os.environ, {"DISPLAY": ":42", "WAYLAND_DISPLAY": "wayland-42"}) + @unittest.mock.patch.dict(os.environ, {"DISPLAY": ":42", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}) def test_env_passthrough(self): from fvp import runner with self.create_mock() as m:
@@ -128,4 +128,4 @@ class RunnerTests(OESelftestTestCase): stdin=unittest.mock.ANY, stdout=unittest.mock.ANY, stderr=unittest.mock.ANY, - env={"DISPLAY":":42", "FOO": "BAR", "WAYLAND_DISPLAY": "wayland-42"}) + env={"DISPLAY":":42", "FOO": "BAR", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"})
Signature · 1 line
2.34.1
PATCH v3 2/2 scripts/runfvp: Fix KeyError exception when there is no FVP_CONSOLE provided
We access the dictionnary element that doesn't exist.
Use the get() method instead that will default the element to None if it doesn't exist.
--- scripts/runfvp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/runfvp +2 -2
@@ -55,8 +55,8 @@ def start_fvp(args, config, extra_args): fvp.start(config, extra_args, args.terminals) if args.console: - expected_terminal = config["consoles"]["default"] - if not expected_terminal: + expected_terminal = config["consoles"].get("default") + if expected_terminal is None: logger.error("--console used but FVP_CONSOLE not set in machine configuration") return 1 port_stdout, log_stdout = itertools.tee(fvp.stdout, 2)
Signature · 1 line
2.34.1
Quoted 31 lines · Cl�ment P�ron
When running an FVP machine the model executable need to be found in the PATH environement.
At the moment the script doesn't provide any PATH to the subprocess.
Add PATH to the allowed environement variable to be forwaded.
Signed-off-by Cl�ment P�ron <[email protected]>--- meta-arm/lib/fvp/runner.py | 2 +- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)meta-arm/lib/fvp/runner.py +1
-1@@ -91,7 +91,7 @@ class FVPRunner: # Pass through environment variables needed for GUI applications, such # as xterm, to work. env = config['env'] - for name in ('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY'): + for name in ('DISPLAY', 'PATH', 'WAYLAND_DISPLAY', 'XAUTHORITY'): if name in os.environ: env[name] = os.environ[name]meta-arm/lib/oeqa/selftest/cases/runfvp.py +0
-0
meta-arm/lib/oeqa/selftest/cases/runfvp.py class RunnerTests(OESelftestTestCase): · line 109
Quoted 2 lines
meta-arm/lib/oeqa/selftest/cases/runfvp.py +0
-0@@ -108,7 +108,7 @@ class RunnerTests(OESelftestTestCase): stderr=unittest.mock.ANY, env={"FOO":"BAR"})
This is failing CI selftest on the line above. You can see the error at https://gitlab.com/jonmason00/meta-arm/-/jobs/4087128645
If I add a wildcard-like change for PATH to the env, everything is happy. For example:
- env={"FOO":"BAR"})
+ env={"FOO":"BAR", "PATH" : unittest.mock.ANY })
I'm not sure it is a valid way to test this, as I think it ignores your hacking of the paths to test it. Since PATH is always in the env now, there is no other way to get around it being present but not matching what we expect. I'm hoping someone has a better way than ignoring it.
Thoughts? Anyone?
Thanks,
Jon
Quoted 16 lines
meta-arm/lib/oeqa/selftest/cases/runfvp.py +2
-2- @unittest.mock.patch.dict(os.environ, {"DISPLAY": ":42", "WAYLAND_DISPLAY": "wayland-42"}) + @unittest.mock.patch.dict(os.environ, {"DISPLAY": ":42", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}) def test_env_passthrough(self): from fvp import runner with self.create_mock() as m:@@ -128,4 +128,4 @@ class RunnerTests(OESelftestTestCase): stdin=unittest.mock.ANY, stdout=unittest.mock.ANY, stderr=unittest.mock.ANY, - env={"DISPLAY":":42", "FOO": "BAR", "WAYLAND_DISPLAY": "wayland-42"}) + env={"DISPLAY":":42", "FOO": "BAR", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"})Signature · 1 line
2.34.1
Hi Jon,
Quoted 43 lines · Jon Mason
Quoted 31 lines · Clément Péron
When running an FVP machine the model executable need to be found in the PATH environement.
At the moment the script doesn't provide any PATH to the subprocess.
Add PATH to the allowed environement variable to be forwaded.
Signed-off-by Clément Péron <[email protected]>--- meta-arm/lib/fvp/runner.py | 2 +- meta-arm/lib/oeqa/selftest/cases/runfvp.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)meta-arm/lib/fvp/runner.py +1
-1@@ -91,7 +91,7 @@ class FVPRunner: # Pass through environment variables needed for GUI applications, such # as xterm, to work. env = config['env'] - for name in ('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY'): + for name in ('DISPLAY', 'PATH', 'WAYLAND_DISPLAY', 'XAUTHORITY'): if name in os.environ: env[name] = os.environ[name]meta-arm/lib/oeqa/selftest/cases/runfvp.py +0
-0meta-arm/lib/oeqa/selftest/cases/runfvp.py class RunnerTests(OESelftestTestCase): · line 109
Quoted 2 lines
meta-arm/lib/oeqa/selftest/cases/runfvp.py +0
-0@@ -108,7 +108,7 @@ class RunnerTests(OESelftestTestCase): stderr=unittest.mock.ANY, env={"FOO":"BAR"})This is failing CI selftest on the line above. You can see the error at https://gitlab.com/jonmason00/meta-arm/-/jobs/4087128645
If I add a wildcard-like change for PATH to the env, everything is happy. For example:(quoted diff) +1
-1- env={"FOO":"BAR"}) + env={"FOO":"BAR", "PATH" : unittest.mock.ANY })
Quoted 7 lines
I'm not sure it is a valid way to test this, as I think it ignores your hacking of the paths to test it. Since PATH is always in the env now, there is no other way to get around it being present but not matching what we expect. I'm hoping someone has a better way than ignoring it.
Thoughts? Anyone?
I will resend a version with the os.environ mocked.
Regards,
Clement
Quoted 21 lines
Thanks,
JonQuoted 16 lines
meta-arm/lib/oeqa/selftest/cases/runfvp.py +2
-3- @unittest.mock.patch.dict(os.environ, {"DISPLAY": ":42", "WAYLAND_DISPLAY": "wayland-42"}) + @unittest.mock.patch.dict(os.environ, {"DISPLAY": ":42", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}) def test_env_passthrough(self): from fvp import runner with self.create_mock() as m:@@ -128,4 +128,4 @@ class RunnerTests(OESelftestTestCase): stdin=unittest.mock.ANY, stdout=unittest.mock.ANY, stderr=unittest.mock.ANY, - env={"DISPLAY":":42", "FOO": "BAR", "WAYLAND_DISPLAY": "wayland-42"}) + env={"DISPLAY":":42", "FOO": "BAR", "WAYLAND_DISPLAY": "wayland-42", "PATH": "/path-42:/usr/sbin:/usr/bin:/sbin:/bin"}) --2.34.1
Jon Mason
AppliedQuoted 6 lines · Clément Péron
When running an FVP machine the model executable need to be found in the PATH environement.
At the moment the script doesn't provide any PATH to the subprocess.
Add PATH to the allowed environement variable to be forwaded.
Applied, thanks!
[1/2] arm/lib: pass the PATH to fvp runner
commit: fa598021fb387e98bdb80861f245cc15acde4ca5
[2/2] scripts/runfvp: Fix KeyError exception when there is no FVP_CONSOLE provided
commit: 316e02c0f13b473e916cd779e59f0d55d48e4962Best regards,
Signature · 1 line
Jon Mason <[email protected]>