Skip to content

USVM to UtBot adapters without contest hacks #2710

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

Merged
merged 123 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
fc570ea
Introduce `Tool.USVM` in `ContestEstimator`, implement `runUsvmGenera…
IlyaMuravjov Oct 27, 2023
79cf54b
Bump ksmt version to `0.5.13`
IlyaMuravjov Nov 3, 2023
d5cdd8a
Hacks similar to contest 2023 ones (#2676)
EgorkaKulikov Nov 7, 2023
092a27a
Initial implementations of the adapter from JcExecution to UtExecutio…
EgorkaKulikov Nov 9, 2023
31dd74d
Supporting arrays classId in Contests (#2680)
EgorkaKulikov Nov 10, 2023
b2cb044
Very simple UtAssembleModel improver (#2678)
EgorkaKulikov Nov 10, 2023
3400a96
Fix class name argument in the setField method (#2681)
tepa46 Nov 13, 2023
a11c3e9
Fix test generation for nested classes (#2684)
IlyaMuravjov Nov 13, 2023
2788630
Improver `UTestRunner` initialization and shutdown (#2683)
IlyaMuravjov Nov 13, 2023
62aa5b0
Add summarization for usvm-sbft (#2682)
tepa46 Nov 13, 2023
0a9003d
Use usvm samples instead of UtBot ones (#2685)
EgorkaKulikov Nov 13, 2023
b40f0f3
Fix fieldId creation for UtCompositeModel (#2686)
tepa46 Nov 13, 2023
629983c
A tempopary hack for void TypeName processing
EgorkaKulikov Nov 13, 2023
1d974f7
A proper solution for void TypeName processing
EgorkaKulikov Nov 14, 2023
2b6ff89
Add all arrays as test classes for converters
EgorkaKulikov Nov 14, 2023
5b0e8dd
Add samples from types
EgorkaKulikov Nov 15, 2023
f38dae0
Add samples from ternary
EgorkaKulikov Nov 15, 2023
3080413
Add processing of usvmExistingButNullString (#2689)
tepa46 Nov 15, 2023
26d9901
Fix classloader problem and correct class lists (exclude missing clas…
EgorkaKulikov Nov 15, 2023
8904585
Include usvm via GitHub packages (#2687)
IlyaMuravjov Nov 15, 2023
9869eb0
Upgrade usvm version
EgorkaKulikov Nov 15, 2023
1362ac7
Add invokes into samples
EgorkaKulikov Nov 15, 2023
c365a7a
Add several new classes to samples - Yuri said that it is enough
EgorkaKulikov Nov 16, 2023
7429dc9
Fix enum converter and add sample from enums
tepa46 Nov 16, 2023
9bb144a
Remove non-relevant TODO
EgorkaKulikov Nov 16, 2023
6e6c378
Improve `UTestValueDescriptor` to `UtModel` conversion and state chan…
IlyaMuravjov Nov 18, 2023
5084e02
Update usvm version
EgorkaKulikov Nov 18, 2023
ae1cdcf
Fix `constructConstArrayModelMapper` for empty arrays
IlyaMuravjov Nov 18, 2023
b74f3c8
Remove non-relevant TODO
EgorkaKulikov Nov 20, 2023
5429647
Use jacodb with `classpathWithApproximations`
IlyaMuravjov Nov 20, 2023
96993d9
Reduce concrete execution timeout to 1 second
IlyaMuravjov Nov 20, 2023
e8a30d7
Remove redundant TODO
IlyaMuravjov Nov 20, 2023
ab0a529
Replace generics with bounds when converting to ut models
IlyaMuravjov Nov 20, 2023
75cd001
Correct JacoDb classpath
EgorkaKulikov Nov 20, 2023
eaf85e9
Correct JacoDb classpath
EgorkaKulikov Nov 20, 2023
273335e
Update jacodb (#2694)
Damtev Nov 20, 2023
22e577b
Update approximations version
EgorkaKulikov Nov 21, 2023
9bbb24c
Update usvm version
EgorkaKulikov Nov 21, 2023
623a94f
Make JcMachine's budget distributing strategy and refactor (#2695)
IlyaMuravjov Nov 21, 2023
65dd727
SBFT'24 An attempt to support UTestGlobalMock in converters (#2690)
EgorkaKulikov Nov 22, 2023
26751a5
Introduce and use `JcMachine.analyzeAsync` in `ContestUsvm` (#2696)
IlyaMuravjov Nov 22, 2023
7ed6b08
Make USVM descriptor to UtModel cache consider state kind (initial or…
IlyaMuravjov Nov 22, 2023
5d3ad21
Update gradle script to run tests properly
EgorkaKulikov Nov 23, 2023
208aad4
Update usvm version
EgorkaKulikov Nov 23, 2023
e0f7080
Remove strange hack to discuss later
EgorkaKulikov Nov 23, 2023
272ebbe
Add support for correct generation of inner tests
tepa46 Nov 23, 2023
0a3db6a
Update usvm version
EgorkaKulikov Nov 23, 2023
0eaf9ac
Avoid set fields not present in `UTest` (for `UtCompositeModel`) (#2698)
IlyaMuravjov Nov 24, 2023
ac667bb
Use classpathWithApproximations
EgorkaKulikov Nov 24, 2023
405444f
Fix bug in `assertEquals` for `String` in codegen
IlyaMuravjov Nov 24, 2023
4362bd2
Add timeout execution conversion
IlyaMuravjov Nov 24, 2023
a365f4e
Improve logging time spent on concrete and conversion
IlyaMuravjov Nov 24, 2023
d7134b7
Make logger group repeated exceptions (e.g. "(x100) message")
IlyaMuravjov Nov 24, 2023
f523512
Better log `JcType.classId` fails
IlyaMuravjov Nov 24, 2023
5c82e57
Add notice about `usvmVersion` being outdated
IlyaMuravjov Nov 24, 2023
d25e3bb
Actualise `JcTestExecutor`
IlyaMuravjov Nov 24, 2023
a751085
Update usvm version
EgorkaKulikov Nov 25, 2023
dd5176f
Fix invalid `UTestCyclicReferenceDescriptor`
IlyaMuravjov Nov 27, 2023
1cc84fd
Automatically remove uncompilable test methods (#2699)
IlyaMuravjov Nov 27, 2023
7f1c3a8
Update path selector strategy
EgorkaKulikov Nov 27, 2023
7b58a17
Add a copy of https://github.com/UnitTestBot/UTBotJava/pull/2627 into…
EgorkaKulikov Nov 28, 2023
9eadf92
Update approximations version
EgorkaKulikov Nov 28, 2023
9f4af0b
Use symbolic result instead of concrete if it is better (#2700)
EgorkaKulikov Nov 28, 2023
62f25ad
Avoid class initialization when we evaluate ClassId
EgorkaKulikov Nov 28, 2023
2d09b02
Revert "Avoid class initialization when we evaluate ClassId"
EgorkaKulikov Nov 28, 2023
bae5664
Avoid class initialization when we evaluate ClassId
EgorkaKulikov Nov 28, 2023
dff5430
Create mocks in output values (#2701)
IlyaMuravjov Nov 28, 2023
e1c9d2a
Update versions
EgorkaKulikov Nov 28, 2023
329eb6f
Update usvm version
EgorkaKulikov Nov 28, 2023
6702aec
Workaround to deal with `UTestMethodCall` where `instance` is a mock
IlyaMuravjov Nov 29, 2023
3844378
Solver type changed
EgorkaKulikov Nov 29, 2023
1f24d07
Handle `UTestSetFieldStatement` where `instance` is a mock
IlyaMuravjov Nov 29, 2023
4fa518e
Hack for Random mocks (#2702)
Damtev Nov 29, 2023
bef3893
Add cast when `mock()` is called on anonymous class (e.g. `(CaseForma…
IlyaMuravjov Nov 29, 2023
ae79171
Improve logging for `JcField.fieldId` failures
IlyaMuravjov Nov 29, 2023
9bb4e1a
Update approximations version
EgorkaKulikov Nov 29, 2023
f2c47e0
jc-test-resolver: better handling of strings and classes, class const…
IlyaMuravjov Nov 29, 2023
29cd67a
Update lists as in benchmark
EgorkaKulikov Nov 29, 2023
e63ba23
Fallback to symbolic result when `runner.executeAsync()` throws excep…
IlyaMuravjov Nov 29, 2023
8c206e6
Fix the list
EgorkaKulikov Nov 29, 2023
4142156
Fallback to symbolic result when `jcToUtExecutionConverter.convert` t…
IlyaMuravjov Nov 29, 2023
b492606
Fix codegen for `String(char[])` calls (use string literals when poss…
IlyaMuravjov Nov 29, 2023
c2d693b
Ignore static fields in `UTestObjectDescriptor`
IlyaMuravjov Nov 29, 2023
64b1e18
Usvm competitions 2024: jacodb persistence (#2703)
Saloed Nov 30, 2023
5b46171
Usvm distribution for the contest (#2704)
Saloed Nov 30, 2023
c7ff5cd
Add types sorting
sergeypospelov Nov 30, 2023
08234e2
Drop crashed executions (#2705)
Damtev Nov 30, 2023
c8665bc
Fix classpath (#2706)
Saloed Nov 30, 2023
2086f5b
Avoid `<clinit>` call in `JcField.fieldId`
IlyaMuravjov Dec 1, 2023
2933a0c
Add timeout for all test with exceptions
IlyaMuravjov Dec 1, 2023
69c273f
Removed Soot initialization (#2707)
Damtev Dec 1, 2023
84d9325
Update usvm version
EgorkaKulikov Dec 1, 2023
693c54f
Remove irrelevant require
EgorkaKulikov Dec 1, 2023
acc2473
Initialize JacoDB and stat executor before starting contest, stop cac…
IlyaMuravjov Dec 1, 2023
5503f43
Updated usvm version
Damtev Dec 1, 2023
2a8f639
Add `maxUnknownCoverageExecutionsPerMethodPerResultType` to `settings…
IlyaMuravjov Dec 6, 2023
648fccc
Update Z3 native files paths to work with ksmt 0.5.13
IlyaMuravjov Dec 6, 2023
488e80e
Update RD in all projects
IlyaMuravjov Dec 6, 2023
f4458bb
Update Run IDEA task to use :utbot-intellij-main
IlyaMuravjov Dec 6, 2023
f76c6fe
Complete most `usvm-sbft-merge` TODOs
IlyaMuravjov Dec 6, 2023
515ce1b
Uncomment `include`s for `intellij` projects in `settings.gradle.kts`
IlyaMuravjov Dec 6, 2023
87e8384
Add `addTestMethodMarkers` ut setting
IlyaMuravjov Dec 6, 2023
d18ff85
Revert contest hacks
IlyaMuravjov Dec 6, 2023
aa86d55
Make contest use `Tool.UtBot` by default
IlyaMuravjov Dec 6, 2023
79d5daa
Update tool settings for summary
tepa46 Dec 7, 2023
d14032a
Update gradle properties in yml scripts
EgorkaKulikov Dec 7, 2023
6bdd3c9
Temporary creds
EgorkaKulikov Dec 7, 2023
9689766
Revert temporary creds
EgorkaKulikov Dec 7, 2023
6226fbb
Some todos in TestFrameworkManager
EgorkaKulikov Dec 7, 2023
17dc5d9
bissquit: configure debug env
Dec 7, 2023
806127d
Merge branch 'usvm' of https://github.com/UnitTestBot/UTBotJava into …
Dec 7, 2023
2b88b44
add pers token
Dec 7, 2023
e7b912a
add secret
Dec 7, 2023
e97e076
add token to all gradle runs
Dec 7, 2023
844554d
replace ro_token by github_token
Dec 7, 2023
9f70211
add permissions
Dec 7, 2023
3c45e8c
change to write permissions
Dec 7, 2023
6f9a8b2
return PACKAGES_RO_TOKEN var
Dec 7, 2023
fce45b3
remove debug
Dec 7, 2023
5f9403b
Further update of yml scripts
EgorkaKulikov Dec 7, 2023
e5d3549
Merge branch 'usvm' of https://github.com/UnitTestBot/UTBotJava into …
EgorkaKulikov Dec 7, 2023
fe8a753
Correct usvm version to fix compilation
EgorkaKulikov Dec 8, 2023
e896a30
Disable four tests
EgorkaKulikov Dec 8, 2023
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
10 changes: 5 additions & 5 deletions .github/workflows/build-and-run-tests-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:

- name: Run tests
run: |
gradle -PprojectType=Ultimate --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }}
gradle --no-daemon --build-cache --no-parallel -PprojectType=Ultimate -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }}

- name: Upload logs
if: ${{ always() }}
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
- name: Run tests
run: |
cd utbot-spring-test
gradle -PprojectType=Community --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g :utbot-spring-test:test
gradle --no-daemon --build-cache --no-parallel -PprojectType=Community -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g :utbot-spring-test:test

- name: Upload logs
if: ${{ always() }}
Expand Down Expand Up @@ -279,13 +279,13 @@ jobs:
id: first-project
run: |
cd ${{ matrix.projects.first }}
gradle build --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g
gradle build --no-daemon --build-cache --no-parallel -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g

- name: Build project ${{ matrix.projects.second }}
if: ${{ steps.first-project.outcome != 'cancelled' && steps.first-project.outcome != 'skipped' }}
run: |
cd ${{ matrix.projects.second }}
gradle build --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g
gradle build --no-daemon --build-cache --no-parallel -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g

- name: Upload test report if tests have failed
if: ${{ failure() }}
Expand Down Expand Up @@ -354,7 +354,7 @@ jobs:
- name: Run tests
run: |
cd ${{ matrix.project }}
gradle build --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g
gradle build --no-daemon --build-cache --no-parallel -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g

- name: Upload test report if tests have failed
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/public-rider-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:

- name: Build UTBot Rider plugin
run: |
gradle clean :utbot-rider:buildPlugin --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }} -PincludeRiderInBuild=true
gradle clean :utbot-rider:buildPlugin --no-daemon --build-cache --no-parallel -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }} -PincludeRiderInBuild=true
cd utbot-rider/build/distributions
unzip utbot-rider-${{ env.VERSION }}.zip
rm utbot-rider-${{ env.VERSION }}.zip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-cli-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Build UTBot CLI
run: |
cd "${{ matrix.configuration.dir }}"
gradle clean build --no-daemon --build-cache --no-parallel ${{ matrix.configuration.extra_options }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }}
gradle clean build --no-daemon --build-cache --no-parallel ${{ matrix.configuration.extra_options }} -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }}

- name: Archive UTBot CLI
if: ${{ inputs.upload-artifact == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-cli-image-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Build UTBot CLI
run: |
cd ${{ matrix.configuration.directory }}
gradle build --no-daemon --build-cache --no-parallel ${{ matrix.configuration.extra_options }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -x test -PsemVer=${{ env.VERSION }}
gradle build --no-daemon --build-cache --no-parallel ${{ matrix.configuration.extra_options }} -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -x test -PsemVer=${{ env.VERSION }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-plugin-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

- name: Build UTBot IntelliJ IDEA plugin
run: |
gradle clean buildPlugin --no-daemon --build-cache --no-parallel ${{ matrix.configuration.extra_options }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }}
gradle clean buildPlugin --no-daemon --build-cache --no-parallel -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} ${{ matrix.configuration.extra_options }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }}
cd utbot-intellij-main/build/distributions
unzip utbot-intellij-main-${{ env.VERSION }}.zip
rm utbot-intellij-main-${{ env.VERSION }}.zip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-chosen-tests-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

- name: Run chosen tests
run: |
gradle :${{ github.event.inputs.project-name }}:test -PprojectType=Ultimate --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g --tests ${{ github.event.inputs.tests-bunch-name }}
gradle :${{ github.event.inputs.project-name }}:test -PprojectType=Ultimate --no-daemon --build-cache --no-parallel -PgithubActor=${{ github.actor }} -PgithubToken=${{ secrets.PACKAGES_RO_TOKEN }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g --tests ${{ github.event.inputs.tests-bunch-name }}

- name: Upload ${{ github.event.inputs.project-name }} tests report if tests have failed
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .run/Run IDEA.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="Run IDEA" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/utbot-intellij" />
<option name="externalProjectPath" value="$PROJECT_DIR$/utbot-intellij-main" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
Expand Down
21 changes: 16 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,23 @@ junit4PlatformVersion=1.9.0
# NOTE: Mockito versions 5+ are not compatible with Java 8: https://www.davidvlijmincx.com/posts/upgrade-to-mockito-5
mockitoVersion=4.11.0
mockitoInlineVersion=4.11.0
ksmtVersion=0.4.3
ksmtVersion=0.5.13
sootVersion=4.4.0-FORK-2
kotlinVersion=1.8.0
log4j2Version=2.13.3
coroutinesVersion=1.6.3
collectionsVersion=0.3.4
coroutinesVersion=1.6.4
collectionsVersion=0.3.5
# after updating plugin version you should manually bump corresponding versions in plugin
# as they cannot be set from properties
# utbot-intellij/build.gradle.kts
# utbot-rd/build.gradle
# utbot-rider/build.gradle.kts
intellijPluginVersion=1.13.1
# every time you bump rd version:
# TODO every time you bump rd version:
# 1. regenerate all models
# 2. check if rider plugin works
rdVersion=2023.1.2
# 3. search for previous RD version (as string) in entire project and update it manually in places where it has to be hardcoded
rdVersion=2023.2.0
# to enable - add -PincludeRiderInBuild=true in build CLI
includeRiderInBuild=false
jacocoVersion=0.8.8
Expand Down Expand Up @@ -96,12 +97,22 @@ commonsLoggingVersion=1.2
commonsIOVersion=2.11.0
javaxVersion=2.2
jakartaVersion=3.1.0
jacoDbVersion=1.4.3
# TODO could be left outdated here to avoid exceeding GitHub packages drive space,
# TODO run `gradle publishToMavenLocal -Pversion={usvmVersion}` locally in usvm project and update {usvmVersion} locally
usvmVersion=comp-231201-17

# use latest Java 8 compaitable Spring and Spring Boot versions
springVersion=5.3.28
springBootVersion=2.7.13
springSecurityVersion=5.8.5

# Put your GitHub username here to use utbot-junit-contest with usvm
githubActor=<actor>
# Use your GitHub token generated here -- https://github.com/settings/tokens/new?description=USVM&scopes=read:packages
# Keep `read:packages` checkbox selected
githubToken=<token>

# configuration for build server
#
# the following options are passed to gradle command explicitly (see appropriate workflow):
Expand Down
38 changes: 24 additions & 14 deletions utbot-analytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,27 @@ processResources {
}
}

jar {
dependsOn classes
manifest {
attributes 'Main-Class': 'org.utbot.QualityAnalysisKt'
}

dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
zip64 = true
}
// TODO if you need utbot-analytics fat jar, use shadow jar to create a SEPARATE task for a fat jar.
// Do not use main jar for a fat jar, because it breaks Gradle conflict resolution, here's how:
// 1. utbot-analytics depends on library A version 1.0 (and adds it to own main jar)
// 2. utbot-junit-contest depends on utbot-analytics and library A version 1.1
// 3. Both library A version 1.0 and version 1.1 end up on the classpath and it's a matter of chance which one is earlier
// If utbot-analytics were to only declare its dependency on library A version 1.0 and not force it by adding it to a
// main jar, then Gradle would be able to recognize the conflict of library A version 1.0 and version 1.1 and resolve
// it according to a conflict resolution strategy, which by default picks the latest version, which works in most cases.
// But if you put library A version 1.0 into some fat jar, Gradle will no longer be able to exclude it from the fat jar
// in favor of a newer version when it needs to resolve dependency conflicts.
//jar {
// dependsOn classes
// manifest {
// attributes 'Main-Class': 'org.utbot.QualityAnalysisKt'
// }
//
// dependsOn configurations.runtimeClasspath
// from {
// configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
// }
//
// duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// zip64 = true
//}
11 changes: 8 additions & 3 deletions utbot-core/src/main/kotlin/org/utbot/common/ThreadUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ class ThreadBasedExecutor {
*
* [stopWatch] is used to respect specific situations (such as class loading and transforming) while invoking.
*/
fun invokeWithTimeout(timeoutMillis: Long, stopWatch: StopWatch? = null, action:() -> Any?) : Result<Any?>? {
fun invokeWithTimeout(
timeoutMillis: Long,
stopWatch: StopWatch? = null,
threadDeathThrowPeriodMillis: Long = 10_000,
action:() -> Any?
) : Result<Any?>? {
ensureThreadIsAlive()

requestQueue.offer {
Expand Down Expand Up @@ -95,10 +100,10 @@ class ThreadBasedExecutor {
t.stop()
}
// If somebody catches `ThreadDeath`, for now we
// just wait for at most 10s and throw another one.
// just wait for [threadDeathThrowPeriod] and throw another one.
//
// A better approach may be to kill instrumented process.
t.join(10_000)
t.join(threadDeathThrowPeriodMillis)
}
} catch (_: Throwable) {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ object UtSettings : AbstractSettings(logger, defaultKeyForSettingsPath, defaultS
*/
var minimizeCrashExecutions by getBooleanProperty(true)

/**
* Determines maximum number of executions with unknown coverage per method per result type.
* In [ContestUsvm] it is useful if concrete fails, so we use symbolic execution result without trace.
*/
var maxUnknownCoverageExecutionsPerMethodPerResultType by getIntProperty(10)

/**
* Enable it to calculate unsat cores for hard constraints as well.
* It may be usefull during debug.
Expand Down Expand Up @@ -612,6 +618,16 @@ object UtSettings : AbstractSettings(logger, defaultKeyForSettingsPath, defaultS
var maxSpringContextResetsPerMethod by getIntProperty(25, 0, Int.MAX_VALUE)

// endregion

// region codegen options

/**
* Add "test method start marker" and "test method end marker" around each test, can be used to
* detect uncompilable tests and remove them.
*/
var addTestMethodMarkers by getBooleanProperty(false)

// endregion
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ abstract class UtExecution(
val executableToCall get() = stateBefore.executableToCall
}

interface UtExecutionWithInstrumentation {
val instrumentation: List<UtInstrumentation>
}

/**
* Symbolic execution.
*
Expand All @@ -163,15 +167,15 @@ class UtSymbolicExecution(
stateBefore: EnvironmentModels,
stateAfter: EnvironmentModels,
result: UtExecutionResult,
val instrumentation: List<UtInstrumentation>,
override val instrumentation: List<UtInstrumentation>,
val path: MutableList<Step>,
val fullPath: List<Step>,
coverage: Coverage? = null,
summary: List<DocStatement>? = null,
testMethodName: String? = null,
displayName: String? = null,
/** Convenient view of the full symbolic path */ val symbolicSteps: List<SymbolicStep> = listOf(),
) : UtExecution(stateBefore, stateAfter, result, coverage, summary, testMethodName, displayName) {
) : UtExecution(stateBefore, stateAfter, result, coverage, summary, testMethodName, displayName), UtExecutionWithInstrumentation {
/**
* By design the 'before' and 'after' states contain info about the same fields.
* It means that it is not possible for a field to be present at 'before' and to be absent at 'after'.
Expand Down Expand Up @@ -1025,7 +1029,7 @@ open class ClassId @JvmOverloads constructor(
// so we create a specific name for them
isAnonymous -> "Anonymous${supertypeOfAnonymousClass.prettifiedName}"
// in other cases where canonical name is still null, we use ClassId.name instead
else -> jClass.canonicalName ?: name // Explicit jClass reference to get null instead of exception
else -> runCatching { canonicalName }.getOrElse { name }
}
return baseName
.substringAfterLast(".")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.utbot.framework.plugin.api.UtNullModel
import org.utbot.framework.plugin.api.UtPrimitiveModel
import org.utbot.framework.plugin.api.UtReferenceModel
import org.utbot.framework.plugin.api.UtVoidModel
import java.util.IdentityHashMap

/**
* Performs deep mapping of [UtModel]s.
Expand All @@ -30,7 +31,7 @@ class UtModelDeepMapper private constructor(
* Values are models that have been deeply mapped by this [UtModelDeepMapper].
* Models are only associated with models of the same type (i.e. the cache type is actually `MutableMap<T, T>`)
*/
private val cache = mutableMapOf<UtModel, UtModel>()
private val cache = IdentityHashMap<UtModel, UtModel>()

private val allInputtedModels get() = cache.keys
private val allOutputtedModels get() = cache.values
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.utbot.framework.plugin.api.mapper

import org.utbot.framework.plugin.api.UtModel
import java.util.IdentityHashMap

class UtModelSafeCastingCachingShallowMapper(
val mapper: (UtModel) -> UtModel
) : UtModelMapper {
private val cache = mutableMapOf<UtModel, UtModel>()
private val cache = IdentityHashMap<UtModel, UtModel>()

override fun <T : UtModel> map(model: T, clazz: Class<T>): T {
val mapped = cache.getOrPut(model) { mapper(model) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import org.utbot.framework.plugin.api.UtDirectGetFieldModel
import org.utbot.framework.plugin.api.UtDirectSetFieldModel
import org.utbot.framework.plugin.api.UtExecutableCallModel
import org.utbot.framework.plugin.api.UtExecution
import org.utbot.framework.plugin.api.UtExecutionResult
import org.utbot.framework.plugin.api.UtExecutionSuccess
import org.utbot.framework.plugin.api.UtInstrumentation
import org.utbot.framework.plugin.api.UtModel
import org.utbot.framework.plugin.api.UtNewInstanceInstrumentation
import org.utbot.framework.plugin.api.UtReferenceModel
import org.utbot.framework.plugin.api.UtStatementCallModel
import org.utbot.framework.plugin.api.UtStatementModel
import org.utbot.framework.plugin.api.UtStaticMethodInstrumentation
import org.utbot.framework.plugin.api.isSuccess

inline fun <reified T : UtModel> T.mapPreservingType(mapper: UtModelMapper): T =
mapper.map(this, T::class.java)
Expand Down Expand Up @@ -54,6 +57,14 @@ fun EnvironmentModels.mapModels(mapper: UtModelMapper) = EnvironmentModels(
executableToCall = executableToCall,
)

fun UtExecutionResult.mapModelIfExists(mapper: UtModelMapper) = if (this.isSuccess) {
val successResult = this as UtExecutionSuccess
UtExecutionSuccess(successResult.model.map(mapper))
} else {
this
}


fun UtInstrumentation.mapModels(mapper: UtModelMapper) = when (this) {
is UtNewInstanceInstrumentation -> copy(instances = instances.mapModels(mapper))
is UtStaticMethodInstrumentation -> copy(values = values.mapModels(mapper))
Expand Down
5 changes: 3 additions & 2 deletions utbot-framework-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ dependencies {
testImplementation group: 'org.mockito', name: 'mockito-inline', version: mockitoInlineVersion
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4j2Version

implementation group: 'com.github.UnitTestBot.ksmt', name: 'ksmt-core', version: ksmtVersion
implementation group: 'com.github.UnitTestBot.ksmt', name: 'ksmt-z3', version: ksmtVersion
// TODO sbft-usvm-merge: UtBot engine expects `com.github.UnitTestBot.ksmt` here
implementation group: 'io.ksmt', name: 'ksmt-core', version: ksmtVersion
implementation group: 'io.ksmt', name: 'ksmt-z3', version: ksmtVersion
}

// This is required to avoid conflict between SpringBoot standard logger and the logger of our project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ internal class ArrayOfArraysTest : UtValueTestCaseChecker(testClass = ArrayOfArr
}

@Test
@Disabled("Seems not aligning with ksmt version used in USVM")
fun testReallyMultiDimensionalArray() {
check(
ArrayOfArrays::reallyMultiDimensionalArray,
Expand All @@ -205,6 +206,7 @@ internal class ArrayOfArraysTest : UtValueTestCaseChecker(testClass = ArrayOfArr
}

@Test
@Disabled("Seems not aligning with ksmt version used in USVM")
fun testReallyMultiDimensionalArrayMutation() {
checkParamsMutations(
ArrayOfArrays::reallyMultiDimensionalArray,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class MapEntrySetTest : UtValueTestCaseChecker(


@Test
@Disabled("Seems not aligning with ksmt version used in USVM")
fun testIterateWithIterator() {
withPushingStateFromPathSelectorForConcrete {
checkWithException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class ClassWithEnumTest : UtValueTestCaseChecker(testClass = ClassWithEnum::clas
}

@Test
@Disabled("Seems not aligning with ksmt version used in USVM")
fun testNullParameter() {
check(
ClassWithEnum::nullEnumAsParameter,
Expand Down
Loading