diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/IteratingContentUnderExcludedTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/IteratingContentUnderExcludedTest.kt index d5c0cb47725b..f724329338fa 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/IteratingContentUnderExcludedTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/IteratingContentUnderExcludedTest.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.roots.impl import com.intellij.openapi.fileTypes.FileTypeRegistry @@ -9,12 +9,12 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.openapi.vfs.findFileOrDirectory import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry -import com.intellij.tools.ide.metrics.benchmark.Benchmark import com.intellij.testFramework.PsiTestUtil import com.intellij.testFramework.UsefulTestCase import com.intellij.testFramework.junit5.RunInEdt import com.intellij.testFramework.junit5.TestApplication import com.intellij.testFramework.rules.ProjectModelExtension +import com.intellij.tools.ide.metrics.benchmark.Benchmark import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test @@ -175,7 +175,10 @@ class IteratingContentUnderExcludedTest { IoTestUtil.assumeSymLinkCreationIsSupported() val root = projectModel.baseProjectDir.virtualFileRoot generateSymlinkExplosion(VfsUtilCore.virtualToIoFile(root), 17) - Benchmark.newBenchmark("traversing non-project roots") { checkIterate(root) }.start() + + Benchmark.newBenchmark("traversing non-project roots") { checkIterate(root) } + .runAsStressTest() + .start() } companion object { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/persistent/VFSInitializationBenchmarkTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/persistent/VFSInitializationBenchmarkTest.kt index 9daf967238bd..60a26e11d65a 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/persistent/VFSInitializationBenchmarkTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/persistent/VFSInitializationBenchmarkTest.kt @@ -1,14 +1,14 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vfs.newvfs.persistent -import com.intellij.testFramework.junit5.TestApplication +import com.intellij.testFramework.junit5.StressTestApplication import com.intellij.tools.ide.metrics.benchmark.Benchmark import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Test import org.junit.jupiter.api.io.TempDir import java.nio.file.Path -@TestApplication +@StressTestApplication class VFSInitializationBenchmarkTest { @Test diff --git a/platform/platform-tests/testSrc/com/intellij/psi/impl/search/LowLevelSearchUtilTest.java b/platform/platform-tests/testSrc/com/intellij/psi/impl/search/LowLevelSearchUtilTest.java index 3f7dadf76edd..b929edc4040b 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/impl/search/LowLevelSearchUtilTest.java +++ b/platform/platform-tests/testSrc/com/intellij/psi/impl/search/LowLevelSearchUtilTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl.search; import com.intellij.openapi.util.text.StringUtil; @@ -44,8 +44,8 @@ public class LowLevelSearchUtilTest extends TestCase { IntList found = new IntArrayList(new int[]{-1}); CharSequence text = StringUtil.repeat("xxx z ", 1000000); - Benchmark.newBenchmark("processTextOccurrences", ()-> { - for (int i=0; i<10000; i++) { + Benchmark.newBenchmark("processTextOccurrences", () -> { + for (int i = 0; i < 10000; i++) { found.removeInt(0); int startOffset = text.length() / 2 + i % 20; int endOffset = startOffset + 8; @@ -54,8 +54,10 @@ public class LowLevelSearchUtilTest extends TestCase { return true; }); assertTrue(success); - assertEquals(startOffset+","+endOffset, 1, found.size()); + assertEquals(startOffset + "," + endOffset, 1, found.size()); } - }).start(); + }) + .runAsStressTest() + .start(); } } diff --git a/platform/platform-tests/testSrc/com/intellij/serviceContainer/ConstructorInjectionTest.kt b/platform/platform-tests/testSrc/com/intellij/serviceContainer/ConstructorInjectionTest.kt index 234094eaba83..7bba3fa7485f 100644 --- a/platform/platform-tests/testSrc/com/intellij/serviceContainer/ConstructorInjectionTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/serviceContainer/ConstructorInjectionTest.kt @@ -14,11 +14,12 @@ class ConstructorInjectionTest { fun `light service getService() performance`() { val componentManager = TestComponentManager() assertThat(componentManager.getService(BarService::class.java)).isNotNull() + Benchmark.newBenchmark("getService() must be fast for cached service") { repeat(30_000_000) { componentManager.getService(BarService::class.java)!! } - }.start() + }.runAsStressTest().start() } @Test diff --git a/platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java b/platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java index eef0929683f3..621c43e17a93 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.containers; import com.intellij.concurrency.ConcurrentCollectionFactory; @@ -93,7 +79,9 @@ class ConcurrentBitSetTest { PlatformTestUtil.assumeEnoughParallelism(); int L = 128; int N = 10_000; - Benchmark.newBenchmark("testStressFineGrainedSmallSetModifications", () -> tortureParallelSetClear(L, N)).start(); + Benchmark.newBenchmark("testStressFineGrainedSmallSetModifications", () -> tortureParallelSetClear(L, N)) + .runAsStressTest() + .start(); } @Test @@ -103,7 +91,9 @@ class ConcurrentBitSetTest { // todo ARM64 is slow for some reason int N = CpuArch.isArm64() ? 300 : 1000; - Benchmark.newBenchmark("testStressCoarseGrainedBigSet", () -> tortureParallelSetClear(L, N)).start(); + Benchmark.newBenchmark("testStressCoarseGrainedBigSet", () -> tortureParallelSetClear(L, N)) + .runAsStressTest() + .start(); } private static void tortureParallelSetClear(int L, int N) { @@ -208,7 +198,8 @@ class ConcurrentBitSetTest { assertEquals(expectedSum, r); }); // really must not depend on CPU core number - })/**/.start(); + }).runAsStressTest() + .start(); } @Test diff --git a/platform/platform-tests/testSrc/com/intellij/util/messages/impl/MessageBusTest.kt b/platform/platform-tests/testSrc/com/intellij/util/messages/impl/MessageBusTest.kt index d8038d6cd121..dcc7dc673d07 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/messages/impl/MessageBusTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/util/messages/impl/MessageBusTest.kt @@ -386,7 +386,9 @@ class MessageBusTest : MessageBusOwner { for (i in count - 1 downTo 0) { Disposer.dispose(children[i]) } - }.start() + } + .runAsStressTest() + .start() } @Test diff --git a/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/ApplicationMetricsExtractionFromUnitPerfTest.kt b/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/ApplicationMetricsExtractionFromUnitPerfTest.kt index bfeffd508410..fb30b8ce3cdc 100644 --- a/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/ApplicationMetricsExtractionFromUnitPerfTest.kt +++ b/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/ApplicationMetricsExtractionFromUnitPerfTest.kt @@ -6,7 +6,7 @@ import com.intellij.platform.diagnostic.telemetry.PlatformMetrics import com.intellij.platform.diagnostic.telemetry.Scope import com.intellij.platform.diagnostic.telemetry.TelemetryManager import com.intellij.platform.diagnostic.telemetry.helpers.use -import com.intellij.testFramework.junit5.TestApplication +import com.intellij.testFramework.junit5.StressTestApplication import com.intellij.tools.ide.metrics.collector.OpenTelemetryJsonMeterCollector import com.intellij.tools.ide.metrics.collector.metrics.MetricsSelectionStrategy import com.intellij.tools.ide.metrics.collector.metrics.PerformanceMetrics @@ -24,7 +24,7 @@ internal val ExtractionMetricsScope: Scope = Scope("ExtractionMetricsScope", Pla /** Class intentionally named *Perf* (and not a *Performance*) test. * That way it will not be ignored during Aggregator run */ -@TestApplication +@StressTestApplication class ApplicationMetricsExtractionFromUnitPerfTest { private val tracer = TelemetryManager.getTracer(ExtractionMetricsScope) diff --git a/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/SpanExtractionFromUnitPerfTest.kt b/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/SpanExtractionFromUnitPerfTest.kt index c39bdf6f4810..d0bf0f193707 100644 --- a/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/SpanExtractionFromUnitPerfTest.kt +++ b/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/SpanExtractionFromUnitPerfTest.kt @@ -149,7 +149,7 @@ class SpanExtractionFromUnitPerfTest { fun runSubTest(subtestName: String) { Benchmark.newBenchmark(testInfo.testMethod.get().name) { runBlocking { delay(Random.nextInt(100, 500).milliseconds) } - }.startAsSubtest(subtestName) + }.runAsStressTest().startAsSubtest(subtestName) } runSubTest("subtest1") @@ -161,7 +161,7 @@ class SpanExtractionFromUnitPerfTest { val spanName = "simple perf test" val uniqueTestName = Benchmark.newBenchmark(spanName) { runBlocking { delay(Random.nextInt(100, 500).milliseconds) } - }.run { + }.runAsStressTest().run { start() uniqueTestName } @@ -177,7 +177,7 @@ class SpanExtractionFromUnitPerfTest { perfTest = Benchmark.newBenchmark(spanName) { runBlocking { delay(Random.nextInt(100, 500).milliseconds) } throw RuntimeException("Exception text") - } + }.runAsStressTest() perfTest.apply { warmupIterations(0) start()