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

Add direct unit tests for working with 32bit and 64bit processes. #37

Merged
merged 10 commits into from
Apr 19, 2017

Conversation

oleg-nenashev
Copy link
Member

@oleg-nenashev oleg-nenashev commented Apr 17, 2017

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.

  • - Add explicit process management tests for 32 and 64 apps, powered by a multi-platform Hello World App
  • - Add tests for retrieving CmdLine and EnvVars of the terminated process
  • - Fix Javadoc according to the actual behavior for termintaed processes (needs to be reflected in Jenkins)

@reviewbybees

…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
@ghost
Copy link

ghost commented Apr 17, 2017

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.

@oleg-nenashev oleg-nenashev changed the title Add direct unit tests for retrieving CmdLine and EnvVars of the terminated process. Add direct unit tests for working with 32bit and 64bit processes. Apr 18, 2017
Copy link
Member

@jglick jglick left a 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);
Copy link
Member

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.

Copy link
Member Author

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member Author

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");
Copy link
Member

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?

Copy link
Member Author

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

@oleg-nenashev oleg-nenashev removed their assignment Apr 19, 2017
@oleg-nenashev
Copy link
Member Author

@jglick ready for review

Copy link
Member

@jglick jglick left a 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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beware of SUREFIRE-1226

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add on-demand

Copy link
Member

@abayer abayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, I guess? =)

@oleg-nenashev
Copy link
Member Author

@reviewbybees done, I guess? =)

@oleg-nenashev oleg-nenashev merged commit abb78b6 into jenkinsci:master Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants