Skip to content

Commit

Permalink
Enable running jni test during gradle build
Browse files Browse the repository at this point in the history
Signed-off-by: Navneet Verma <[email protected]>
  • Loading branch information
navneet1v committed Mar 17, 2024
1 parent 4734d88 commit 0fe0fcc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
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 []()
### 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

0 comments on commit 0fe0fcc

Please sign in to comment.