Skip to content
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

Set JDK 17 as a default JDK for representation tests #559

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 21 additions & 10 deletions scripts/overwrite_representation_tests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

#
# Lincheck
#
Expand All @@ -6,30 +8,39 @@
# 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/.
#


# This script runs all representation tests in overwrite mode.
# It runs the tests on all jdks and both in trace and non-trace modes,
# in the order jdk8 non-trace -> jdk8 trace -> jdk 11 non-trace -> jdk 11 trace, etc..
# Note that due to current issue (https://github.com/JetBrains/lincheck/issues/500) we skip jdk8 trace.
# It runs the tests on all jdks and both in trace and non-trace modes, in the order:
# jdk-default non-trace -> jdk-default trace -> jdk-8 non-trace -> jdk 8 trace -> jdk-11 non-trace, jdk-11 trace, ...
# Where necessary the output files are created or overwritten.
# One can use this script to verify trace outputs by looking at the local changes after the script ran.
# And commit the changes if accepted, to update test outputs.

# jdk 11 is SLOW! So remove it if you don't expect files to change
cd ../
jdks=("8" "11" "13" "15" "17" "19" "20" "21")

# We put JDK 17 on the first place because it is the default JDK version for tests.
# By default, when run on other JDK versions, representation tests will first
# try to compare the output with the default log file (i.e. log file for default JDK version),
# and only if they are not equal a JDK-specific expected log file will be created.
# Thus by first running tests on default JDK version we ensure that the default log file
# always created at the beginning.
#
# JDK 11 is SLOW! So remove it if you don't expect files to change
jdks=("17" "8" "11" "13" "15" "19" "20" "21")

testFilter="org.jetbrains.kotlinx.lincheck_test.representation.*"

for jdk in "${jdks[@]}"
do
echo "[Representation Tests Overwrite] Running tests for jdk: $jdk in non-trace mode ----------------------"
./gradlew jvmTest --tests "$testFilter" -PjdkToolchainVersion="$jdk" -PoverwriteRepresentationTestsOutput=true -PtestInTraceDebuggerMode=false


./gradlew clean jvmTest --tests "$testFilter" -PjdkToolchainVersion="$jdk" -PoverwriteRepresentationTestsOutput=true -PtestInTraceDebuggerMode=false

#https://github.com/JetBrains/lincheck/issues/500
if [ "$jdk" = "8" ]; then
continue
fi

echo "[Representation Tests Overwrite] Running tests for jdk: $jdk in trace mode --------------------------"
./gradlew jvmTest --tests "$testFilter" -PjdkToolchainVersion="$jdk" -PoverwriteRepresentationTestsOutput=true -PtestInTraceDebuggerMode=true
./gradlew clean jvmTest --tests "$testFilter" -PjdkToolchainVersion="$jdk" -PoverwriteRepresentationTestsOutput=true -PtestInTraceDebuggerMode=true
done
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import kotlin.reflect.jvm.*
* Checks that spin-cycle repeated events are cut in case of obstruction freedom violation
*/
class ObstructionFreedomViolationEventsCutTest {

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val q = MSQueueBlocking()

@Operation
Expand All @@ -50,6 +54,9 @@ class ObstructionFreedomViolationEventsCutTest {
*/
class SpinlockEventsCutShortLengthTest : AbstractSpinLivelockTest() {

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val sharedStateAny = AtomicBoolean(false)

override val outputFileName: String
Expand All @@ -66,6 +73,9 @@ class SpinlockEventsCutShortLengthTest : AbstractSpinLivelockTest() {
*/
class SpinlockEventsCutMiddleLengthTest : AbstractSpinLivelockTest() {

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val sharedStateAny = AtomicBoolean(false)

override val outputFileName: String
Expand All @@ -83,7 +93,8 @@ class SpinlockEventsCutMiddleLengthTest : AbstractSpinLivelockTest() {
* when one thread runs in the infinite loop while others terminate
*/
class SpinlockEventsCutInfiniteLoopTest : AbstractSpinLivelockTest() {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val sharedStateAny = AtomicBoolean(false)
Expand All @@ -103,7 +114,8 @@ class SpinlockEventsCutInfiniteLoopTest : AbstractSpinLivelockTest() {
* when one thread runs in the infinite loop while others terminate
*/
class SpinlockEventsCutInfiniteLoopWithParametersTest : AbstractSpinLivelockTest() {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

@Volatile
Expand All @@ -124,7 +136,8 @@ class SpinlockEventsCutInfiniteLoopWithParametersTest : AbstractSpinLivelockTest
* when the spin cycle is twice bigger due to a flipping method receivers.
*/
class SpinlockEventsCutInfiniteLoopWithReceiversTest : AbstractSpinLivelockTest() {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val first = Receiver(false)
Expand All @@ -151,7 +164,8 @@ class SpinlockEventsCutInfiniteLoopWithReceiversTest : AbstractSpinLivelockTest(
* when the spin cycle is bigger due to a different arrays usage and cells access.
*/
class SpinlockEventsCutInfiniteLoopWithArrayOperationsTest : AbstractSpinLivelockTest() {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

@Volatile
Expand All @@ -178,7 +192,8 @@ class SpinlockEventsCutInfiniteLoopWithArrayOperationsTest : AbstractSpinLiveloc
* when the spin cycle is twice bigger due to a flipping arrays receivers usage.
*/
class SpinlockEventsCutInfiniteLoopWithArrayReceiversTest : AbstractSpinLivelockTest() {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val first = Array(3) { 0 }
Expand All @@ -204,7 +219,8 @@ class SpinlockEventsCutInfiniteLoopWithArrayReceiversTest : AbstractSpinLivelock
* LinCheck should calculate spin cycle period without params.
*/
class SpinlockEventsCutInfiniteNoCycleWithParamsTest : AbstractSpinLivelockTest() {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val array = Array(3) { 0 }
Expand All @@ -228,6 +244,9 @@ class SpinlockEventsCutInfiniteNoCycleWithParamsTest : AbstractSpinLivelockTest(
*/
class SpinlockEventsCutLongCycleActionsTest : AbstractSpinLivelockTest() {

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val data = AtomicReferenceArray<Int>(7)
override val outputFileName: String
get() = "spin_lock/spin_lock_events_cut_long_cycle"
Expand All @@ -249,9 +268,14 @@ class SpinlockEventsCutLongCycleActionsTest : AbstractSpinLivelockTest() {
*/
class SpinlockEventsCutWithInnerLoopActionsTest : AbstractSpinLivelockTest() {

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val data = AtomicReferenceArray<Int>(10)

override val outputFileName: String
get() = "spin_lock/spin_lock_events_cut_inner_loop"

override fun meaninglessActions() {
for (i in 0 until data.length()) {
data[i] = 0
Expand Down Expand Up @@ -309,6 +333,9 @@ abstract class AbstractSpinLivelockTest {
*/
class SpinlockInIncorrectResultsWithClocksTest {

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

@Volatile
private var bStarted = false

Expand Down Expand Up @@ -389,7 +416,8 @@ class SpinlockInIncorrectResultsWithClocksTest {
* Test should not fail.
*/
class SpinCycleWithSideEffectsTest {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val counter = AtomicInteger(0)
Expand Down Expand Up @@ -430,7 +458,8 @@ class SpinCycleWithSideEffectsTest {
* when all potential switch points are nested in non-atomic methods.
*/
class SpinLockWithAllEventsWrappedInMethodsTest {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

private val counter = AtomicInteger(0)
Expand Down Expand Up @@ -478,7 +507,8 @@ class SpinLockWithAllEventsWrappedInMethodsTest {
* when all the trace points are in the top-level, i.e., right in the actor.
*/
class SingleThreadTopLevelSpinLockTest {
@Before

@Before // spin-loop detection is unsupported in trace debugger mode
fun setUp() = assumeFalse(isInTraceDebuggerMode)

@Volatile
Expand Down
Loading