JDK-4772475 : TEST_BUG: 4 Regtest-test javax/sound/sampled tests fail with no sound device
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,solaris_8,windows_98
  • CPU: x86,sparc
  • Submitted: 2002-11-01
  • Updated: 2003-01-14
  • Resolved: 2003-01-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 b12Fixed
Related Reports
Relates :  
Relates :  
Description

Name: iaR10016			Date: 11/01/2002


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.4.2-b04
JCK            : RegTest-test
Platform[s]    : RedHat Linux 7.3, Windows 98, Solaris Sparc, Solaris x86
                 (the tests fail on any computer without a sound device)
Falling tests  : javax/sound/sampled/Clip/Duration/ClipDuration.java
                 javax/sound/sampled/Clip/Endpoint/ClipSetEndPoint.java
                 javax/sound/sampled/Controls/FloatControl/FloatControlBug.java
                 javax/sound/sampled/Controls/ReverbControl/SimpleMidiPlayer.java

It would be better if these tests performed any analysis whether a sound device existed on the computer.
Please, see bug 4742021 for more details.

Test source location:
=====================
/java/re/jdk/1.4.2/latest/ws/j2se/test/javax/sound/sampled/Clip/Duration/ClipDuration.java
/java/re/jdk/1.4.2/latest/ws/j2se/test/javax/sound/sampled/Clip/EndPoint/ClipSetEndPoint.java
/java/re/jdk/1.4.2/latest/ws/j2se/test/javax/sound/sampled/Controls/FloatControl/FloatControlBug.java
/java/re/jdk/1.4.2/latest/ws/j2se/test/javax/sound/sampled/Controls/ReverbControl/SimpleMidiPlayer.java

jtr file location:
==================
/net/jtgb4u4c.eng/export/sail15/results/mantis/b04/regtest/sparc/sol8_sparc_novo48/workDir/test/javax/sound/sampled/Clip/Duration/ClipDuration.jtr
/net/jtgb4u4c.eng/export/sail15/results/mantis/b04/regtest/sparc/sol8_sparc_novo48/workDir/test/javax/sound/sampled/Clip/EndPoint/ClipSetEndPoint.jtr
/net/jtgb4u4c.eng/export/sail15/results/mantis/b04/regtest/sparc/sol8_sparc_novo48/workDir/test/javax/sound/sampled/Controls/FloatControl/FloatControlBug.jtr
/net/jtgb4u4c.eng/export/sail15/results/mantis/b04/regtest/sparc/sol8_sparc_novo48/workDir/test/javax/sound/sampled/Controls/ReverbControl/SimpleMidiPlayer.jtr

How to reproduce:
=================
Run the following script (you may need to change its TESTJAVA and TEST_BASE variables)
on the machine which does not have a sound device

--- script start ---
#!/bin/sh
TESTJAVA="/net/jdk/export/disk8/local.java/jdk1.4.2/linux-i386"
TEST_BASE="/java/re/jdk/1.4.2/latest/ws/j2se/"
TEST_PATH="$TEST_BASE/test/javax/sound/sampled/Clip/Duration"
TEST_NAME="ClipDuration"
$TESTJAVA/bin/javac -d . $TEST_PATH/$TEST_NAME.java
$TESTJAVA/bin/java -showversion $TEST_NAME
--- script end ---

Test output
===========

java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b04)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b04, mixed mode)

javax.sound.sampled.LineUnavailableException: Audio Device Unavailable
 at com.sun.media.sound.HeadspaceMixer.nResume(Native Method)
 at com.sun.media.sound.HeadspaceMixer.implOpen(HeadspaceMixer.java:377)
 at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:286)
 at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:323)
 at com.sun.media.sound.MixerClip.open(MixerClip.java:156)
 at com.sun.media.sound.MixerClip.open(MixerClip.java:291)
 at ClipDuration.run(ClipDuration.java:33)
 at ClipDuration.main(ClipDuration.java:51)
Exception in thread "main" java.lang.Exception: Test threw exception
 at ClipDuration.main(ClipDuration.java:56)

Specific machine info:
======================
Hostname: novo48
OS: Solaris 8 (Sparc)

Hostname: Linux-17
OS: Windows 98

Hostname: linux-19
OS: RedHat Linux 7.3

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis-beta FIXED IN: mantis-beta INTEGRATED IN: mantis-b12 mantis-beta VERIFIED IN: mantis-beta
14-06-2004

SUGGESTED FIX add this code to all regression tests that use a soundcard: in main(): if (!isSoundcardInstalled()) { return; } add this method: /** * Returns true if at least one soundcard is correctly installed * on the system. * A soundcard is installed if a TargetDataLine exists * and it has formats. We cannot use the existence of * SourceDataLines, because the Java Sound Engine always reports * an available SourceDataLine, even if none is actually * accessible */ public static boolean isSoundcardInstalled() { boolean result = false; try { Mixer.Info[] mixers = AudioSystem.getMixerInfo(); for (int i=0; i<mixers.length; i++) { try { Mixer mixer = AudioSystem.getMixer(mixers[i]); Line.Info[] infos = mixer.getTargetLineInfo(); for (int ii = 0; ii<infos.length; ii++) { if (infos[ii] instanceof DataLine.Info) { DataLine.Info info = (DataLine.Info) infos[ii]; result = (info.getFormats().length > 0); if (result) break; } } } catch (Exception e1) { System.err.println(e1); } if (result) break; } } catch (Exception e2) { System.err.println(e2); } if (!result) { System.err.println("Soundcard does not exist or sound drivers not installed!"); System.err.println("This test requires sound drivers for execution."); } return result; }
11-06-2004

PUBLIC COMMENTS Regression tests should not fail if soundcard is not installed.
10-06-2004

EVALUATION ###@###.### 2002-11-22 As of discussion with SQA, reg tests should not fail if the hardware is not correctly set up. The tests need to be fixed so that they "pass" on machines without soundcard.
22-11-2002