Files
vscode/scripts/test-remote-integration.sh
Alexandru DimaandCopilot 09d2db6c2f test: report which integration suite failed and why (#342347)
* test: report which integration suite failed and why

Integration test steps sometimes exited non-zero with no failing test in
the log. test-integration.sh and test-remote-integration.sh stop at the
first failing suite (set -e) without saying which suite failed. The Agent
Host E2E runner printed PASS for every suite and then exited 1 when the
RAM-backed pass could not unmount its tmpfs.

- test-integration.sh and test-remote-integration.sh name the failing
  suite and its exit code on exit, and add a GitHub Actions error
  annotation. Agent Host E2E is named separately from the node.js tests.
- tmpfs.sh exits with status 3 when the tests passed but the tmpfs could
  not be cleaned up.
- runner.ts lists each failed storage pass at the end of its output, and
  says when every suite passed but tmpfs cleanup failed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: expect the tmpfs cleanup failure status in the storage wrapper tests

Update the storage wrapper tests for exit status 3 when an otherwise
passing run cannot unmount the tmpfs, and cover that a failing test keeps
its own exit code when the unmount also fails. Also remove a duplicated
README sentence.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-18 01:24:22 +00:00

135 lines
5.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0")))
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
fi
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
VSCODECRASHDIR=$ROOT/.build/crashes
VSCODELOGSDIR=$ROOT/.build/logs/integration-tests-remote
TESTRESOLVER_DATA_FOLDER=`mktemp -d 2>/dev/null`
cd $ROOT
# Names the suite that is running, so that a failure that stops the script
# (set -e) reports which suite failed and with which exit code.
CURRENT_SUITE=""
start_suite() {
CURRENT_SUITE="$1"
echo
echo "### $1"
echo
}
report_failed_suite() {
local status=$?
if [[ $status -ne 0 && -n "$CURRENT_SUITE" ]]; then
echo "Integration tests failed in '$CURRENT_SUITE' with exit code $status." >&2
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
echo "::error title=Integration tests failed::'$CURRENT_SUITE' exited with code $status"
fi
fi
}
trap report_failed_suite EXIT
if [[ "$1" == "" ]]; then
AUTHORITY=vscode-remote://test+test
EXT_PATH=$ROOT/extensions
# Load remote node
npm run gulp node
else
AUTHORITY=$1
EXT_PATH=$2
VSCODEUSERDATADIR=${3:-$VSCODEUSERDATADIR}
fi
export REMOTE_VSCODE=$AUTHORITY$EXT_PATH
# Figure out which Electron to use for running tests
if [ -z "$INTEGRATION_TEST_ELECTRON_PATH" ]
then
INTEGRATION_TEST_ELECTRON_PATH="./scripts/code.sh"
# No extra arguments when running out of sources
EXTRA_INTEGRATION_TEST_ARGUMENTS=""
echo "Running remote integration tests out of sources."
else
export VSCODE_CLI=1
export ELECTRON_ENABLE_LOGGING=1
# Running from a build, we need to enable the vscode-test-resolver extension
EXTRA_INTEGRATION_TEST_ARGUMENTS="--extensions-dir=$EXT_PATH --enable-proposed-api=vscode.vscode-test-resolver --enable-proposed-api=vscode.vscode-api-tests"
echo "Running remote integration tests with $INTEGRATION_TEST_ELECTRON_PATH as build."
fi
export TESTRESOLVER_DATA_FOLDER=$TESTRESOLVER_DATA_FOLDER
export TESTRESOLVER_LOGS_FOLDER=$VSCODELOGSDIR/server
# Figure out which remote server to use for running tests
if [ -z "$VSCODE_REMOTE_SERVER_PATH" ]
then
echo "Using remote server out of sources for integration tests"
else
echo "Using $VSCODE_REMOTE_SERVER_PATH as server path for integration tests"
export TESTRESOLVER_INSTALL_BUILTIN_EXTENSION='ms-vscode.vscode-smoketest-check'
fi
if [ -z "$INTEGRATION_TEST_APP_NAME" ]; then
kill_app() { true; }
else
kill_app() { killall $INTEGRATION_TEST_APP_NAME || true; }
fi
API_TESTS_EXTRA_ARGS="--disable-telemetry --disable-experiments --skip-welcome --skip-release-notes --crash-reporter-directory=$VSCODECRASHDIR --logsPath=$VSCODELOGSDIR --no-cached-data --disable-updates --use-inmemory-secretstorage --disable-workspace-trust --user-data-dir=$VSCODEUSERDATADIR"
echo "Storing crash reports into '$VSCODECRASHDIR'."
echo "Storing log files into '$VSCODELOGSDIR'."
# Tests in the extension host
start_suite "API tests (folder)"
"$INTEGRATION_TEST_ELECTRON_PATH" --folder-uri=$REMOTE_VSCODE/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$REMOTE_VSCODE/vscode-api-tests --extensionTestsPath=$REMOTE_VSCODE/vscode-api-tests/out/singlefolder-tests $API_TESTS_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS
kill_app
start_suite "API tests (workspace)"
"$INTEGRATION_TEST_ELECTRON_PATH" --file-uri=$REMOTE_VSCODE/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$REMOTE_VSCODE/vscode-api-tests --extensionTestsPath=$REMOTE_VSCODE/vscode-api-tests/out/workspace-tests $API_TESTS_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS
kill_app
start_suite "TypeScript tests"
"$INTEGRATION_TEST_ELECTRON_PATH" --folder-uri=$REMOTE_VSCODE/typescript-language-features/test-workspace --extensionDevelopmentPath=$REMOTE_VSCODE/typescript-language-features --extensionTestsPath=$REMOTE_VSCODE/typescript-language-features/out/test/unit $API_TESTS_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS
kill_app
start_suite "Markdown tests"
"$INTEGRATION_TEST_ELECTRON_PATH" --folder-uri=$REMOTE_VSCODE/markdown-language-features/test-workspace --extensionDevelopmentPath=$REMOTE_VSCODE/markdown-language-features --extensionTestsPath=$REMOTE_VSCODE/markdown-language-features/out/test $API_TESTS_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS
kill_app
start_suite "Emmet tests"
"$INTEGRATION_TEST_ELECTRON_PATH" --folder-uri=$REMOTE_VSCODE/emmet/test-workspace --extensionDevelopmentPath=$REMOTE_VSCODE/emmet --extensionTestsPath=$REMOTE_VSCODE/emmet/out/test $API_TESTS_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS
kill_app
start_suite "Git tests"
"$INTEGRATION_TEST_ELECTRON_PATH" --folder-uri=$AUTHORITY$(mktemp -d 2>/dev/null) --extensionDevelopmentPath=$REMOTE_VSCODE/git --extensionTestsPath=$REMOTE_VSCODE/git/out/test $API_TESTS_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS
kill_app
start_suite "Ipynb tests"
"$INTEGRATION_TEST_ELECTRON_PATH" --folder-uri=$AUTHORITY$(mktemp -d 2>/dev/null) --extensionDevelopmentPath=$REMOTE_VSCODE/ipynb --extensionTestsPath=$REMOTE_VSCODE/ipynb/out/test $API_TESTS_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS
kill_app
start_suite "Configuration editing tests"
"$INTEGRATION_TEST_ELECTRON_PATH" --folder-uri=$AUTHORITY$(mktemp -d 2>/dev/null) --extensionDevelopmentPath=$REMOTE_VSCODE/configuration-editing --extensionTestsPath=$REMOTE_VSCODE/configuration-editing/out/test $API_TESTS_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS
kill_app
# Cleanup
if [[ "$3" == "" ]]; then
rm -rf $VSCODEUSERDATADIR
fi
rm -rf $TESTRESOLVER_DATA_FOLDER