mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-08-04 03:26:08 -04:00
run_test.sh script now mostly run java compilation and run java program for testing. In this commit we are compiling, running java test cases for gradle task, So we are removing the run_test.sh as it is unused now
This commit is contained in:
parent
bc93a5deed
commit
5ec2f412fe
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
||||
run: |
|
||||
./gradlew assemble
|
||||
|
||||
- name: Genrate Source jar
|
||||
- name: Generate Source jar
|
||||
run: |
|
||||
./gradlew androidSourcesJar
|
||||
|
||||
|
@ -279,9 +279,21 @@ task renameLibkiwixSoFile(type: Copy) {
|
||||
}
|
||||
}
|
||||
|
||||
task compileTestFile(type: Exec) {
|
||||
workingDir "${projectDir}/src/test/"
|
||||
commandLine 'javac', '-g', '-d', '.', '-s', '.', '-cp', 'junit-4.13.jar:' + buildDir.path +'/libs/*', 'test.java'
|
||||
}
|
||||
|
||||
task runTests(type: Exec) {
|
||||
workingDir "${projectDir}/src/test/"
|
||||
dependsOn compileTestFile
|
||||
commandLine 'java', '-Djava.library.path=' + buildDir.path, '-javaagent:jacoco-0.8.7/lib/jacocoagent.jar', '-cp', 'junit-4.13.jar:hamcrest-core-1.3.jar:' + buildDir.path +'/libs/*lib*.jar' + ':.', 'org.junit.runner.JUnitCore', 'test'
|
||||
}
|
||||
|
||||
task createCodeCoverageReport(type: Exec) {
|
||||
workingDir "${projectDir}/src/test/"
|
||||
commandLine 'sh', '-c', "bash 'run_test.sh' ${buildDir}/libs/*lib*.jar $buildDir"
|
||||
dependsOn runTests
|
||||
commandLine 'java', '-jar', 'jacoco-0.8.7/lib/jacococli.jar', 'report', 'jacoco.exec', '--classfiles', 'org/kiwix/libkiwix/', '--classfiles', 'org/kiwix/libzim/', '--html', '../../build/coverage-report', '--xml', 'coverage.xml'
|
||||
}
|
||||
|
||||
task checkCurrentJavaVersion() {
|
||||
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# This script runs the unit test to test the java wrapper.
|
||||
# This is not integrated in meson because ... this is not so easy.
|
||||
|
||||
die()
|
||||
{
|
||||
echo >&2 "!!! ERROR: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
KIWIX_LIB_JAR=$(readlink -f "$1")
|
||||
KIWIX_LIB_DIR=$(readlink -f "$2")
|
||||
TEST_SOURCE_DIR=$(dirname "$(readlink -f $0)")
|
||||
|
||||
cd "$TEST_SOURCE_DIR"
|
||||
|
||||
javac -g -d . -s . -cp "junit-4.13.jar:$KIWIX_LIB_JAR" test.java \
|
||||
|| die "Compilation failed"
|
||||
|
||||
java -Djava.library.path="$KIWIX_LIB_DIR" \
|
||||
-javaagent:jacoco-0.8.7/lib/jacocoagent.jar -cp "junit-4.13.jar:hamcrest-core-1.3.jar:$KIWIX_LIB_JAR:." \
|
||||
org.junit.runner.JUnitCore test \
|
||||
|| die "Unit test failed"
|
||||
|
||||
java -jar jacoco-0.8.7/lib/jacococli.jar report jacoco.exec \
|
||||
--classfiles org/kiwix/libkiwix/ \
|
||||
--classfiles org/kiwix/libzim/ \
|
||||
--html ../../build/coverage-report --xml coverage.xml
|
Loading…
x
Reference in New Issue
Block a user