2020-10-30 14:54:13 +08:00
|
|
|
#!/usr/bin/env bash
|
2016-03-08 18:50:56 +08:00
|
|
|
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)))
|
2020-12-10 02:46:35 +08:00
|
|
|
# Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
|
|
|
|
LINUX_EXTRA_ARGS="--no-sandbox"
|
2016-03-08 18:50:56 +08:00
|
|
|
fi
|
|
|
|
|
2020-02-04 19:32:02 +08:00
|
|
|
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
|
2020-05-07 14:26:12 +08:00
|
|
|
VSCODECRASHDIR=$ROOT/.build/crashes
|
2017-04-25 14:50:57 +08:00
|
|
|
cd $ROOT
|
|
|
|
|
2019-09-02 17:26:26 +08:00
|
|
|
# Figure out which Electron to use for running tests
|
|
|
|
if [ -z "$INTEGRATION_TEST_ELECTRON_PATH" ]
|
|
|
|
then
|
2019-09-04 14:55:20 +08:00
|
|
|
# Run out of sources: no need to compile as code.sh takes care of it
|
2019-09-02 17:26:26 +08:00
|
|
|
INTEGRATION_TEST_ELECTRON_PATH="./scripts/code.sh"
|
2019-09-04 14:55:20 +08:00
|
|
|
|
2020-05-07 14:26:12 +08:00
|
|
|
echo "Storing crash reports into '$VSCODECRASHDIR'."
|
2019-09-04 14:55:20 +08:00
|
|
|
echo "Running integration tests out of sources."
|
2019-09-02 17:26:26 +08:00
|
|
|
else
|
2019-09-04 14:55:20 +08:00
|
|
|
# Run from a built: need to compile all test extensions
|
2020-02-13 19:02:15 +08:00
|
|
|
# because we run extension tests from their source folders
|
|
|
|
# and the build bundles extensions into .build webpacked
|
2020-02-13 19:26:32 +08:00
|
|
|
yarn gulp compile-extension:vscode-api-tests \
|
2021-01-19 18:03:56 +08:00
|
|
|
compile-extension:vscode-colorize-tests \
|
2020-07-30 05:05:36 +08:00
|
|
|
compile-extension:vscode-custom-editor-tests \
|
2020-04-24 02:55:23 +08:00
|
|
|
compile-extension:vscode-notebook-tests \
|
2020-02-13 19:26:32 +08:00
|
|
|
compile-extension:markdown-language-features \
|
2020-07-10 15:57:44 +08:00
|
|
|
compile-extension:typescript-language-features \
|
2020-02-13 19:26:32 +08:00
|
|
|
compile-extension:emmet \
|
|
|
|
compile-extension:css-language-features-server \
|
|
|
|
compile-extension:html-language-features-server \
|
|
|
|
compile-extension:json-language-features-server \
|
|
|
|
compile-extension:git
|
2019-09-02 17:26:26 +08:00
|
|
|
|
2020-01-15 23:36:03 +08:00
|
|
|
# Configuration for more verbose output
|
|
|
|
export VSCODE_CLI=1
|
|
|
|
export ELECTRON_ENABLE_STACK_DUMPING=1
|
|
|
|
export ELECTRON_ENABLE_LOGGING=1
|
|
|
|
|
2020-12-10 02:46:35 +08:00
|
|
|
# Production builds are run on docker containers where size of /dev/shm partition < 64MB which causes OOM failure
|
|
|
|
# for chromium compositor that uses the partition for shared memory
|
|
|
|
if [ "$LINUX_EXTRA_ARGS" ]
|
|
|
|
then
|
|
|
|
LINUX_EXTRA_ARGS="$LINUX_EXTRA_ARGS --disable-dev-shm-usage --use-gl=swiftshader"
|
|
|
|
fi
|
|
|
|
|
2020-05-07 14:26:12 +08:00
|
|
|
echo "Storing crash reports into '$VSCODECRASHDIR'."
|
2019-09-04 14:55:20 +08:00
|
|
|
echo "Running integration tests with '$INTEGRATION_TEST_ELECTRON_PATH' as build."
|
2019-09-02 17:26:26 +08:00
|
|
|
fi
|
|
|
|
|
2020-12-04 04:45:01 +08:00
|
|
|
if [ -z "$INTEGRATION_TEST_APP_NAME" ]; then
|
|
|
|
after_suite() { true; }
|
|
|
|
else
|
|
|
|
after_suite() { killall $INTEGRATION_TEST_APP_NAME || true; }
|
|
|
|
fi
|
|
|
|
|
2018-10-30 06:23:39 +08:00
|
|
|
# Integration tests in AMD
|
2019-09-18 19:55:03 +08:00
|
|
|
./scripts/test.sh --runGlob **/*.integrationTest.js "$@"
|
2020-12-04 04:45:01 +08:00
|
|
|
after_suite
|
2018-10-30 06:23:39 +08:00
|
|
|
|
2017-11-15 18:15:41 +08:00
|
|
|
# Tests in the extension host
|
2021-02-17 22:09:40 +08:00
|
|
|
|
|
|
|
ALL_PLATFORMS_API_TESTS_EXTRA_ARGS="--disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-keytar --disable-extensions --user-data-dir=$VSCODEUSERDATADIR"
|
|
|
|
|
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-api-tests/testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
|
2020-12-04 04:45:01 +08:00
|
|
|
after_suite
|
|
|
|
|
2021-02-17 22:09:40 +08:00
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
|
2021-02-17 01:44:11 +08:00
|
|
|
after_suite
|
2020-12-04 04:45:01 +08:00
|
|
|
|
2021-02-17 22:09:40 +08:00
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
|
2021-01-19 18:03:56 +08:00
|
|
|
after_suite
|
|
|
|
|
2021-02-17 22:09:40 +08:00
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/markdown-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
|
2020-12-04 04:45:01 +08:00
|
|
|
after_suite
|
|
|
|
|
2021-02-17 22:09:40 +08:00
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/typescript-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/typescript-language-features --extensionTestsPath=$ROOT/extensions/typescript-language-features/out/test/unit $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
|
2021-01-16 03:19:33 +08:00
|
|
|
after_suite
|
2020-12-04 04:45:01 +08:00
|
|
|
|
2021-03-29 14:31:14 +08:00
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/emmet/test-workspace --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
|
2020-12-04 04:45:01 +08:00
|
|
|
after_suite
|
|
|
|
|
2021-02-17 22:09:40 +08:00
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $(mktemp -d 2>/dev/null) --enable-proposed-api=vscode.git --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
|
2020-12-04 04:45:01 +08:00
|
|
|
after_suite
|
|
|
|
|
2021-02-17 22:09:40 +08:00
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-notebook-tests/test --enable-proposed-api=vscode.vscode-notebook-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-notebook-tests --extensionTestsPath=$ROOT/extensions/vscode-notebook-tests/out/ $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
|
2020-12-04 04:45:01 +08:00
|
|
|
after_suite
|
2019-10-09 00:02:55 +08:00
|
|
|
|
2020-08-18 18:04:38 +08:00
|
|
|
# Tests in commonJS (CSS, HTML)
|
2018-06-12 23:24:23 +08:00
|
|
|
cd $ROOT/extensions/css-language-features/server && $ROOT/scripts/node-electron.sh test/index.js
|
2020-12-04 04:45:01 +08:00
|
|
|
after_suite
|
|
|
|
|
2018-06-12 23:24:23 +08:00
|
|
|
cd $ROOT/extensions/html-language-features/server && $ROOT/scripts/node-electron.sh test/index.js
|
2020-12-04 04:45:01 +08:00
|
|
|
after_suite
|
2017-03-17 23:52:31 +08:00
|
|
|
|
2020-06-01 19:41:24 +08:00
|
|
|
rm -rf $VSCODEUSERDATADIR
|