vscode/scripts/test-remote-integration.sh

134 lines
5.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2021-10-21 00:42:13 +08:00
set -e
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0")))
2021-10-21 00:42:13 +08:00
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
# --disable-dev-shm-usage: when run on docker containers where size of /dev/shm
2021-10-21 00:42:13 +08:00
# partition < 64MB which causes OOM failure for chromium compositor that uses the partition for shared memory
LINUX_EXTRA_ARGS="--disable-dev-shm-usage"
2021-10-21 00:42:13 +08:00
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`
2021-10-21 00:42:13 +08:00
cd $ROOT
2021-10-21 00:42:13 +08:00
if [[ "$1" == "" ]]; then
AUTHORITY=vscode-remote://test+test
EXT_PATH=$ROOT/extensions
# Load remote node
feat: switch to npm as default package manager (#226927) * feat: move from yarn to npm * chore: skip yarn.lock files * fix: playwright download * chore: fix compile and hygiene * chore: bump vsce@2.17.0 Refs https://github.com/microsoft/vscode-vsce/commit/8b49e9dfdf909ad3af2b9ec9c825f5b501f6d75e * test: update results for bat and sh colorizer tests * fix: add missing lock files for windows * fix: switch to legacy-peer-deps * chore: update markdown-it@14.1.0 Refs https://github.com/markdown-it/markdown-it/commit/737c95a12976357df99652e4b51d831cac4a75aa esbuild step in extensions-ci-pr was previously using markdown-it from root which had userland punycode and was able to compile successfully. * ci: increase pr timeout for windows integration tests * chore: fix product build * build: ignore extension dev dependency for rcedit * build: fix working directory inside container * build: fix dependency generation * npm: update dependencies * ci: use global npmrc * ci: update cache * ci: setup global npmrc for private npm auth * build: fix extension bundling * chore: sync npm dependencies * ci: debug env variables for container * ci: fix win32 cli pipeline * build: fix npmrc config usage for build/ and remote/ dirs * fix: windows build * fix: container builds * fix: markdown-language-features tests and bundling ``` [03:58:22] Error: Command failed: /Users/demohan/.nvm/versions/node/v20.15.1/bin/node /Users/demohan/github/vscode/extensions/markdown-language-features/esbuild-notebook.js --outputRoot /Users/demohan/github/vscode/.build/extensions/markdown-language-features ✘ [ERROR] Could not resolve "punycode" extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:14:27: 14 │ var punycode = require('punycode'); ╵ ~~~~~~~~~~ The package "punycode" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error. ``` Adds userland package based on https://github.com/markdown-it/markdown-it/commit/beed9aee2c1b44819afc25d485e86a6c699b6ef0 * fix: container builds for distro * chore: update yarn occurrences * fixup! chore: bump vsce@2.17.0 Uses the closest version to `main` branch that does not include https://github.com/microsoft/vscode-vsce/commit/d3cc84cdec99b8e9f24be63d1a2a54abe908f68b while still having the fix https://github.com/microsoft/vscode-vsce/commit/8b49e9dfdf909ad3af2b9ec9c825f5b501f6d75e * chore: sync npm dependencies * chore: sync npm dependencies * chore: sync npm dependencies * chore: throw error when yarn is used for installation * chore: add review feedback * chore: switch exec => run where needed * chore: npm sync dependencies * fix: markdown-language-features bundling ``` ✘ [ERROR] Could not resolve "punycode" extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:14:27: 14 │ var punycode = require('punycode'); ╵ ~~~~~~~~~~ The package "punycode" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error. ``` Adds missing userland package based on markdown-it/markdown-it@beed9ae, can be removed once we update markdown-it >= 14.1.0 * ci: rename no-yarn-lock-changes.yml * chore: sync npm dependencies * ci: restore no-yarn-lock-changes.yml We can disable it in a separate PR to keep the required checks happy and also need workflow edit perms. * chore: sync npm dependencies * ci: rebuild cache * ci: fix no-package-lock-changes.yml * chore: bump distro * chore: rm yarn.lock files * chore: rm yarn.lock files without dependencies * chore: add vscode-selfhost-import-aid to postinstall dirs * chore: bump distro
2024-09-06 21:18:02 +08:00
npm run gulp node
2021-10-21 00:42:13 +08:00
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
2021-10-21 00:42:13 +08:00
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"
2021-10-21 00:42:13 +08:00
echo "Running remote integration tests with $INTEGRATION_TEST_ELECTRON_PATH as build."
2021-10-21 00:42:13 +08:00
fi
export TESTRESOLVER_DATA_FOLDER=$TESTRESOLVER_DATA_FOLDER
export TESTRESOLVER_LOGS_FOLDER=$VSCODELOGSDIR/server
2021-10-21 00:42:13 +08:00
# 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
2021-10-21 00:42:13 +08:00
API_TESTS_EXTRA_ARGS="--disable-telemetry --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
echo
echo "### API tests (folder)"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --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
echo
echo "### API tests (workspace)"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --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
echo
echo "### TypeScript tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --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
echo
echo "### Markdown tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --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
echo
echo "### Emmet tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --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
echo
echo "### Git tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --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
echo
echo "### Ipynb tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --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
echo
echo "### Configuration editing tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --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
2021-10-21 00:42:13 +08:00
if [[ "$3" == "" ]]; then
rm -rf $VSCODEUSERDATADIR
fi
rm -rf $TESTRESOLVER_DATA_FOLDER