Skip to content

Commit 7c1dfed

Browse files
author
MohitMaliFtechiz
committed
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
1 parent c24ab23 commit 7c1dfed

3 files changed

Lines changed: 14 additions & 32 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: |
3737
./gradlew assemble
3838
39-
- name: Genrate Source jar
39+
- name: Generate Source jar
4040
run: |
4141
./gradlew androidSourcesJar
4242

lib/build.gradle

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,21 @@ task renameLibkiwixSoFile(type: Copy) {
281281
}
282282
}
283283

284+
task compileTestFiles(type: Exec) {
285+
workingDir "${projectDir}/src/test/"
286+
commandLine 'javac', '-g', '-d', '.', '-s', '.', '-cp', 'junit-4.13.jar:' + buildDir.path +'/libs/*', 'test.java'
287+
}
288+
289+
task runTests(type: Exec) {
290+
workingDir "${projectDir}/src/test/"
291+
dependsOn compileTestFiles
292+
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'
293+
}
294+
284295
task createCodeCoverageReport(type: Exec) {
285296
workingDir "${projectDir}/src/test/"
286-
commandLine 'sh', '-c', "bash 'run_test.sh' ${buildDir}/libs/*lib*.jar $buildDir"
297+
dependsOn runTests
298+
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'
287299
}
288300

289301
task checkCurrentJavaVersion() {
@@ -292,7 +304,6 @@ task checkCurrentJavaVersion() {
292304
}
293305
}
294306

295-
296307
task generateHeader(type: Exec) {
297308
workingDir "${projectDir}/src/main/java/org/kiwix/"
298309
commandLine 'bash', '-c', "javac -h ${buildDir}/include/javah_generated/ -d ${projectDir}/src/test/ ${getLibzimFiles()} ${getLibkiwixFiles()}"

lib/src/test/run_test.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)