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)))
|
2022-02-17 01:16:46 +08:00
|
|
|
# --disable-dev-shm-usage: when run on docker containers where size of /dev/shm
|
2021-05-04 17:18:19 +08:00
|
|
|
# partition < 64MB which causes OOM failure for chromium compositor that uses the partition for shared memory
|
2022-02-17 01:16:46 +08:00
|
|
|
LINUX_EXTRA_ARGS="--disable-dev-shm-usage"
|
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
|
2021-06-15 14:33:26 +08:00
|
|
|
VSCODELOGSDIR=$ROOT/.build/logs/integration-tests
|
2022-01-31 14:28:38 +08:00
|
|
|
|
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
|
|
|
|
INTEGRATION_TEST_ELECTRON_PATH="./scripts/code.sh"
|
2019-09-04 14:55:20 +08:00
|
|
|
|
|
|
|
echo "Running integration tests out of sources."
|
2019-09-02 17:26:26 +08:00
|
|
|
else
|
2020-01-15 23:36:03 +08:00
|
|
|
export VSCODE_CLI=1
|
|
|
|
export ELECTRON_ENABLE_LOGGING=1
|
|
|
|
|
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
|
|
|
|
|
2022-09-26 15:16:42 +08:00
|
|
|
echo "Storing crash reports into '$VSCODECRASHDIR'."
|
|
|
|
echo "Storing log files into '$VSCODELOGSDIR'."
|
|
|
|
|
2021-07-01 21:23:32 +08:00
|
|
|
|
2024-10-02 17:55:17 +08:00
|
|
|
# Unit tests
|
2021-07-01 21:23:32 +08:00
|
|
|
|
2022-01-31 14:28:38 +08:00
|
|
|
echo
|
|
|
|
echo "### node.js integration tests"
|
|
|
|
echo
|
2019-09-18 19:55:03 +08:00
|
|
|
./scripts/test.sh --runGlob **/*.integrationTest.js "$@"
|
2018-10-30 06:23:39 +08:00
|
|
|
|
2021-07-01 21:23:32 +08:00
|
|
|
|
2017-11-15 18:15:41 +08:00
|
|
|
# Tests in the extension host
|
2021-02-17 22:09:40 +08:00
|
|
|
|
2023-09-08 23:58:32 +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-extensions --disable-workspace-trust --user-data-dir=$VSCODEUSERDATADIR"
|
2021-01-19 18:03:56 +08:00
|
|
|
|
2022-01-31 14:28:38 +08:00
|
|
|
if [ -z "$INTEGRATION_TEST_APP_NAME" ]; then
|
|
|
|
kill_app() { true; }
|
|
|
|
else
|
|
|
|
kill_app() { killall $INTEGRATION_TEST_APP_NAME || true; }
|
|
|
|
fi
|
2020-12-04 04:45:01 +08:00
|
|
|
|
2022-01-31 14:28:38 +08:00
|
|
|
echo
|
|
|
|
echo "### API tests (folder)"
|
|
|
|
echo
|
|
|
|
"$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 $API_TESTS_EXTRA_ARGS
|
|
|
|
kill_app
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### API tests (workspace)"
|
|
|
|
echo
|
|
|
|
"$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 $API_TESTS_EXTRA_ARGS
|
|
|
|
kill_app
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### Colorize tests"
|
|
|
|
echo
|
2024-10-03 18:34:14 +08:00
|
|
|
npm run test-extension -- -l vscode-colorize-tests
|
2022-01-31 14:28:38 +08:00
|
|
|
kill_app
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### TypeScript tests"
|
|
|
|
echo
|
2022-05-02 20:05:30 +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 $API_TESTS_EXTRA_ARGS
|
2022-01-31 14:28:38 +08:00
|
|
|
kill_app
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### Markdown tests"
|
|
|
|
echo
|
2024-10-03 18:34:14 +08:00
|
|
|
npm run test-extension -- -l markdown-language-features
|
2022-01-31 14:28:38 +08:00
|
|
|
kill_app
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### Emmet tests"
|
|
|
|
echo
|
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/emmet/test-workspace --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test $API_TESTS_EXTRA_ARGS
|
|
|
|
kill_app
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### Git tests"
|
|
|
|
echo
|
2022-05-02 20:05:30 +08:00
|
|
|
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $(mktemp -d 2>/dev/null) --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test $API_TESTS_EXTRA_ARGS
|
2022-01-31 14:28:38 +08:00
|
|
|
kill_app
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### Ipynb tests"
|
|
|
|
echo
|
2024-10-03 18:34:14 +08:00
|
|
|
npm run test-extension -- -l ipynb
|
2022-01-31 14:28:38 +08:00
|
|
|
kill_app
|
2021-08-04 01:56:43 +08:00
|
|
|
|
2023-06-06 05:19:51 +08:00
|
|
|
echo
|
|
|
|
echo "### Notebook Output tests"
|
|
|
|
echo
|
2024-10-03 18:34:14 +08:00
|
|
|
npm run test-extension -- -l notebook-renderers
|
2023-06-06 05:19:51 +08:00
|
|
|
kill_app
|
|
|
|
|
2022-06-14 15:08:27 +08:00
|
|
|
echo
|
|
|
|
echo "### Configuration editing tests"
|
|
|
|
echo
|
2024-10-03 18:34:14 +08:00
|
|
|
npm run test-extension -- -l configuration-editing
|
2022-06-14 15:08:27 +08:00
|
|
|
kill_app
|
|
|
|
|
2023-10-17 04:58:44 +08:00
|
|
|
echo
|
|
|
|
echo "### GitHub Authentication tests"
|
|
|
|
echo
|
2024-10-03 18:34:14 +08:00
|
|
|
npm run test-extension -- -l github-authentication
|
2023-10-17 04:58:44 +08:00
|
|
|
kill_app
|
2021-07-01 21:23:32 +08:00
|
|
|
|
|
|
|
# Tests standalone (CommonJS)
|
|
|
|
|
2022-01-31 14:28:38 +08:00
|
|
|
echo
|
|
|
|
echo "### CSS tests"
|
|
|
|
echo
|
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
|
|
|
|
2022-01-31 14:28:38 +08:00
|
|
|
echo
|
|
|
|
echo "### HTML tests"
|
|
|
|
echo
|
2018-06-12 23:24:23 +08:00
|
|
|
cd $ROOT/extensions/html-language-features/server && $ROOT/scripts/node-electron.sh test/index.js
|
2022-01-31 14:28:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
# Cleanup
|
2017-03-17 23:52:31 +08:00
|
|
|
|
2020-06-01 19:41:24 +08:00
|
|
|
rm -rf $VSCODEUSERDATADIR
|