Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
test: Run test-setproctitle where setting the process title is supported by libuv#11416
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Setting the process title has been enabled in libuv on AIX and z/OS. The latest level of libuv skips only skips testing of uv_set_process_title when __sun is #defined. This change simplifies the skip test so the test is only skipped when common.isSunOS is true to match libuv.
cjihrig left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if the CI is happy
mscdex commented Feb 16, 2017
bnoordhuis commented Feb 16, 2017
Test failures: |
cjihrig commented Feb 16, 2017
@hhellyer looks like a Windows check is needed as well. |
Skip running the `ps` part of the test on Windows.
hhellyer commented Feb 22, 2017
@cjihrig - Done, I added a Windows check so it doesn't run ps, it does run the first half of the test. Sorry for the delay, I had to find a Windows machine. I left the first trivial looking half of the test as on Windows the libuv stores the title by changing the console title and retrieves it by calling GetConsoleTitleW so the test will do a bit more than just check a variable contains the value it was set to one line above. |
| process.title=title; | ||
| assert.strictEqual(process.title,title); | ||
| // Test setting the title but do not try to run `ps` on Windows. |
richardlauFeb 23, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I naively thought that it should be possible to do the equivalent (i.e. validate the process title change) on Windows via PowerShell. Turns out it's more complicated because on Windows changing the process title changes the title of the console Window which is not necessarily the same process as the node.exe process (e.g. if you open a cmd.exe Window and then launch node.exe inside it, changing the process title in Node.js changes the Window title of the cmd.exe process).
Anyway I ended up with this hideous command line/PowerShell script, which given a process id will walk up the parent process ids until it finds a process with a non-empty Window title and then print it out:
powershell "$p = <pid> $t = Get-Process -pid $p ; while ($t.MainWindowTitle -eq ''){$p = Get-WmiObject win32_process | where{$_.processId -eq $p } | select -ExpandProperty parentProcessId; $t = Get-Process -pid $p } Write-Host $t.MainWindowTitle"Of course Get-Process doesn't know about parent process ids, so the script has to use Get-WmiObject win32_process (which doesn't know about Window titles).
I make no claims to being a PowerShell expert. Quite happy to submit this as a separate PR and not overly complicate this one.
cc @nodejs/platform-windows
gibfahn commented Feb 24, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I'll land this tomorrow if there are no objections EDIT: or CI failures |
gibfahn commented Feb 24, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
CI 2: https://ci.nodejs.org/job/node-test-commit/8111/ EDIT: CI is green |
mhdawson left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
gibfahn commented Feb 27, 2017
Landed in 893632e |
Setting the process title has been enabled in libuv on AIX and z/OS. The latest level of libuv skips only skips testing of uv_set_process_title when __sun is #defined. This change simplifies the skip test so the test is only skipped when common.isSunOS is true to match libuv. Skip running the `ps` part of the test on Windows. PR-URL: #11416 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Setting the process title has been enabled in libuv on AIX and z/OS. The latest level of libuv skips only skips testing of uv_set_process_title when __sun is #defined. This change simplifies the skip test so the test is only skipped when common.isSunOS is true to match libuv. Skip running the `ps` part of the test on Windows. PR-URL: nodejs#11416 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
jasnell commented Mar 7, 2017
If this should land on v6 or v4 at all, please open a backport PR |
gibfahn commented Mar 7, 2017
This depends on #11094, so it should only be backported if that PR is. |
Setting the process title has been enabled in libuv on AIX and z/OS.
The latest level of libuv skips only skips testing of uv_set_process_title when __sun is #defined.
The Node.js test for supported platforms was getting long so now it only checks for the one unsupported platform the same way as libuv.
This change simplifies the skip test so the test is only skipped when common.isSunOS is true to match libuv. The corresponding libuv test is here:
https://github.com/nodejs/node/blob/master/deps/uv/test/test-process-title.c#L63
It was updated when support for setting the process title was added to AIX and z/OS and included in Node.js when libuv was upgraded under PR #11094
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test