Re: Debugging Implementation when running ITs

2015-10-06 Thread Dominik Süß
Thanks Konrad & Bertrand,

Bertrands commands for the Pax Exam tests worked for me as well :)

Cheers
Dominik

On Tue, Oct 6, 2015 at 12:26 PM, Bertrand Delacretaz  wrote:

> Hi,
>
> On Tue, Oct 6, 2015 at 10:59 AM, Dominik Süß 
> wrote:
> > ...I currently want to hook in a debugger to the implementation of the
> > installer when running the corresponding ITs...
>
> The sling/installer/it module uses Pax Exam and runs the tests with
> surefire.
>
> A simple way to debug the server-side code is to disable surefire
> forking so that the MAVEN_OPTS are used to configure the jvm
> debuggging:
>
>   $ export MAVEN_OPTS="-Xmx1G  -XX:MaxPermSize=256m
> -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=y"
>
>   $ mvn -o clean test -Dtest=BundlePrioritiesTest -DforkCount=0
>
> You can then connect to the VM on port 30303 to debug the
> OsgiInstallerImpl, for example. And of course replace the
> BundlePrioritiesTest name with whatever makes sense.
>
> -Bertrand
>


Re: Debugging Implementation when running ITs

2015-10-06 Thread Bertrand Delacretaz
Hi,

On Tue, Oct 6, 2015 at 10:59 AM, Dominik Süß  wrote:
> ...I currently want to hook in a debugger to the implementation of the
> installer when running the corresponding ITs...

The sling/installer/it module uses Pax Exam and runs the tests with surefire.

A simple way to debug the server-side code is to disable surefire
forking so that the MAVEN_OPTS are used to configure the jvm
debuggging:

  $ export MAVEN_OPTS="-Xmx1G  -XX:MaxPermSize=256m
-agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=y"

  $ mvn -o clean test -Dtest=BundlePrioritiesTest -DforkCount=0

You can then connect to the VM on port 30303 to debug the
OsgiInstallerImpl, for example. And of course replace the
BundlePrioritiesTest name with whatever makes sense.

-Bertrand


Re: Debugging Implementation when running ITs

2015-10-06 Thread Bertrand Delacretaz
On Tue, Oct 6, 2015 at 11:22 AM, Konrad Windszus  wrote:
> ...this does only work, if you provision a new server instance, but not if 
> your
> a connecting to an already running server

But in the latter case one just needs to start that server with JVM
debugging options and connect to it before running integration tests.

(which I think is what you meant - it just had the potential of being
wrongly understood ;-)

-Bertrand


Re: Debugging Implementation when running ITs

2015-10-06 Thread Konrad Windszus
Just set a breakpoint to 
org.apache.sling.testing.tools.jarexec.JarExecutor.start() and then start the 
debugging on the client side (also documented at 
https://sling.apache.org/documentation/development/sling-testing-tools.html).
You should see now which JVM options are used to start the instance.
The problem usually is, that Surefire itself forks Maven and therefore does not 
inherit the original system properties. Just set the configuration option 
forkCount from 
http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html to 0 to 
prevent forking. Otherwise you have to set the jar.executor.vm.options through 
the configuration option args.

Remember that this does only work, if you provision a new server instance, but 
not if your a connecting to an already running server.
Konrad
 
> On 06 Oct 2015, at 10:59, Dominik Süß  wrote:
> 
> Hi everybody,
> 
> I currently want to hook in a debugger to the implementation of the
> installer when running the corresponding ITs as I want to inspect the
> implementation behavior and see if I could add a patch that helps in
> upgrade scenarios.
> 
> Yet I had no success getting the IT start in a way that I could hook in a
> remote debugger.
> If I get the documentation right it should be
> 
> mvn test
> -Djar.executor.vm.options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"
> 
> (picked up from
> https://sling.apache.org/documentation/development/sling-testing-tools.html)
> 
> Yet the tests just run through (and just fyi failed for
> BundleInstallStressTest.testSemiRandomInstall) without waiting for a remote
> connection.
> 
> Cheers
> 
> Dominik



Debugging Implementation when running ITs

2015-10-06 Thread Dominik Süß
Hi everybody,

I currently want to hook in a debugger to the implementation of the
installer when running the corresponding ITs as I want to inspect the
implementation behavior and see if I could add a patch that helps in
upgrade scenarios.

Yet I had no success getting the IT start in a way that I could hook in a
remote debugger.
If I get the documentation right it should be

mvn test
-Djar.executor.vm.options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"

(picked up from
https://sling.apache.org/documentation/development/sling-testing-tools.html)

Yet the tests just run through (and just fyi failed for
BundleInstallStressTest.testSemiRandomInstall) without waiting for a remote
connection.

Cheers

Dominik