author | darcy |
Wed, 03 Feb 2016 12:52:27 -0800 | |
changeset 35702 | 5f4ccee7dfb9 |
parent 23010 | 6dadb192ad81 |
child 35704 | 3751461bbb94 |
permissions | -rw-r--r-- |
12414
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
1 |
/* |
35702
5f4ccee7dfb9
8148916: Mark bug6400879.java as intermittently failing
darcy
parents:
23010
diff
changeset
|
2 |
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. |
12414
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
4 |
* |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
21596 | 7 |
* published by the Free Software Foundation. |
12414
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
8 |
* |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
14 |
* |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
18 |
* |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
21 |
* questions. |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
22 |
*/ |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
23 |
|
35702
5f4ccee7dfb9
8148916: Mark bug6400879.java as intermittently failing
darcy
parents:
23010
diff
changeset
|
24 |
/* |
5f4ccee7dfb9
8148916: Mark bug6400879.java as intermittently failing
darcy
parents:
23010
diff
changeset
|
25 |
* @test |
5f4ccee7dfb9
8148916: Mark bug6400879.java as intermittently failing
darcy
parents:
23010
diff
changeset
|
26 |
* @bug 6400879, 7100140 |
5f4ccee7dfb9
8148916: Mark bug6400879.java as intermittently failing
darcy
parents:
23010
diff
changeset
|
27 |
* @summary Tests that Start/Stop sequence doesn't hang |
5f4ccee7dfb9
8148916: Mark bug6400879.java as intermittently failing
darcy
parents:
23010
diff
changeset
|
28 |
* @author Alexey Menkov |
5f4ccee7dfb9
8148916: Mark bug6400879.java as intermittently failing
darcy
parents:
23010
diff
changeset
|
29 |
* @run main bug6400879 |
5f4ccee7dfb9
8148916: Mark bug6400879.java as intermittently failing
darcy
parents:
23010
diff
changeset
|
30 |
* @key intermittent |
12414
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
31 |
*/ |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
32 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
33 |
import javax.sound.sampled.*; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
34 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
35 |
public class bug6400879 extends Thread { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
36 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
37 |
public static void main(String args[]) throws Exception { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
38 |
bug6400879 pThis = new bug6400879(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
39 |
//pThis.init(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
40 |
pThis.setDaemon(true); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
41 |
pThis.start(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
42 |
monitor(pThis); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
43 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
44 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
45 |
static final long BLOCK_TIMEOUT = 5000; // 5 sec |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
46 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
47 |
// monitors that pThis doesn't hang |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
48 |
public static void monitor(bug6400879 pThis) throws Exception { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
49 |
long prevLoop = -1; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
50 |
long prevTime = currentTimeMillis(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
51 |
while (pThis.isAlive()) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
52 |
if (pThis.loopCounter == prevLoop) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
53 |
if (currentTimeMillis() - prevTime > BLOCK_TIMEOUT) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
54 |
// block! |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
55 |
log("Test FAILED."); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
56 |
throw new RuntimeException("Test FAILED: thread has been blocked!"); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
57 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
58 |
} else { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
59 |
prevLoop = pThis.loopCounter; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
60 |
prevTime = currentTimeMillis(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
61 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
62 |
delay(500); // sleep for 0.5 sec |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
63 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
64 |
log("Test sucessfully passed."); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
65 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
66 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
67 |
volatile long loopCounter = 0; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
68 |
final long LOOPS_PER_LINE = 100; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
69 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
70 |
public void run() { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
71 |
SourceDataLine line = null; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
72 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
73 |
DataLine.Info line_info = new DataLine.Info(SourceDataLine.class, null); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
74 |
Line.Info infos[] = AudioSystem.getSourceLineInfo(line_info); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
75 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
76 |
log("total " + infos.length + " lines"); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
77 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
78 |
for (int lineNum = 0; lineNum < infos.length; lineNum++) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
79 |
try { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
80 |
line = (SourceDataLine)AudioSystem.getLine(infos[lineNum]); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
81 |
log("testing line: " + line); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
82 |
line.open(line.getFormat()); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
83 |
for (int i=0; i<LOOPS_PER_LINE; i++) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
84 |
log("start->stop (" + i + ")"); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
85 |
line.start(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
86 |
line.stop(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
87 |
log(" - OK"); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
88 |
loopCounter++; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
89 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
90 |
line.close(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
91 |
line = null; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
92 |
} catch (LineUnavailableException e1) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
93 |
log("LineUnavailableException caught, test okay."); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
94 |
log(e1.getMessage()); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
95 |
} catch (SecurityException e2) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
96 |
log("SecurityException caught, test okay."); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
97 |
log(e2.getMessage()); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
98 |
} catch (IllegalArgumentException e3) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
99 |
log("IllegalArgumentException caught, test okay."); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
100 |
log(e3.getMessage()); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
101 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
102 |
if (line != null) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
103 |
line.close(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
104 |
line = null; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
105 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
106 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
107 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
108 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
109 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
110 |
|
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
111 |
// helper routines |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
112 |
static long startTime = currentTimeMillis(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
113 |
static long currentTimeMillis() { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
114 |
//return System.nanoTime() / 1000000L; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
115 |
return System.currentTimeMillis(); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
116 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
117 |
static void log(String s) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
118 |
long time = currentTimeMillis() - startTime; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
119 |
long ms = time % 1000; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
120 |
time /= 1000; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
121 |
long sec = time % 60; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
122 |
time /= 60; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
123 |
long min = time % 60; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
124 |
time /= 60; |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
125 |
System.out.println("" |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
126 |
+ (time < 10 ? "0" : "") + time |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
127 |
+ ":" + (min < 10 ? "0" : "") + min |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
128 |
+ ":" + (sec < 10 ? "0" : "") + sec |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
129 |
+ "." + (ms < 10 ? "00" : (ms < 100 ? "0" : "")) + ms |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
130 |
+ " (" + Thread.currentThread().getName() + ") " + s); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
131 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
132 |
static void delay(int millis) { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
133 |
try { |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
134 |
Thread.sleep(millis); |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
135 |
} catch (InterruptedException e) {} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
136 |
} |
ecf9766a6d55
7100140: [macosx] Test closed/javax/sound/sampled/DirectAudio/bug6400879.java is invalid
amenkov
parents:
diff
changeset
|
137 |
} |