Skip to content
Closed
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
27 changes: 20 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches: [master]
pull_request:
workflow_dispatch:
inputs:
repeat_ui_test:
description: Run the full runtime test class ten times per OS
type: boolean
default: false

# A newer push to the same branch makes the older run's result moot.
concurrency:
Expand All @@ -27,6 +32,7 @@ env:

jobs:
test:
if: ${{ !inputs.repeat_ui_test }}
name: Tests (${{ matrix.os }})
strategy:
fail-fast: false
Expand Down Expand Up @@ -124,6 +130,7 @@ jobs:
# What the tests never look at: the descriptors only fail when an IDE loads them, and the
# distributions are only assembled here.
plugin:
if: ${{ !inputs.repeat_ui_test }}
name: Build and verify plugins
runs-on: ubuntu-24.04
timeout-minutes: 60
Expand Down Expand Up @@ -193,14 +200,15 @@ jobs:
retention-days: 14

ui-test:
name: Split-mode UI tests (${{ matrix.os }}, ${{ matrix.shard }}/2)
name: ${{ inputs.repeat_ui_test && format('Debugger startup ({0}, repeat {1}/10)', matrix.os, matrix.repeat) || format('Split-mode UI tests ({0}, {1}/2)', matrix.os, matrix.shard) }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2025]
# Half the test classes each, by test count (see `uiTestShard` in src/ui-test): all of them
# on one Windows runner outgrew the step's 100 minutes.
shard: [1, 2]
shard: ${{ fromJSON(inputs.repeat_ui_test && '[1]' || '[1,2]') }}
repeat: ${{ fromJSON(inputs.repeat_ui_test && '[1,2,3,4,5,6,7,8,9,10]' || '[1]') }}
runs-on: ${{ matrix.os }}
# Each test starts a backend and a client, a few minutes apiece on a two-core runner.
timeout-minutes: 120
Expand Down Expand Up @@ -311,16 +319,21 @@ jobs:
timeout-minutes: 100
run: |
mkdir -p out
if [ '${{ inputs.repeat_ui_test }}' = 'true' ]; then
test_args=(--tests '*SplitModeRuntimeTest')
else
test_args=(-PuiTestShard=${{ matrix.shard }}/2)
fi
while true; do
{ date -u +%T; df -h . | tail -n 1; [ "$RUNNER_OS" = Linux ] && free -m | sed -n 2p; } >> out/resource-usage.log 2>&1
sleep 60
done > /dev/null 2>&1 &
trap "kill $!" EXIT
if [ "$RUNNER_OS" = Linux ]; then
xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" \
./gradlew :ui-test:test -PsearchableOptions=false -PuiTestShard=${{ matrix.shard }}/2 --console=plain
./gradlew :ui-test:test -PsearchableOptions=false "${test_args[@]}" --console=plain
else
./gradlew :ui-test:test -PsearchableOptions=false -PuiTestShard=${{ matrix.shard }}/2 --console=plain
./gradlew :ui-test:test -PsearchableOptions=false "${test_args[@]}" --console=plain
fi

# A test stopped by a timeout leaves its IDEs running, and on Windows their locked files make
Expand Down Expand Up @@ -350,7 +363,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v5
with:
name: ui-test-reports-${{ matrix.os }}-${{ matrix.shard }}
name: ui-test-reports-${{ matrix.os }}-${{ matrix.shard }}${{ inputs.repeat_ui_test && format('-repeat-{0}', matrix.repeat) || '' }}
path: |
src/ui-test/build/reports/tests/
src/ui-test/build/test-results/
Expand All @@ -362,10 +375,10 @@ jobs:
# the run directories, which would make the upload walk into those -- an exclusion only applies
# after the walk, and stat on a held `.port` failed the whole upload.
- name: Upload IDE logs
if: failure() || cancelled()
if: failure() || cancelled() || inputs.repeat_ui_test
uses: actions/upload-artifact@v5
with:
name: ui-test-ide-logs-${{ matrix.os }}-${{ matrix.shard }}
name: ui-test-ide-logs-${{ matrix.os }}-${{ matrix.shard }}${{ inputs.repeat_ui_test && format('-repeat-{0}', matrix.repeat) || '' }}
# The test JVM's timeout dumps live under the hidden .intellijPlatform directory.
include-hidden-files: true
path: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class SplitModeRuntimeTest {
// about how it tried to.
withWorkbenchProbe(
"split-mode-runtime", "let value = 1;\nvalue;\n",
traced = "#com.intellij.execution.process,#me.helvert.codebridge.task",
traced = "#com.intellij.execution.process,#me.helvert.codebridge.task," +
"#com.intellij.platform.debugger.impl.frontend.FrontendXDebuggerManager,#com.intellij.platform.dap",
) {
val frame = driver.ideFrame { }
assertEquals("true", command("probe.startTask"))
Expand Down Expand Up @@ -89,8 +90,23 @@ class SplitModeRuntimeTest {
tree.collectExpandedPathsAsStrings()
}
}
awaitProbeValue("the stopped session's variable in the client", ::variableRows) { rows ->
rows.any { it.contains("probeValue") && it.contains("41") }
try {
awaitProbeValue("the stopped session's variable in the client", ::variableRows) { rows ->
rows.any { it.contains("probeValue") && it.contains("41") }
}
} catch (failure: AssertionError) {
// A startup clock timeout can cancel the client's debugger subscription for good.
// Keep the original assertion; attach the earlier failure and adapter state so a
// missing tree is not mistaken for a slow variables response.
runCatching {
val startup = frontendLog().lineSequence().filter {
it.contains("TimedOutWaitingForClockException") || it.contains("FrontendXDebuggerManager")
}.joinToString("\n") { it.take(2_000) }.take(12_000)
failure.addSuppressed(AssertionError(
"Debugger state: ${command("probe.runtimeState")}\nClient startup:\n$startup"
))
}.onFailure(failure::addSuppressed)
throw failure
}
driver.act("StepOver", variables)
awaitProbeValue("step over updating variables in the client", ::variableRows) { rows ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ internal class WorkbenchProbe(
/** What the backend has logged so far: its `idea.log`, not the client's, which is under `frontend`. */
fun backendLog(): String = logs.read()

/** Client startup can lose debugger RPC subscriptions before the adapter starts (#147). */
fun frontendLog(): String = Files.walk(home).use { paths ->
paths.filter { file ->
file.fileName.toString() == "idea.log" && home.relativize(file).any { it.toString() == "frontend" }
}.toList().joinToString("\n") { it.readText() }
}

/** A scenario's files and log messages, while retaining the running IDEs. */
fun scenario(directory: String) = WorkbenchProbe(driver, project.resolve(directory), home, userSettings, logs.snapshot())

Expand Down
Loading