Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux integration test failure with webview.test.ts #143226

Closed
deepak1556 opened this issue Feb 16, 2022 · 7 comments
Closed

Linux integration test failure with webview.test.ts #143226

deepak1556 opened this issue Feb 16, 2022 · 7 comments
Assignees
Labels
engineering VS Code - Build / issue tracking / etc. important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders integration-test-failure linux Issues with VS Code on Linux webview Webview issues
Milestone

Comments

@deepak1556
Copy link
Collaborator

deepak1556 commented Feb 16, 2022

Started happening with 0992d85 but the change only adjusts if the runtime should use hardware acceleration and fixes the dbus session connection for the runtime. Not sure why it would trigger the following failure. @mjbvz can you please look into it, thanks!

/cc @bpasero

TypeError: Cannot read properties of undefined (reading '0')
    at workspaceFile (/__w/1/s/extensions/vscode-api-tests/src/singlefolder-tests/webview.test.ts:15:63)
    at Object.<anonymous> (/__w/1/s/extensions/vscode-api-tests/src/singlefolder-tests/webview.test.ts:18:22)
    at Module._compile (node:internal/modules/cjs/loader:1163:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1216:10)
    at Module.load (node:internal/modules/cjs/loader:1035:32)
    at Module._load (node:internal/modules/cjs/loader:876:12)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Function.n._load (/__w/1/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:32148)
    at Function.I._load (/__w/1/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:28737)
    at Function.g._load (/__w/1/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:99:60281)
    at Module.require (node:internal/modules/cjs/loader:1059:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at /__w/1/s/node_modules/mocha/lib/mocha.js:394:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/__w/1/s/node_modules/mocha/lib/mocha.js:391:14)
    at Mocha.run (/__w/1/s/node_modules/mocha/lib/mocha.js:970:10)
    at /__w/1/s/test/integration/electron/testrunner.js:40:10
    at f (/__w/1/s/node_modules/once/once.js:25:25)
    at Glob.<anonymous> (/__w/1/s/node_modules/glob/glob.js:133:7)
    at Glob.emit (node:events:394:28)
    at Glob._finish (/__w/1/s/node_modules/glob/glob.js:172:8)
    at done (/__w/1/s/node_modules/glob/glob.js:159:12)
    at Glob._processGlobStar2 (/__w/1/s/node_modules/glob/glob.js:601:12)
    at /__w/1/s/node_modules/glob/glob.js:590:10

@deepak1556 deepak1556 added engineering VS Code - Build / issue tracking / etc. integration-test-failure linux Issues with VS Code on Linux webview Webview issues important Issue identified as high-priority labels Feb 16, 2022
@deepak1556 deepak1556 added this to the February 2022 milestone Feb 16, 2022
@deepak1556
Copy link
Collaborator Author

Looks like path parsing for the workspace is incorrect since there is now a flag removed in the arguments list https://github.com/microsoft/vscode/blob/main/scripts/test-integration.sh#L78. It would be better to not rely on any flag order for determining the workspace path.

@bpasero
Copy link
Member

bpasero commented Feb 16, 2022

since there is now a flag removed in the arguments list

Can you clarify, not sure I follow?

@deepak1556
Copy link
Collaborator Author

Previously the workspace integration tests were launched in the following format

"$INTEGRATION_TEST_ELECTRON_PATH" --disable-dev-shm-usage --use-gl=swiftshader $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 --disable-telemetry --skip-welcome --skip-release-notes --crash-reporter-directory=$VSCODECRASHDIR --logsPath=$VSCODELOGSDIR --no-cached-data --disable-updates --disable-keytar --disable-extensions --disable-workspace-trust --user-data-dir=$VSCODEUSERDATADIR

The above failure started happening with removing an argument --use-gl=swiftshader prepended to the workspace path

"$INTEGRATION_TEST_ELECTRON_PATH" --disable-dev-shm-usage $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 --disable-telemetry --skip-welcome --skip-release-notes --crash-reporter-directory=$VSCODECRASHDIR --logsPath=$VSCODELOGSDIR --no-cached-data --disable-updates --disable-keytar --disable-extensions --disable-workspace-trust --user-data-dir=$VSCODEUSERDATADIR

@deepak1556
Copy link
Collaborator Author

deepak1556 commented Feb 16, 2022

We can append the LINUX_EXTRA_ARGS to the list to mitigate this error, but would like to understand why the above case can cause failures in determining the workspace path.

@bpasero
Copy link
Member

bpasero commented Feb 16, 2022

This is in the end just using minimist as far as I can tell:

vscode/src/main.js

Lines 429 to 441 in b344f43

function parseCLIArgs() {
const minimist = require('minimist');
return minimist(process.argv, {
string: [
'user-data-dir',
'locale',
'js-flags',
'max-memory',
'crash-reporter-directory'
]
});
}

//cc @joaomoreno

@mjbvz
Copy link
Collaborator

mjbvz commented Feb 16, 2022

I pushed a small change to delay accessing the workspace folders in the webview tests. However I am seeing the workspace API tests failing on linux which seems like a similar issue: https://github.com/microsoft/vscode/runs/5221637070?check_suite_focus=true#step:15:302

As an example:

2) vscode API - workspace
[325](https://github.com/microsoft/vscode/runs/5221637070?check_suite_focus=true#step:15:325)
       workspaceFile:
[326](https://github.com/microsoft/vscode/runs/5221637070?check_suite_focus=true#step:15:326)
     TypeError: Cannot read properties of undefined (reading 'fsPath')
[327](https://github.com/microsoft/vscode/runs/5221637070?check_suite_focus=true#step:15:327)
      at Context.<anonymous> (extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts:20:56)
[328](https://github.com/microsoft/vscode/runs/5221637070?check_suite_focus=true#step:15:328)
      at processImmediate (node:internal/timers:464:21)

@deepak1556
Copy link
Collaborator Author

Yeah the problem is with minimist parsing. For example when launching like the following,

> ./scripts/code-cli.sh --arg1 --arg2=val /Users/demohan/github/vscode

parsedArgs looks like

{
  _: [ '.', '/Users/demohan/github/vscode/' ],
  diff: false,
  d: false,
  add: false,
  a: false,
  goto: false,
  g: false,
  'new-window': false,
  n: false,
  'reuse-window': false,
  r: false,
  wait: false,
  w: false,
  help: false,
  h: false,
  'list-extensions': false,
  'show-versions': false,
  'pre-release': false,
  version: false,
  v: false,
  verbose: false,
  status: false,
  s: false,
  'prof-startup': false,
  'no-cached-data': false,
  'prof-v8-extensions': false,
  'disable-extensions': false,
  disableExtensions: false,
  'disable-gpu': false,
  'ms-enable-electron-run-as-node': true,
  telemetry: false,
  debugRenderer: false,
  logExtensionHostCommunication: false,
  'skip-release-notes': false,
  'skip-welcome': false,
  'disable-telemetry': false,
  'disable-updates': false,
  'disable-keytar': false,
  'disable-workspace-trust': false,
  'disable-crash-reporter': false,
  'skip-add-to-recently-opened': false,
  'unity-launch': false,
  'open-url': false,
  'file-write': false,
  'file-chmod': false,
  'driver-verbose': false,
  force: false,
  'do-not-sync': false,
  trace: false,
  'force-user-env': false,
  'force-disable-user-env': false,
  'open-devtools': false,
  __sandbox: false,
  'no-proxy-server': false,
  'no-sandbox': false,
  sandbox: false,
  nolazy: false,
  'force-renderer-accessibility': false,
  'ignore-certificate-errors': false,
  'allow-insecure-localhost': false,
  arg1: true,
  arg2: 'val'
}

But if we launch the following

> ./scripts/code-cli.sh --arg1 /Users/demohan/github/vscode-electron-prebuilt/

then it becomes

{
  _: [ '.' ],
  diff: false,
  d: false,
  add: false,
  a: false,
  goto: false,
  g: false,
  'new-window': false,
  n: false,
  'reuse-window': false,
  r: false,
  wait: false,
  w: false,
  help: false,
  h: false,
  'list-extensions': false,
  'show-versions': false,
  'pre-release': false,
  version: false,
  v: false,
  verbose: false,
  status: false,
  s: false,
  'prof-startup': false,
  'no-cached-data': false,
  'prof-v8-extensions': false,
  'disable-extensions': false,
  disableExtensions: false,
  'disable-gpu': false,
  'ms-enable-electron-run-as-node': true,
  telemetry: false,
  debugRenderer: false,
  logExtensionHostCommunication: false,
  'skip-release-notes': false,
  'skip-welcome': false,
  'disable-telemetry': false,
  'disable-updates': false,
  'disable-keytar': false,
  'disable-workspace-trust': false,
  'disable-crash-reporter': false,
  'skip-add-to-recently-opened': false,
  'unity-launch': false,
  'open-url': false,
  'file-write': false,
  'file-chmod': false,
  'driver-verbose': false,
  force: false,
  'do-not-sync': false,
  trace: false,
  'force-user-env': false,
  'force-disable-user-env': false,
  'open-devtools': false,
  __sandbox: false,
  'no-proxy-server': false,
  'no-sandbox': false,
  sandbox: false,
  nolazy: false,
  'force-renderer-accessibility': false,
  'ignore-certificate-errors': false,
  'allow-insecure-localhost': false,
  arg1: '/Users/demohan/github/vscode/'
}

Allowing arg1 to take the value that was passed next to it. There are two solutions here,

  • we should either declare all the args from LINUX_EXTRA_ARGS into this list so that they get parsed correctly

  • Or we can just move LINUX_EXTRA_ARGS to the end of the command so that it does not interfere with other arguments that get parsed before it.

I am inclined to do the first as it declares what we expect to be chromium flags with a particular type associated with it.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
engineering VS Code - Build / issue tracking / etc. important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders integration-test-failure linux Issues with VS Code on Linux webview Webview issues
Projects
None yet
Development

No branches or pull requests

4 participants
@bpasero @deepak1556 @mjbvz and others