Skip to content

Commit ee5de56

Browse files
authored
Process runner (#29)
* Runner implementation * Rewrite test infrastructure on top of process runner * Fix z3 native library load on Windows
1 parent 7509142 commit ee5de56

File tree

63 files changed

+6390
-723
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+6390
-723
lines changed

.github/workflows/build-and-run-tests.yml

+7-9
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ jobs:
3737
build
3838
--no-daemon
3939
--continue
40-
-Pz3.runBenchmarksBasedTests=false
41-
-Pbitwuzla.runBenchmarksBasedTests=false
40+
-PrunBenchmarksBasedTests=false
4241
43-
# todo: test report uploading is temporarily disabled (https://github.com/UnitTestBot/ksmt/pull/18)
44-
# - name: Upload ksmt test reports
45-
# uses: actions/upload-artifact@v3
46-
# if: always()
47-
# with:
48-
# name: ksmt_tests_report
49-
# path: ./**/build/reports/tests/test/
42+
- name: Upload ksmt test reports
43+
uses: actions/upload-artifact@v3
44+
if: always()
45+
with:
46+
name: ksmt_tests_report
47+
path: ./**/build/reports/tests/test/

.github/workflows/run-long-tests.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ jobs:
2727
build
2828
--no-daemon
2929
--continue
30-
-Pz3.runBenchmarksBasedTests=true
31-
-Pbitwuzla.runBenchmarksBasedTests=true
30+
-PrunBenchmarksBasedTests=true
3231
3332
- name: Upload ksmt test reports
3433
uses: actions/upload-artifact@v3

detekt.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ complexity:
125125
ignoreDefaultParameters: false
126126
ignoreDataClasses: true
127127
ignoreAnnotatedParameter: []
128-
excludes: ['**/test/**', '**/example/**']
128+
excludes: ['**/test/**', '**/example/**', '**/generated/**']
129129
MethodOverloading:
130130
active: false
131131
threshold: 6
@@ -187,7 +187,7 @@ empty-blocks:
187187
active: true
188188
EmptyFunctionBlock:
189189
active: true
190-
ignoreOverridden: false
190+
ignoreOverridden: true
191191
EmptyIfBlock:
192192
active: true
193193
EmptyInitBlock:
@@ -276,6 +276,7 @@ exceptions:
276276

277277
naming:
278278
active: true
279+
excludes: [ '**/test/**', '**/example/**', '**/generated/**' ]
279280
BooleanPropertyNaming:
280281
active: false
281282
allowedPattern: '^(is|has|are)'
@@ -559,6 +560,7 @@ style:
559560
active: false
560561
MaxLineLength:
561562
active: true
563+
excludes: [ '**/test/**', '**/example/**', '**/generated/**' ]
562564
maxLineLength: 120
563565
excludePackageStatements: true
564566
excludeImportStatements: true
@@ -675,6 +677,6 @@ style:
675677
active: true
676678
WildcardImport:
677679
active: true
678-
excludes: ['**/test/**', '**/example/**']
680+
excludes: ['**/test/**', '**/example/**', '**/generated/**']
679681
excludeImports:
680682
- 'java.util.*'

ksmt-bitwuzla/build.gradle.kts

+1-30
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ val bitwuzlaNative by configurations.creating
1313

1414
dependencies {
1515
implementation(project(":ksmt-core"))
16-
implementation("net.java.dev.jna:jna:5.12.0")
16+
api("net.java.dev.jna:jna:5.12.0")
1717
implementation("net.java.dev.jna:jna-platform:5.12.0")
1818

19-
testImplementation(project(":ksmt-z3"))
20-
testImplementation(testFixtures(project(":ksmt-z3")))
21-
2219
bitwuzlaNative("bitwuzla", "bitwuzla-native-linux-x86-64", "1.0", ext = "zip")
2320
bitwuzlaNative("bitwuzla", "bitwuzla-native-win32-x86-64", "1.0", ext = "zip")
2421
}
@@ -38,32 +35,6 @@ tasks.withType<ProcessResources> {
3835
}
3936
}
4037

41-
val runBenchmarksBasedTests = project.booleanProperty("bitwuzla.runBenchmarksBasedTests") ?: false
42-
43-
// skip big benchmarks to achieve faster tests build and run time
44-
val skipBigBenchmarks = project.booleanProperty("bitwuzla.skipBigBenchmarks") ?: true
45-
46-
val smtLibBenchmarks = listOfNotNull(
47-
"QF_UF", // 100M
48-
"ABV", // 400K
49-
if (!skipBigBenchmarks) "AUFBV" else null, // 1.2G
50-
if (!skipBigBenchmarks) "BV" else null, // 847M
51-
"QF_ABV", // 253M
52-
if (!skipBigBenchmarks) "QF_BV" else null// 12.3G
53-
)
54-
55-
val smtLibBenchmarkTestData = smtLibBenchmarks.map { mkSmtLibBenchmarkTestData(it) }
56-
val prepareTestData by tasks.registering {
57-
dependsOn.addAll(smtLibBenchmarkTestData)
58-
}
59-
60-
tasks.withType<Test> {
61-
if (runBenchmarksBasedTests) {
62-
environment("bitwuzla.benchmarksBasedTests", "enabled")
63-
dependsOn.add(prepareTestData)
64-
}
65-
}
66-
6738
publishing {
6839
publications {
6940
create<MavenPublication>("maven") {

ksmt-bitwuzla/src/test/kotlin/org/ksmt/solver/bitwuzla/BenchmarksBasedTest.kt

-183
This file was deleted.

ksmt-core/build.gradle.kts

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
44
id("org.ksmt.ksmt-base")
5-
`java-test-fixtures`
65
}
76

87
dependencies {
9-
testFixturesApi("org.junit.jupiter", "junit-jupiter-params", "5.8.2")
8+
109
}
1110

1211
tasks.withType<KotlinCompile> {
@@ -16,7 +15,7 @@ tasks.withType<KotlinCompile> {
1615
publishing {
1716
publications {
1817
create<MavenPublication>("maven") {
19-
from(components["java"].also { removeTestFixtures(it) })
18+
from(components["java"])
2019
artifact(tasks["kotlinSourcesJar"])
2120
}
2221
}

ksmt-core/src/main/kotlin/org/ksmt/utils/NativeLibraryLoader.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ object NativeLibraryLoader {
3838
continue
3939
}
4040

41-
val libFile = Files.createTempFile(libName, libraryExt)
41+
// use directory to preserve dll name on Windows
42+
val libUnpackDirectory = Files.createTempDirectory("ksmt")
43+
val libFile = libUnpackDirectory.resolve(libName + libraryExt)
4244

4345
NativeLibraryLoader::class.java.classLoader
4446
.getResourceAsStream(resourceName)
@@ -47,6 +49,9 @@ object NativeLibraryLoader {
4749
}
4850

4951
System.load(libFile.toAbsolutePath().toString())
52+
53+
// tmp files are not removed on Windows
54+
libFile.toFile().delete()
5055
}
5156
}
5257
}

ksmt-core/src/testFixtures/kotlin/org/ksmt/solver/fixtures/SmtLibParser.kt

-16
This file was deleted.

ksmt-core/src/testFixtures/kotlin/org/ksmt/solver/fixtures/TestDataProvider.kt

-18
This file was deleted.

0 commit comments

Comments
 (0)