-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add direct unit tests for working with 32bit and 64bit processes. #37
Add direct unit tests for working with 32bit and 64bit processes. #37
Conversation
…nated process. It is not exactly jenkinsci#129, because it happens in another query. But jenkinsci#129 may be caused by similar reasons if the process dies in the middle of 2 queries. It may be a case when killing process trees, though it is also not the only root cause of JENKINS-30782
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
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.
Apparent absolute path bug. Otherwise looks good to me.
WinProcess wp = new WinProcess(p); | ||
assertEquals("foobar", wp.getEnvironmentVariables().get("TEST")); | ||
|
||
Thread.sleep(100); |
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.
Looks like this could be flaky.
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.
Moved from the original implementation. Will fix if I hit real issue with this test
public void getCommandLine_shouldNotFailIfTheProcessIsDead() throws Exception { | ||
Process p = spawnTestApp(); | ||
new WinProcess(p).killRecursively(); | ||
Thread.sleep(1000); |
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.
Ditto.
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.
It is generally more than enough to get the process memory snapshot garbage collected. At least it works right now, will polish later if I see any real flakiness
* Spawns test process, which is guaranteed to be a 32-bit one. | ||
*/ | ||
private Process spawnTestApp32() throws AssertionError, InterruptedException, IOException { | ||
return spawnProcess("C:\\Users\\Oleg\\Documents\\jenkins\\windows\\winp\\native\\Release\\testapp32.exe"); |
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.
Uh, do you not mean this to be some path relative to the project basedir?
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.
I suppose it was a bad Ctrl+X/Ctrl+V. This method is not being used anywhere. Will remove
…/winp into bug/Issue129_test1 Conflicts: src/test/java/org/jvnet/winp/util/ProcessSpawningTest.java
…cProcessTest for terminated processes
@jglick ready for review |
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.
Do not follow the details very well but looks reasonable.
<configuration> | ||
<forkMode>never</forkMode> | ||
</configuration> | ||
<version>2.19.1</version> |
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.
beware of SUREFIRE-1226
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.
will add on-demand
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.
Fine, I guess? =)
@reviewbybees done, I guess? =) |
It is not exactly #29, because it happens in another query.
But #29 may be caused by similar reasons if the process dies in the middle of 2 queries. It may be a case when killing process trees, though it is also not the only root cause of JENKINS-30782.
@reviewbybees