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

ci: check_compliance is broken if run it inside the zephyr\scripts\ci directory #77421

Open
butok opened this issue Aug 22, 2024 · 4 comments
Open
Assignees
Labels
area: Continuous Integration Enhancement Changes/Updates/Additions to existing features

Comments

@butok
Copy link
Contributor

butok commented Aug 22, 2024

Describe the bug

check_compliance.py is broken if run it inside the zephyr\scripts\ci directory on Windows

To Reproduce

Steps to reproduce the behavior:

  1. Go to the zephyr\scripts\ci directory
  2. Run in command line: python check_compliance.py
  3. The KeepSorted test module raises a Python exception.

Expected behavior

No Python exceptions.

Impact
It is not possible to run the compliance tests in the zephyr\scripts\ci directory on Windows.

Logs and console output

C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci>python check_compliance.py
Running Identity         tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running GitDiffCheck     tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running KconfigHWMv2     tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running Kconfig          tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running ClangFormat      tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Checkpatch       tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Gitlint          tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Pylint           tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ModulesMaintainers tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ImageSize        tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running BinaryFiles      tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Nits             tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running KconfigBasic     tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running DevicetreeBindings tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running BoardYml         tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running KeepSorted       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 1769, in main
    n_fails = _main(args)
              ^^^^^^^^^^^
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1704, in _main
    test.run()
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1548, in run
    with open(file, "r") as fp:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'scripts/ci/coverage/coverage_analysis.py'

Traceback (most recent call last):
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1796, in <module>
    main(sys.argv[1:])
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1769, in main
    n_fails = _main(args)
              ^^^^^^^^^^^
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1704, in _main
    test.run()
  File "C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr\scripts\ci\check_compliance.py", line 1548, in run
    with open(file, "r") as fp:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'scripts/ci/coverage/coverage_analysis.py'

Environment (please complete the following information):

OS: Windows
SHA-1: 65051c8

Additional context
If to run it from the top directory, no errors:

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 Gitlint          tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ClangFormat      tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running MaintainersFormat tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running KeepSorted       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 Identity         tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ModulesMaintainers 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 KconfigHWMv2     tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running Checkpatch       tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Pylint           tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running Kconfig          tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running BoardYml         tests in C:\_ddm\ZEPHYR\review\butok_gh_3\zephyr ...
Running YAMLLint         tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running ImageSize        tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...
Running BinaryFiles      tests in C:/_ddm/ZEPHYR/review/butok_gh_3/zephyr ...

Complete results in compliance.xml
@butok butok added the bug The issue is a bug, or the PR is fixing a bug label Aug 22, 2024
@ttmut
Copy link
Collaborator

ttmut commented Aug 22, 2024

According to the documentation the correct way to use it is to run it from the top directory.

https://docs.zephyrproject.org/latest/contribute/guidelines.html#check-compliance-py

./scripts/ci/check_compliance.py -c upstream/main..

@butok
Copy link
Contributor Author

butok commented Aug 23, 2024

According to the documentation the correct way to use it is to run it from the top directory.

https://docs.zephyrproject.org/latest/contribute/guidelines.html#check-compliance-py

./scripts/ci/check_compliance.py -c upstream/main..

Understand. However

  • it does not claim that this is the only correct way.
  • only the KeepSorted test module is problematic. All other modules handle this case correctly.

@henrikbrixandersen
Copy link
Member

Understand. However

  • it does not claim that this is the only correct way.
  • only the KeepSorted test module is problematic. All other modules handle this case correctly.

So since this works as intended (when following the instructions), this is an enhancement, not a bug?

@butok
Copy link
Contributor Author

butok commented Aug 23, 2024

Understand. However

  • it does not claim that this is the only correct way.
  • only the KeepSorted test module is problematic. All other modules handle this case correctly.

So since this works as intended (when following the instructions), this is an enhancement, not a bug?

OK. It can be marked as a place for improvement.

@henrikbrixandersen henrikbrixandersen added Enhancement Changes/Updates/Additions to existing features area: Continuous Integration and removed bug The issue is a bug, or the PR is fixing a bug labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Continuous Integration Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

5 participants