Skip to content

Update test build instructions in kernels readme #10007

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

Merged
merged 1 commit into from
Apr 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions kernels/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Check out how it uses helper macros like `ET_CHECK_SAME_SHAPE_AND_DTYPE` and

Once you have your operator and corresponding tests in place, we can try it out.

1. Build ExecuTorch.
1. Build ExecuTorch with `-DEXECUTORCH_BUILD_TESTS=ON`:
```
cmake . \
-DCMAKE_INSTALL_PREFIX=cmake-out \
Expand All @@ -355,35 +355,17 @@ cmake . \
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
-DEXECUTORCH_BUILD_VULKAN=OFF \
-DEXECUTORCH_BUILD_XNNPACK=ON \
-DEXECUTORCH_BUILD_TESTS=ON \
-Bcmake-out

cmake --build cmake-out -j9 --target install
```
2. Build gtest.
```
mkdir -p third-party/googletest/build
cd third-party/googletest/build
cmake .. -DCMAKE_INSTALL_PREFIX=.
make -j4
make install
cd ../../../
```

3. Build kernel tests.
```
cmake kernels/test \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=cmake-out \
-DEXECUTORCH_USE_CPP_CODE_COVERAGE=ON \
-DCMAKE_PREFIX_PATH="$(pwd)/third-party/googletest/build" \
-Bcmake-out/kernels/test
cmake --build cmake-out/kernels/test -j9
```
4. Run tests. You should see your test here.
2. Run tests. You should see your test here.
```
./cmake-out/kernels/test/portable_kernels_test
./cmake-out/kernels/test/optimized_kernels_test
Expand Down
Loading