Building only the run-time library

75 views
Skip to first unread message

Bryan Wilkinson

unread,
Dec 19, 2016, 4:34:34 PM12/19/16
to quasar-pulsar-user
I'm wondering about the separation of Quasar's source code and dependencies into:
- the run-time library
- the run-time bytecode instrumentation (java agent)
- the compile-time tools (suspendable finder and bytecode instrumentor)

I ask this because I want to build the run-time library without Gradle. The Gradle build file looks intimidating, but I'm hoping that building the run-time library only is considerably simpler than building the entire project.

Bryan Wilkinson

unread,
Jan 5, 2017, 8:18:31 PM1/5/17
to quasar-pulsar-user
I ended up translating enough of the Gradle file to ANT in order to build the quasar-core component. I'm now trying to get the j-unit tests to pass but I'm running into some difficulties.

For example, I am getting:

    [junit] java.lang.RuntimeException: co.paralleluniverse.fibers.SuspendExecution: Oops. Forgot to instrument a method. Run your program with -Dco.paralleluniverse.fibers.verifyInstrumentation=true to catch the culprit!
    [junit]     at co.paralleluniverse.fibers.instrument.CatchTest$Callable1.run(CatchTest.java:134)
    [junit]     at co.paralleluniverse.fibers.instrument.CatchTest$Callable1.run(CatchTest.java:122)
    [junit]     at co.paralleluniverse.fibers.Fiber.run(Fiber.java:1072)
    [junit]     at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1067)
    [junit]     at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:767)
    [junit]     at co.paralleluniverse.fibers.TestsHelper.exec(TestsHelper.java:23)
    [junit]     at co.paralleluniverse.fibers.instrument.CatchTest.testCatch2(CatchTest.java:145)

When I run with verify instrumentation:

    [junit] Testcase: testCatch2(co.paralleluniverse.fibers.instrument.CatchTest):    Caused an ERROR
    [junit] Target class class co.paralleluniverse.fibers.instrument.CatchTest$Callable1 has not been instrumented.
    [junit] co.paralleluniverse.fibers.VerifyInstrumentationException: Target class class co.paralleluniverse.fibers.instrument.CatchTest$Callable1 has not been instrumented.
    [junit]     at co.paralleluniverse.fibers.Fiber.verifyInstrumentedTarget(Fiber.java:257)
    [junit]     at co.paralleluniverse.fibers.Fiber.<init>(Fiber.java:186)
    [junit]     at co.paralleluniverse.fibers.Fiber.<init>(Fiber.java:356)
    [junit]     at co.paralleluniverse.fibers.instrument.CatchTest.testCatch2(CatchTest.java:144)

I made the java agent verbose, and see things like:

    [junit] [quasar] INFO: TRANSFORM: org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner
    [junit] [quasar] INFO: Reading class: [Ljava/lang/String;
    [junit] [quasar] INFO: Class not found: [Ljava/lang/String;
    [junit] [quasar] INFO: Reading class: org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner
    [junit] [quasar] INFO: Reading class: java/lang/Object
    [junit] [quasar] INFO: Reading class: junit/framework/TestListener

But it never reads the CatchTest class. Here is now I invoke the tests:

      <junit printsummary="on" haltonfailure="yes" fork="true">
        <jvmarg value="-javaagent:${lib.dir}/quasar-core.jar=vdc"/>
        <classpath>
          ... paths for quasar dependencies ...
          <path path="${quasarTestClasses.dir}"/>
        </classpath>
        <formatter type="brief" usefile="false"/>
        <batchtest>
          <fileset dir="${quasarTestClasses.dir}" includes="**/CatchTest.class"/>
        </batchtest>
        <sysproperty key="co.paralleluniverse.fibers.verifyInstrumentation" value="true"/>
      </junit>

Any idea why the java agent isn't considering CatchTest?

Bryan Wilkinson

unread,
Jan 6, 2017, 9:54:13 PM1/6/17
to quasar-pulsar-user
This worked for a single test:

      <java classname="org.junit.runner.JUnitCore" fork="true" failonerror="true">

        <classpath>
          ... paths for quasar dependencies ...
          <path path="${quasarTestClasses.dir}"/>
        </classpath>
        <jvmarg value="-javaagent:${lib.dir}/quasar-core.jar"/>
        <jvmarg value="-Xmx2048M" />
        <!-- <sysproperty key="co.paralleluniverse.fibers.verifyInstrumentation" value="true"/> -->
        <arg value="co.paralleluniverse.fibers.instrument.CatchTest"/>
      </java>

The <junit> ant task must somehow affect classloading so that test classes bypass the java agent.
Reply all
Reply to author
Forward
0 new messages