zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.52k stars 6.44k forks source link

ci: check_compliance: ClangFormat module is broken #77328

Closed butok closed 4 weeks ago

butok commented 4 weeks ago

Describe the bug

Recently added zephyr\scripts\ci\check_compliance.py ClangFormat check is broken for Windows,

To Reproduce

Steps to reproduce the behavior:

  1. Run in command line: python scripts/ci/check_compliance.py
  2. The ClangFormat raises a Python exception.

Expected behavior No Python exceptions.

Impact It is not possible to run the compliance tests on Windows.

Logs and console output

C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr>python scripts/ci/check_compliance.py
Running Nits             tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running KconfigHWMv2     tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running MaintainersFormat tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ImageSize        tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Identity         tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Kconfig          tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running Gitlint          tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running GitDiffCheck     tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running DevicetreeBindings tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running KconfigBasicNoModules tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running YAMLLint         tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running KeepSorted       tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running BinaryFiles      tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ModulesMaintainers tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Pylint           tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ClangFormat      tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Python exception in `C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py`:

Traceback (most recent call last):
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1766, in main
    n_fails = _main(args)
              ^^^^^^^^^^^
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1701, in _main
    test.run()
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 284, in run
    subprocess.run(('clang-format-diff.py', '-p1'),
  File "C:\Python311\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python311\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

Traceback (most recent call last):
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1793, in <module>
    main(sys.argv[1:])
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1766, in main
    n_fails = _main(args)
              ^^^^^^^^^^^
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1701, in _main
    test.run()
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 284, in run
    subprocess.run(('clang-format-diff.py', '-p1'),
  File "C:\Python311\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python311\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

Environment (please complete the following information):

Additional context

If to disable the ClangFormat module, the check runs without any error:

C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr>python scripts/ci/check_compliance.py
Running ImageSize        tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ModulesMaintainers tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running BinaryFiles      tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Gitlint          tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Identity         tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Nits             tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Pylint           tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running KconfigHWMv2     tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running GitDiffCheck     tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running KconfigBasicNoModules tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running KconfigBasic     tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running Kconfig          tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running DevicetreeBindings tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running KeepSorted       tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Checkpatch       tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running YAMLLint         tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running MaintainersFormat tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running BoardYml         tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...

Complete results in compliance.xml
pdgendt commented 4 weeks ago

@butok can you try with #77332