-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...test/org/jetbrains/kotlinx/lincheck_test/representation/KotlinRandomRepresentationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.jetbrains.kotlinx.lincheck_test.representation | ||
|
||
import kotlin.random.* | ||
|
||
class KotlinRandomRepresentationTest : BaseFailingTest("kotlin_random_representation.txt") { | ||
private var a = 0 | ||
|
||
override fun actionsForTrace() { | ||
a = Random.nextInt() | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/jvm/test/resources/expected_logs/kotlin_random_representation.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
= Invalid execution results = | ||
| ------------------------------- | | ||
| Thread 1 | Thread 2 | | ||
| ------------------------------- | | ||
| increment(): 0 | increment(): 0 | | ||
| ------------------------------- | | ||
|
||
The following interleaving leads to the error: | ||
| ---------------------------------------------------------------------------------------- | | ||
| Thread 1 | Thread 2 | | ||
| ---------------------------------------------------------------------------------------- | | ||
| | increment(): 0 | | ||
| | counter.READ: 0 at BaseFailingTest.increment(BaseFailingTest.kt:30) | | ||
| | switch | | ||
| increment(): 0 | | | ||
| | counter.WRITE(1) at BaseFailingTest.increment(BaseFailingTest.kt:30) | | ||
| | actionsForTrace() at BaseFailingTest.increment(BaseFailingTest.kt:31) | | ||
| | result: 0 | | ||
| ---------------------------------------------------------------------------------------- | | ||
|
||
Detailed trace: | ||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| Thread 1 | Thread 2 | | ||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | increment(): 0 | | ||
| | counter.READ: 0 at BaseFailingTest.increment(BaseFailingTest.kt:30) | | ||
| | switch | | ||
| increment(): 0 | | | ||
| counter.READ: 0 at BaseFailingTest.increment(BaseFailingTest.kt:30) | | | ||
| counter.WRITE(1) at BaseFailingTest.increment(BaseFailingTest.kt:30) | | | ||
| actionsForTrace() at BaseFailingTest.increment(BaseFailingTest.kt:31) | | | ||
| a.WRITE(-1147404850) at KotlinRandomRepresentationTest.actionsForTrace(KotlinRandomRepresentationTest.kt:9) | | | ||
| result: 0 | | | ||
| | counter.WRITE(1) at BaseFailingTest.increment(BaseFailingTest.kt:30) | | ||
| | actionsForTrace() at BaseFailingTest.increment(BaseFailingTest.kt:31) | | ||
| | a.WRITE(-1137016629) at KotlinRandomRepresentationTest.actionsForTrace(KotlinRandomRepresentationTest.kt:9) | | ||
| | result: 0 | | ||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |