/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
*
* @bug 6336608 6511738
* @summary Basic unit test of OperatingSystemMXBean.getSystemLoadAverage()
* @author Mandy Chung
*/
/*
* This test tests the load average on linux and solaris. On Windows,
* getSystemLoadAverage() returns -1.
*
* Usage: GetSystemLoadAverage ["-1.0"]
* Arguments:
* o If no argument is specified, the test will verify the system load
* o Otherwise, the input argument must be "-1.0" indicating the
* expected system load average. This would only be the case when
* running on Windows.
*/
public class GetSystemLoadAverage {
// The system load average may be changing due to other jobs running.
// Allow some delta.
}
// On Linux or Solaris
checkLoadAvg();
} else {
// On Windows, the system load average is expected to be -1.0
} else {
if (loadavg != -1.0) {
throw new RuntimeException("Expected load average : -1.0" +
" but getSystemLoadAverage returned: " +
loadavg);
}
}
}
}
? "load averages:"
: "load average:";
// Obtain load average from OS command
// obtain load average from OperatingSystemMXBean
// verify if two values are close
throw new RuntimeException("Expected load average : " +
expected +
" but getSystemLoadAverage returned: " +
loadavg);
}
}
int c;
while ((c = r.read()) > 0) {
if (c != '\r') {
}
}
}
p.waitFor();
p.exitValue();
return output;
}
}