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

Enable running jni test during gradle build #1553

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Infrastructure
* Manually install zlib for win CI [#1513](https://github.com/opensearch-project/k-NN/pull/1513)
* Update k-NN build artifact script to enable SIMD on ARM for Faiss [#1543](https://github.com/opensearch-project/k-NN/pull/1543)
* Enable running jni test during gradle build [#1553](https://github.com/opensearch-project/k-NN/pull/1553)
### Documentation
### Maintenance
* Bump faiss lib commit to 32f0e8cf92cd2275b60364517bb1cce67aa29a55 [#1443](https://github.com/opensearch-project/k-NN/pull/1443)
Expand Down
15 changes: 15 additions & 0 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,21 @@ run:
./bin/jni_test --gtest_filter=Faiss*
```

To run JNI Tests via gradle:
```
# To run all tests
./gradlew jniTest
# To run nmslib tests
./gradlew jniTest -Dgtest_filter=Nmslib*
# To run faiss tests
./gradlew jniTest -Dgtest_filter=Faiss*
```

The task `jniTest` is a dependency if `check` task which ensures that JNI tests are running as part of `./gradlew build` command.


### JNI Library Artifacts

We build and distribute binary library artifacts with OpenSearch. We build the library binaries in
Expand Down
17 changes: 17 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,23 @@ task cmakeJniLib(type:Exec) {
}
}

tasks.register('jniTest', Exec) {
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
dependsOn cmakeJniLib
var args = ''
if (System.getProperty("gtest_filter") != null) {
args = '--gtest_filter=' + System.getProperty("gtest_filter")
}
workingDir 'jni'
commandLine 'make' , 'jni_test'
commandLine './bin/jni_test' , "${args}"
}
}

// Ensure that jniTest task is running during the ./gradlew build
check.dependsOn jniTest


task buildJniLib(type:Exec) {
dependsOn cmakeJniLib
workingDir 'jni'
Expand Down
Loading