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

RunTestMethods ClassCircularityError for evosuite generated tests #80

Open
DCallaz opened this issue Nov 21, 2024 · 0 comments
Open

RunTestMethods ClassCircularityError for evosuite generated tests #80

DCallaz opened this issue Nov 21, 2024 · 0 comments

Comments

@DCallaz
Copy link

DCallaz commented Nov 21, 2024

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
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

No branches or pull requests

1 participant