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

[SYCL][E2E] Add test to check REQUIRES #16019

Open
wants to merge 2 commits into
base: sycl
Choose a base branch
from

Conversation

KornevNikita
Copy link
Contributor

This test checks the content of every "REQUIRES" to avoid typos and non-existing requirements.

This PR also updates some tests requirements found during test development.

This test checks the content of every "REQUIRES" to avoid typos and
non-existing requirements.

This PR also updates some tests requirements found during test
development.
@KornevNikita
Copy link
Contributor Author

KornevNikita commented Nov 7, 2024

The test will fail in pre-commit as we have REQUIRES: TEMPORARY_DISABLED. There is a PR to fix this - #15946

sycl/test-e2e/Basic/fpga_tests/fpga_aocx_win.cpp Outdated Show resolved Hide resolved
sycl/test-e2e/Plugin/sycl-ls-gpu-default-level-zero.cpp Outdated Show resolved Hide resolved


def parse_requirements(input_data_path, sycl_include_dir_path):
available_features = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must import features from llvm/sycl/test-e2e/lit.cfg.py instead of building a manually maintained copy of this list.

Copy link
Contributor

@AlexeySachkov AlexeySachkov Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must import features from llvm/sycl/test-e2e/lit.cfg.py instead of building a manually maintained copy of this list.

Can we really do that in a reliable manner? Those features depend on the environment (OS, available tools, build configuration, enabled projects, etc.).

I.e. it is expected that REQUIRES may reference features which are not registered. But some of those could be known and therefore legal, whilst others could be a result of a typo and therefore should be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must import features from llvm/sycl/test-e2e/lit.cfg.py instead of building a manually maintained copy of this list.

+1 to Alexey's question. lit.cfg.py generates the set of available features "online" according to the specific env. Do you know if it's possible to get the whole set regardless of env? I agree it's not the best idea to maintain this set manually, but I'm not sure if we have another options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an idea, but it requires refactoring of llvm/sycl/test-e2e/lit.cfg.py.
We can have a dictionary of all features with callbacks like this:

features = {
'x': available, # 'available' function just returns true, i.e. make 'x' always available.
'y': is_y_available, # 'is_y_available' function returns true if feature 'y' is available.
'z': available, # 'available' function just returns true
...
}
  1. To get the list of all features that can be used by e2e tests we just need to get the keys (i.e. features.keys())
  2. To build the list of available features, we just go over all the items in the dictionary and use functions to decide which features are available.

The benefit of this implementation, you don't need to update your test when new feature is added.

1. restore modified tests
2. use llvm-lit instead of grep
3. update a set of available features to match everything from
   lit.cfg.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants