-
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.
Remove access calls from trace (for function accesses only). #537
- Loading branch information
1 parent
b7b2588
commit f51afaf
Showing
9 changed files
with
1,500 additions
and
14,564 deletions.
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
40 changes: 40 additions & 0 deletions
40
...st/org/jetbrains/kotlinx/lincheck_test/representation/AccessFunctionRepresentationTest.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,40 @@ | ||
/* | ||
* Lincheck | ||
* | ||
* Copyright (C) 2019 - 2025 JetBrains s.r.o. | ||
* | ||
* This Source Code Form is subject to the terms of the | ||
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed | ||
* with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.jetbrains.kotlinx.lincheck_test.representation | ||
|
||
class AccessFunctionRepresentationTest: BaseRunConcurrentRepresentationTest<Unit>("access_function_representation_test.txt") { | ||
|
||
@Volatile | ||
private var a = 0 | ||
|
||
override fun block() { | ||
runn { inc() } | ||
check(false) | ||
} | ||
|
||
private fun inc() { | ||
Nested().inc2() | ||
} | ||
|
||
private fun inc3() { | ||
a++ | ||
} | ||
private inner class Nested { | ||
fun inc2() { | ||
inc3() | ||
} | ||
|
||
} | ||
} | ||
|
||
fun runn(r: () -> Unit) { | ||
r() | ||
} |
31 changes: 31 additions & 0 deletions
31
src/jvm/test/resources/expected_logs/access_function_representation_test.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,31 @@ | ||
= Concurrent test failed = | ||
|
||
java.lang.IllegalStateException: Check failed. | ||
at org.jetbrains.kotlinx.lincheck_test.representation.AccessFunctionRepresentationTest.block(AccessFunctionRepresentationTest.kt:20) | ||
at org.jetbrains.kotlinx.lincheck_test.representation.AccessFunctionRepresentationTest.block(AccessFunctionRepresentationTest.kt:13) | ||
at org.jetbrains.kotlinx.lincheck_test.representation.BaseRunConcurrentRepresentationTest$testRunWithModelChecker$result$1$1.invoke(RunConcurrentRepresentationTests.kt:40) | ||
at java.base/java.lang.Thread.run(Thread.java:840) | ||
|
||
The following interleaving leads to the error: | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| Thread 1 | | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| AccessFunctionRepresentationTest#1.block(): threw IllegalStateException at BaseRunConcurrentRepresentationTest$testRunWithModelChecker$result$1$1.invoke(RunConcurrentRepresentationTests.kt:40) | | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
|
||
Detailed trace: | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| Thread 1 | | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| AccessFunctionRepresentationTest#1.block(): threw IllegalStateException at BaseRunConcurrentRepresentationTest$testRunWithModelChecker$result$1$1.invoke(RunConcurrentRepresentationTests.kt:40) | | ||
| block(): threw IllegalStateException at AccessFunctionRepresentationTest.block(AccessFunctionRepresentationTest.kt:13) | | ||
| AccessFunctionRepresentationTestKt.runn(block$1) at AccessFunctionRepresentationTest.block(AccessFunctionRepresentationTest.kt:19) | | ||
| block$1.invoke() at AccessFunctionRepresentationTestKt.runn(AccessFunctionRepresentationTest.kt:39) | | ||
| invoke() at AccessFunctionRepresentationTest$block$1.invoke(AccessFunctionRepresentationTest.kt:19) | | ||
| AccessFunctionRepresentationTest.inc() at AccessFunctionRepresentationTest$block$1.invoke(AccessFunctionRepresentationTest.kt:19) | | ||
| Nested#1.inc2() at AccessFunctionRepresentationTest.inc(AccessFunctionRepresentationTest.kt:24) | | ||
| AccessFunctionRepresentationTest.inc3() at AccessFunctionRepresentationTest$Nested.inc2(AccessFunctionRepresentationTest.kt:32) | | ||
| a ➜ 1 at AccessFunctionRepresentationTest.inc3(AccessFunctionRepresentationTest.kt:28) | | ||
| a = 2 at AccessFunctionRepresentationTest.inc3(AccessFunctionRepresentationTest.kt:28) | | ||
| result: IllegalStateException #1 | | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
Oops, something went wrong.