Skip to content

RunTestMethods ClassCircularityError for evosuite generated tests #80

@DCallaz

Description

@DCallaz

Context

As a follow up from #75, I am generating tests with evosuite and trying to collect their coverage using Gzoltar. I am currently able to generate a list of the evosuite test methods using the Gzoltar listTestMethods, but when running the tests using runTestMethods, I either get a ClassNotFoundException if the evosuite jar is not on the classpath, or the following if the evosuite jar is on the classpath:

Exception in thread "main" java.lang.ClassCircularityError: java/lang/RuntimePermission
	at org.evosuite.runtime.sandbox.MSecurityManager.allowPermission(MSecurityManager.java:500)
	at org.evosuite.runtime.sandbox.MSecurityManager.checkPermission(MSecurityManager.java:432)
	at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1262)
	at java.lang.System.setProperties(System.java:694)
	at com.gzoltar.cli.commands.RunTestMethods.execute(RunTestMethods.java:109)
	at com.gzoltar.cli.Main.execute(Main.java:105)
	at com.gzoltar.cli.Main.main(Main.java:40)

I have tried both online and offline instrumentation as shown here, and both produce a similar error on the runTestMethods command.

Steps to Reproduce

I am using the same MRE as in the previous issue, available here:

evosuite-example.tar.gz

The following steps reproduce the error (I am using java 8):

  1. Run mvn clean test
  2. Remove the old test methods file by runnning: rm unit_tests.txt
  3. Run mvn dependency:copy-dependencies to get dependencies
  4. Set the locations of the jar files with the commands:
    GZOLTAR_AGENT_JAR="$PWD/gzoltar/lib/gzoltaragent.jar"
    GZOLTAR_CLI_JAR="$PWD/gzoltar/lib/gzoltarcli.jar"
    HAMCREST_JAR="$PWD/target/dependency/hamcrest-core-1.3.jar"
    JUNIT_JAR="$PWD/target/dependency/junit-4.11.jar"
    EVOSUITE_JAR="$PWD/target/dependency/evosuite-standalone-runtime-1.0.6.jar"
    
  5. To successfully generate unit_tests.txt file, run:
java -cp "target/test-classes:$GZOLTAR_CLI_JAR:$EVOSUITE_JAR" com.gzoltar.cli.Main listTestMethods "target/test-classes" --outputFile "unit_tests.txt" --includes "*"
  1. Attempt to run the tests, producing the error, by running (this is online instrumentation, but offline seems to do the same):
java -javaagent:"$GZOLTAR_AGENT_JAR=destfile=gzoltar.ser,buildlocation=target/classes" -cp "target/test-classes/:$JUNIT_JAR:$GZOLTAR_CLI_JAR:$EVOSUITE_JAR" com.gzoltar.cli.Main runTestMethods --testMethods "unit_tests.txt" --collectCoverage

Environment:

  • OS: Ubuntu, Linux 24.04.1
  • Gzoltar version: 1.7.3 (latest)
  • Maven version: 3.8.7
  • Java version: 1.8.0_432

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions