Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running twister with code coverage causes an exception #66897

Closed
keith-zephyr opened this issue Dec 22, 2023 · 0 comments · Fixed by #66898
Closed

Running twister with code coverage causes an exception #66897

keith-zephyr opened this issue Dec 22, 2023 · 0 comments · Fixed by #66898
Assignees
Labels
area: Twister Twister bug The issue is a bug, or the PR is fixing a bug

Comments

@keith-zephyr
Copy link
Contributor

Describe the bug
Running twister to generate coverage against a non-native board causes an exception.

To Reproduce
Steps to reproduce the behavior:

  1. ./scripts/twister -T tests/arch/x86/nmi/ --coverage
  2. Exception generated:
Traceback (most recent call last):
  File "/big_ssd/keithshort/zephyrproject/zephyr/./scripts/twister", line 214, in <module>
    ret = main(options)
          ^^^^^^^^^^^^^
  File "/big_ssd/keithshort/zephyrproject/zephyr/scripts/pylib/twister/twisterlib/twister_main.py", line 205, in main
    coverage_completed = run_coverage(tplan, options)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/big_ssd/keithshort/zephyrproject/zephyr/scripts/pylib/twister/twisterlib/coverage.py", line 351, in run_coverage
    coverage_completed = coverage_tool.generate(options.outdir)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/big_ssd/keithshort/zephyrproject/zephyr/scripts/pylib/twister/twisterlib/coverage.py", line 122, in generate
    ret = self._generate(outdir, coveragelog)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/big_ssd/keithshort/zephyrproject/zephyr/scripts/pylib/twister/twisterlib/coverage.py", line 282, in _generate
    subprocess.call(["gcovr", "-r", self.base_dir, "--gcov-executable",
  File "/usr/lib/python3.11/subprocess.py", line 389, in call
    with Popen(*popenargs, **kwargs) as p:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1883, in _execute_child
    self.pid = _fork_exec(
               ^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType
@keith-zephyr keith-zephyr added the bug The issue is a bug, or the PR is fixing a bug label Dec 22, 2023
keith-zephyr added a commit to keith-zephyr/zephyr that referenced this issue Dec 22, 2023
Fix an exception when running coverage using gcov or llvm-cov.

Fixes zephyrproject-rtos#66897

Signed-off-by: Keith Short <keithshort@google.com>
nashif pushed a commit that referenced this issue Dec 22, 2023
Fix an exception when running coverage using gcov or llvm-cov.

Fixes #66897

Signed-off-by: Keith Short <keithshort@google.com>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this issue Dec 23, 2023
Fix an exception when running coverage using gcov or llvm-cov.

Fixes zephyrproject-rtos/zephyr#66897

(cherry picked from commit f6a7895)

Original-Signed-off-by: Keith Short <keithshort@google.com>
GitOrigin-RevId: f6a7895
Change-Id: I17adb06f0d6bff407201064d052a99f6c2bbe981
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5148258
Reviewed-by: Keith Short <keithshort@chromium.org>
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Twister Twister bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants