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
38 changes: 38 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Pull request

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
# https://github.com/swiftlang/github-workflows/issues/48
license_header_check_enabled: false
license_header_check_project_name: "VS Code Swift"
api_breakage_check_enabled: false
docs_check_enabled: false
format_check_enabled: false
shell_check_enabled: true
unacceptable_language_check_enabled: true

tests:
name: Test
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
with:
linux_env_vars: |
NODE_VERSION=v18.19.0
NODE_PATH=/usr/local/nvm/versions/node/v18.19.0/bin
NVM_DIR=/usr/local/nvm
CI=1
FAST_TEST_RUN=1
linux_pre_build_command: |
apt-get update && apt-get install -y rsync curl gpg libasound2 libgbm1 libgtk-3-0 libnss3 xvfb build-essential
mkdir -p $NVM_DIR
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
/bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION"
echo "$NODE_PATH" >> $GITHUB_PATH
linux_build_command: ./docker/test.sh
enable_windows_checks: false
2 changes: 1 addition & 1 deletion .vscode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const { defineConfig } = require("@vscode/test-cli");
const path = require("path");

const isCIBuild = process.env["CI"] === "1";
const isCIBuild = false; // process.env["CI"] === "1";
const isFastTestRun = process.env["FAST_TEST_RUN"] === "1";

// "env" in launch.json doesn't seem to work with vscode-test
Expand Down
29 changes: 27 additions & 2 deletions docker/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#!/bin/bash
set -ex

case $(uname | tr '[:upper:]' '[:lower:]') in
linux*)
export OS_NAME=linux
;;
darwin*)
export OS_NAME=osx
;;
msys*)
export OS_NAME=windows
;;
*)
export OS_NAME=notset
;;
esac

current_directory=$(pwd)

mkdir /tmp/code
Expand All @@ -19,5 +34,15 @@ npm run lint
npm run format
npm run package

(xvfb-run -a npm run coverage; echo $? > exitcode) | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels" && rm -rf "${current_directory}/coverage" && (cp -R ./coverage "${current_directory}" || true)
exit "$(<exitcode)"
if [ "$OS_NAME" = "linux" ]; then
xvfb-run -a npm run coverage 2>&1 | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels"
exit_code=${PIPESTATUS[0]}
else
npm run coverage 2>&1 | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels"
exit_code=${PIPESTATUS[0]}
fi

rm -rf "${current_directory}/coverage"
cp -R ./coverage "${current_directory}" || true

exit "${exit_code}"
6 changes: 6 additions & 0 deletions src/TestExplorer/TestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ export class TestRunner {
) as vscode.DebugConfiguration[];

const debugRuns = validBuildConfigs.map(config => {
console.log("Debugging with profile", JSON.stringify(config));
return () =>
new Promise<void>((resolve, reject) => {
if (this.testRun.isCancellationRequested) {
Expand All @@ -858,6 +859,7 @@ export class TestRunner {

// add cancelation
const startSession = vscode.debug.onDidStartDebugSession(session => {
console.log(">>> Debugging session started", JSON.stringify(session));
if (config.testType === TestLibrary.xctest) {
this.testRun.testRunStarted();
}
Expand All @@ -884,10 +886,12 @@ export class TestRunner {
});
subscriptions.push(startSession);

console.log(">>> Start debugging...");
vscode.debug
.startDebugging(this.folderContext.workspaceFolder, config)
.then(
async started => {
console.log(">>> Did start?", started);
if (started) {
if (config.testType === TestLibrary.swiftTesting) {
// Watch the pipe for JSONL output and parse the events into test explorer updates.
Expand Down Expand Up @@ -925,6 +929,7 @@ export class TestRunner {
}
},
reason => {
console.log(">>> Failed to start", reason);
subscriptions.forEach(sub => sub.dispose());
reject(reason);
}
Expand All @@ -935,6 +940,7 @@ export class TestRunner {
// Run each debugging session sequentially
await debugRuns.reduce((p, fn) => p.then(() => fn()), Promise.resolve());
});
console.log(">>> All done!");
}

/** Returns a callback that handles a chunk of stdout output from a test run. */
Expand Down
6 changes: 6 additions & 0 deletions src/debugger/buildConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,12 @@ function getBaseConfig(ctx: FolderContext, expandEnvVariables: boolean) {
args: [],
preLaunchTask: `swift: Build All${nameSuffix}`,
terminal: "console",
...(process.env["CI"] === "1"
? {
disableASLR: false,
initCommands: ["settings set target.disable-aslr false"],
}
: {}),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ suite("Test Explorer Suite", function () {
});
}

suite("lldb-dap", () => {
suite.only("lldb-dap", () => {
beforeEach(async function () {
const testContext = await setupTestExplorerTest({
"swift.debugger.useDebugAdapterFromToolchain": true,
Expand Down