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

Test parts of API with libFuzzer. #731

Closed
wants to merge 27 commits into from

Conversation

PatKamin
Copy link
Contributor

Add a fuzz test generating API calls. Related to #566 .

@PatKamin PatKamin force-pushed the fuzz-test-generate-api-calls branch from 8f53448 to e1e279c Compare July 19, 2023 10:23
Copy link
Contributor

@pbalcer pbalcer left a comment

Choose a reason for hiding this comment

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

This is a better approach, but we should expand the input grammar to cover more cases for these APIs.

uint32_t num_platforms = 0;
uint32_t num_devices = 0;

std::random_device rand_device;
Copy link
Contributor

Choose a reason for hiding this comment

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

tests should be fully deterministic, and the only source of randomness should be the fuzzer itself.

break;
case UR_DEVICE_GET:
if (!platforms.empty()) {
std::uniform_int_distribution<unsigned> distrib(
Copy link
Contributor

Choose a reason for hiding this comment

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

the adapter identifier should come from the data.

test/conformance/fuzz/urConformanceFuzz.cpp Outdated Show resolved Hide resolved
[adapters] only export get proc table symbols in adapters
@PatKamin PatKamin force-pushed the fuzz-test-generate-api-calls branch from e1e279c to cf09145 Compare July 21, 2023 10:26
Copy link
Contributor

@pbalcer pbalcer left a comment

Choose a reason for hiding this comment

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

This is a good start, but right now the only thing that is being fuzzed is the sequence of operations. We need to allow the fuzzer to also parametrize these operations.

uint32_t num_adapters;
uint32_t num_platforms;
uint32_t num_devices;
} TestState;
Copy link
Contributor

Choose a reason for hiding this comment

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

you never use this global.

@PatKamin PatKamin force-pushed the fuzz-test-generate-api-calls branch 3 times, most recently from c6b81f2 to 59aa08a Compare July 27, 2023 13:02
Use an absolute path instead of just the filename for the
`ur_adapter_<name>.map` files to resolve `/usr/bin/ld: cannot open
linker script file` errors.
…rs-map

[ur] Fix adapters linker script path on Linux
"XPTI_SUBSCRIBERS=$<TARGET_FILE:collector>"
"UR_ADAPTERS_FORCE_LOAD=\"$<TARGET_FILE:ur_adapter_null>\""
"UR_ENABLE_LAYERS=UR_LAYER_TRACING")
target_compile_options(${TEST_TARGET_NAME} PRIVATE -g -fsanitize=fuzzer)
Copy link
Contributor

Choose a reason for hiding this comment

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

You use -fsanitize=fuzzer here and in target_link_libraries, is that intentional?

@PatKamin PatKamin force-pushed the fuzz-test-generate-api-calls branch from 59aa08a to 0fb9123 Compare July 31, 2023 14:10
@PatKamin PatKamin force-pushed the fuzz-test-generate-api-calls branch 3 times, most recently from 2afa8f8 to f960b6d Compare August 10, 2023 13:40
Co-authored-by: omar.ahmed@codeplay.com
@PatKamin
Copy link
Contributor Author

Replaced by #795 targeting adapters branch.

@PatKamin PatKamin closed this Aug 10, 2023
@PatKamin PatKamin deleted the fuzz-test-generate-api-calls branch June 26, 2024 10:08
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.

6 participants