Index: Harness.java =================================================================== RCS file: /cvs/mauve/mauve/Harness.java,v retrieving revision 1.29 diff -u -r1.29 Harness.java --- Harness.java 7 Apr 2007 20:14:27 -0000 1.29 +++ Harness.java 3 Aug 2007 20:48:51 -0000 @@ -258,11 +258,14 @@ { // User wants to use an input file to specify which tests to run. if (++i >= args.length) - throw new RuntimeException("No file path after '-file'. Exit"); + throw new RuntimeException("No argument after '-compile'. Exit"); if (args[i].equals("yes") || args[i].equals("true")) compileTests = true; else if (args[i].equals("no") || args[i].equals("false")) compileTests = false; + else + throw new RuntimeException("Missing compiles argument." + + " Must be one of ['yes', 'no', 'true', 'false']. Exit"); } else if (args[i].equals("-help") || args[i].equals("--help") || args[i].equals("-h")) @@ -785,7 +788,9 @@ runner_watcher.reset(); // Tell the RunnerProcess to run test with name testName - runner_out.println(testName); + // smckay: convert the path into a class name before passing + // to the RunnerProcess. This allows us to test vms running under wine + runner_out.println(testName.replace(File.separatorChar, '.')); while (true) { @@ -1060,89 +1065,92 @@ count ++; sb.append(' ' + fullPath); - // Read the file, looking for the Uses: tag, and adding - // any files listed to a list of files to be compiled. - // This section of code reads the file, looking for the "Uses" tag - // and compiles any files it finds listed there. - String base = dirPath; - try - { - BufferedReader r = new BufferedReader(new FileReader(fullPath)); - String temp = null; - temp = r.readLine(); - while (temp != null) - { - if (temp.contains("//")) - { - if (temp.contains("Uses:")) - { - StringTokenizer st = - new StringTokenizer - (temp.substring(temp.indexOf("Uses:") + 5)); - while (st.hasMoreTokens()) - { - String depend = base; - String t = st.nextToken(); - while (t.startsWith(".." + File.separator)) - { - t = t.substring(3); + if (compileTests) { + + // Read the file, looking for the Uses: tag, and adding + // any files listed to a list of files to be compiled. + // This section of code reads the file, looking for the "Uses" tag + // and compiles any files it finds listed there. + String base = dirPath; + try + { + BufferedReader r = new BufferedReader(new FileReader(fullPath)); + String temp = null; + temp = r.readLine(); + while (temp != null) + { + if (temp.contains("//")) + { + if (temp.contains("Uses:")) + { + StringTokenizer st = + new StringTokenizer + (temp.substring(temp.indexOf("Uses:") + 5)); + while (st.hasMoreTokens()) + { + String depend = base; + String t = st.nextToken(); + while (t.startsWith(".." + File.separator)) + { + t = t.substring(3); + depend = + depend.substring + (0, + depend.lastIndexOf(File.separatorChar)); + } + depend += File.separator + t; + if (depend.endsWith(".class")) depend = - depend.substring - (0, - depend.lastIndexOf(File.separatorChar)); - } - depend += File.separator + t; - if (depend.endsWith(".class")) - depend = - depend.substring(0, depend.length() - 6); - if (! depend.endsWith(".java")) - depend += ".java"; - - if (compileTest(depend) != 0) - { - // One of the dependencies failed to compile, - // so we report the test as failing and don't - // try to run it. - String shortName = fullPath.substring(12, fullPath.length() - 5). - replace(File.separatorChar, '.'); - - if (verbose) - { - System.out.println("TEST: " + shortName); - System.out.println(" FAIL: One of the " + - "dependencies failed to compile."); - } - else - { - System.out.println("FAIL: " + shortName); - System.out.println(" One of the " + - "dependencies failed to compile."); - } - total_test_fails++; - total_tests++; - sb.setLength(sb.length() - fullPath.length() - 1); - count --; - } - } - break; - } - else if (temp.contains("not-a-test")) - { - sb.setLength(sb.length() - fullPath.length() - 1); - count --; - } - } - else if (temp.contains("implements Testlet")) - // Don't read through the entire test once we've hit real code. - // Note that this doesn't work for all files, only ones that - // implement Testlet, but that is most files. - break; - temp = r.readLine(); - } - } - catch (IOException ioe) - { - // This shouldn't happen. + depend.substring(0, depend.length() - 6); + if (! depend.endsWith(".java")) + depend += ".java"; + + if (compileTest(depend) != 0) + { + // One of the dependencies failed to compile, + // so we report the test as failing and don't + // try to run it. + String shortName = fullPath.substring(12, fullPath.length() - 5). + replace(File.separatorChar, '.'); + + if (verbose) + { + System.out.println("TEST: " + shortName); + System.out.println(" FAIL: One of the " + + "dependencies failed to compile."); + } + else + { + System.out.println("FAIL: " + shortName); + System.out.println(" One of the " + + "dependencies failed to compile."); + } + total_test_fails++; + total_tests++; + sb.setLength(sb.length() - fullPath.length() - 1); + count --; + } + } + break; + } + else if (temp.contains("not-a-test")) + { + sb.setLength(sb.length() - fullPath.length() - 1); + count --; + } + } + else if (temp.contains("implements Testlet")) + // Don't read through the entire test once we've hit real code. + // Note that this doesn't work for all files, only ones that + // implement Testlet, but that is most files. + break; + temp = r.readLine(); + } + } + catch (IOException ioe) + { + // This shouldn't happen. + } } } else Index: RunnerProcess.java =================================================================== RCS file: /cvs/mauve/mauve/RunnerProcess.java,v retrieving revision 1.16 diff -u -r1.16 RunnerProcess.java --- RunnerProcess.java 26 Nov 2006 23:12:41 -0000 1.16 +++ RunnerProcess.java 3 Aug 2007 20:48:52 -0000 @@ -412,7 +412,7 @@ static void runAndReport(RunnerProcess harness, String testName) { // If this call to runtest hangs, Harness will terminate this process. - harness.runtest(testName.replace(File.separatorChar, '.')); + harness.runtest(testName); // If the test wasn't a real test, return and tell Harness so. if (harness.description.equals(NOT_A_TEST_DESCRIPTION)) Index: ChangeLog =================================================================== RCS file: /cvs/mauve/mauve/ChangeLog,v retrieving revision 1.2081 diff -u -r1.2081 ChangeLog --- ChangeLog 24 Jul 2007 19:38:31 -0000 1.2081 +++ ChangeLog 3 Aug 2007 20:48:51 -0000 @@ -1,3 +1,14 @@ +2007-08-03 Steve McKay + + * Harness.java (runTest): + Transform path to class name prior to passing to RunnerProcess. + * Harness.java (processFolder): + Don't try to compile "Uses:" resources when auto compilation is + disabled. + * Harness.java (setupHarness): + Update flags processing for "-compile" flag to require an argument. + Correct erroneous error message. + 2007-07-24 Joshua Sumali * gnu/testlet/java/util/logging/XMLFormatter/formatMessage.java: