[crac] RFR: Convert CRaC tests from shell scripts to Java

Anton Kozlov akozlov at openjdk.org
Tue Mar 7 12:53:48 UTC 2023


On Fri, 24 Feb 2023 09:20:05 GMT, Radim Vansa <duke at openjdk.org> wrote:

> Right now this is a draft as it builds on top of https://github.com/openjdk/crac/pull/47
> 
> Please see `CracTest` javadoc for detailed info.

This looks really promising! Thank you very much for working on this!

I've asked folks to give a closer look to tests changes for any subtle semanitc change, etc.

test/jdk/jdk/crac/java/net/InetAddress/ResolveTest.java line 56:

> 54:  * @run driver jdk.test.lib.crac.CracTest
> 55:  */
> 56: public class ResolveTest implements CracTest {

Also, that's strange, byt when running tests in batch, I get a problem with docker tests. Apparently CracTest is not copied to the classes dir. When I rerun the test individually, it fails. But if I clean the jtreg workdir and run the test individually, it passes.


anton at mercury:~/proj/crac$ ~/Downloads/jtreg-6+1/bin/jtreg -nr -jdk:build/linux-x86_64-server-fastdebug/images/jdk/ test/jdk/jdk/crac/
Directory "JTwork" not found: creating
Test results: passed: 25; failed: 1
Results written to /home/anton/proj/crac/JTwork
Error: Some tests failed or other problems occurred.


JTwork/jdk/crac/java/net/InetAddress/ResolveTest.jtr:20:execStatus=Failed. Execution failed: `main' threw 
exception: java.util.concurrent.CancellationException


anton at mercury:~/proj/crac$ ~/Downloads/jtreg-6+1/bin/jtreg -nr -jdk:build/linux-x86_64-server-fastdebug/images/jdk/ test/jdk/jdk/crac/java/net/InetAddress/ResolveTest.java
Test results: failed: 1
Results written to /home/anton/proj/crac/JTwork
Error: Some tests failed or other problems occurred.



----------System.err:(21/1653)----------
Starting docker container:
docker run --rm -d --privileged --init --volume /home/anton/proj/crac/JTwork/classes/jdk/crac/java/net/InetAddress/ResolveTest.d:/test-classes/ --volume cr:/cr --volume /home/anton/proj/crac/build/linux-x86_64-server-fastdebug/images/jdk/lib/criu:/criu --env CRAC_CRIU_PATH=/criu --name crac-test --add-host some.test.hostname.example.com:192.168.12.34 jdk-internal:test-inet-address sleep 3600
Starting process to be checkpointed:
docker exec crac-test /jdk/bin/java -ea -cp /test-classes -XX:CRaCCheckpointTo=cr jdk.test.lib.crac.CracTest __run_test__ ResolveTest some.test.hostname.example.com /second-run
ERROR: Error: Could not find or load main class jdk.test.lib.crac.CracTest
ERROR: Caused by: java.lang.ClassNotFoundException: jdk.test.lib.crac.CracTest
java.util.concurrent.CancellationException
	at java.base/java.util.concurrent.CompletableFuture.cancel(CompletableFuture.java:2478)
	at ResolveTest.lambda$test$1(ResolveTest.java:85)
	at jdk.test.lib.crac.CracProcess$1.processLine(CracProcess.java:105)
	at jdk.test.lib.process.StreamPumper.lambda$run$0(StreamPumper.java:127)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at jdk.test.lib.process.StreamPumper.run(StreamPumper.java:127)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.lang.Thread.run(Thread.java:833)



anton at mercury:~/proj/crac$ ls JTwork/classes/jdk/crac/java/net/InetAddress/ResolveTest.d/jdk/test/lib/crac/CracTest.class
ls: cannot access 'JTwork/classes/jdk/crac/java/net/InetAddress/ResolveTest.d/jdk/test/lib/crac/CracTest.class': No such file or directory


anton at mercury:~/proj/crac$ ~/Downloads/jtreg-6+1/bin/jtreg -w:JTwork.resolve -nr -jdk:build/linux-x86_64-server-fastdebug/images/jdk/ test/jdk/jdk/crac/java/net/InetAddress/ResolveTest.java
Directory "JTwork.resolve" not found: creating
Test results: passed: 1
Results written to /home/anton/proj/crac/JTwork.resolve

test/lib/jdk/test/lib/crac/CracEngine.java line 4:

> 2: 
> 3: public enum CracEngine {
> 4:     CRIU("criu"),

This should be `criuengine`

-------------

PR: https://git.openjdk.org/crac/pull/50


More information about the crac-dev mailing list