RunExamples.java revision 1132
0N/A * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A * @bug 6968063 7127924 0N/A * @summary provide examples of code that generate diagnostics 0N/A * @build ArgTypeCompilerFactory Example HTMLWriter RunExamples 0N/A * See CR 7127924 for info on why othervm is used. 0N/A * Utility to run selected or all examples, writing results to 0N/A * stdout, a plain text file or an HTML file. This program can be 0N/A * run standalone, or as a jtreg test. 0N/A * -examples dir directory of examples. Defaults to ${test.src}/examples 0N/A * -raw run examples with -XDrawDiagnostics 0N/A * -showFiles include text of source files in the output 0N/A * -verbose verbose output 0N/A * -o file write output to file: format will be HTML if 0N/A * file has .html extension; otherwise it will be plain text. 0N/A * default is to stdout 0N/A * -title string specify a title, only applies to HTML output 0N/A // use standard jtreg scratch directory: the current directory 0N/A /* VERY IMPORTANT NOTE. In jtreg mode, tmpDir is set to the 0N/A * jtreg scratch directory, which is the current directory. 0N/A * In case someone is faking jtreg mode, make sure to only 0N/A * clean tmpDir when it is reasonable to do so. 0N/A // special mode to show message keys and the types of the args that 0N/A error(
"Key " + k +
": no examples found");
0N/A * Get the complete set of examples to be checked. 0N/A * Clean the contents of a directory. text =
"Error reading " + f +
"; " +
ex;
// only show Output: header if also showing files html.
writeLine(
"div.file { background-color:#e0ffe0; margin-left:30px; margin-right:30px;\n" +
" padding: 3px; border: thin solid silver; }");
html.
writeLine(
"p.file { white-space: pre-wrap; font-family:monospace; margin: 0; }");
html.
writeLine(
"div.output { background-color:#e0e0ff; margin-left:30px; margin-right:30px;\n" +
" padding: 3px; border: thin solid silver; }");
html.
writeLine(
"p.output { white-space: pre-wrap; font-family:monospace; margin: 0; }");
+
" var item = document.getElementById(id);\n" +
" item.className=(item.className=='hidden')?'unhidden':'hidden';\n" (
row++ %
2 ==
0 ?
"even" :
"odd"));
text =
"Error reading " + f +
": " +
ex;
//html.writeEntity("©"); // only show Output: header if also showing files