mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8362087: Test containers/docker/ShareTmpDir.java intermittent fails
Reviewed-by: sgehwolf, cnorrbin
This commit is contained in:
parent
d7a3df6399
commit
929864b1a4
@ -66,17 +66,23 @@ public class ShareTmpDir {
|
||||
private static void test() throws Exception {
|
||||
File sharedtmpdir = new File("sharedtmpdir");
|
||||
File flag = new File(sharedtmpdir, "flag");
|
||||
File started = new File(sharedtmpdir, "started");
|
||||
File started1 = new File(sharedtmpdir, "started-1");
|
||||
File started2 = new File(sharedtmpdir, "started-2");
|
||||
sharedtmpdir.mkdir();
|
||||
flag.delete();
|
||||
started.delete();
|
||||
started1.delete();
|
||||
started2.delete();
|
||||
DockerRunOptions opts = new DockerRunOptions(imageName, "/jdk/bin/java", "WaitForFlagFile");
|
||||
Object lock = new Object();
|
||||
opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/");
|
||||
opts.addDockerOpts("--volume", sharedtmpdir.getAbsolutePath() + ":/tmp/");
|
||||
opts.addJavaOpts("-Xlog:os+container=trace", "-Xlog:perf+memops=debug", "-cp", "/test-classes/");
|
||||
|
||||
Thread t1 = new Thread() {
|
||||
public void run() {
|
||||
synchronized(lock) {
|
||||
opts.addClassOptions("1");
|
||||
}
|
||||
try { out1 = Common.run(opts); } catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
};
|
||||
@ -84,13 +90,16 @@ public class ShareTmpDir {
|
||||
|
||||
Thread t2 = new Thread() {
|
||||
public void run() {
|
||||
synchronized(lock) {
|
||||
opts.addClassOptions("2");
|
||||
}
|
||||
try { out2 = Common.run(opts); } catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
};
|
||||
t2.start();
|
||||
|
||||
while (!started.exists()) {
|
||||
System.out.println("Wait for at least one JVM to start");
|
||||
while (!started1.exists() || !started2.exists()) {
|
||||
System.out.println("Waiting for all two JVMs to start");
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,7 +28,7 @@ public class WaitForFlagFile {
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("WaitForFlagFile: Entering");
|
||||
|
||||
File started = new File("/tmp/started");
|
||||
File started = new File("/tmp/started-" + args.length);
|
||||
FileOutputStream fout = new FileOutputStream(started);
|
||||
fout.close();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user