|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
build directory support, final commitHi!
This commit finishes my changes to support build directory support. I have tested these change about 20 days[1] now with our testing framework and it seems to work. I know there should be more refactoring, but I postpone this when I (probably) have more time to do that. Please report bugs! As it's very likely if missed to port some tests. - twisti --- 2008-06-25 Christian Thalinger <twisti@...> * Harness.java (compileStringBase): Set target directory to build directory. (stripSourcePath): New method. (testNeedsToBeCompiled): Likewise. (parseTags): Likewise. (processUsesTag): Likewise. (processFilesTag): Likewise. (copyFiles): Likewise. (processSingleTest): Removed a lot of stuff now in the new methods above. (processFolder): Likewise. (compileFolder): Removed. (runFolder): Pass test in a LinkedHashSet. (compileTest): Removed. (compileFiles): New method. * Makefile.am (harness_files): Prefixed with $(srcdir). (harness): Added -d . * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. * configure.in (BUILDDIR): Added. * gnu/testlet/TestHarness.java (getBuildDirectory): New method. * gnu/testlet/TestReport.java (writeXml): Restart the timer after each write as this could cause problems on faulty NFS. * gnu/testlet/config.java.in (builddir): New variable. (getBuildDirectory): New method. * gnu/testlet/java/io/File/emptyFile.java, gnu/testlet/java/lang/Class/security.java, gnu/testlet/java/lang/Thread/security.java, gnu/testlet/java/security/AccessController/contexts.java: Use getBuildDirectory() instead of getSourceDirectory(). ? frozen_serial ? mauve.patch ? test.xml ? test.xsl Index: Harness.java =================================================================== RCS file: /cvs/mauve/mauve/Harness.java,v retrieving revision 1.29 diff -u -3 -p -r1.29 Harness.java --- Harness.java 7 Apr 2007 20:14:27 -0000 1.29 +++ Harness.java 25 Jun 2008 13:57:20 -0000 @@ -27,6 +27,8 @@ import gnu.testlet.config; import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; @@ -38,6 +40,8 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; +import java.util.LinkedHashSet; +import java.util.Iterator; import java.util.StringTokenizer; import java.util.Vector; @@ -59,7 +63,7 @@ public class Harness // The options to pass to the compiler, needs to be augmented by the // bootclasspath, which should be the classpath installation directory - private static String compileStringBase = "-proceedOnError -nowarn -1.5"; + private static String compileStringBase = "-proceedOnError -nowarn -1.5 -d " + config.builddir; // The writers for ecj's out and err streams. private static PrintWriter ecjWriterOut = null; @@ -429,6 +433,21 @@ public class Harness } /** + * Removes the config.srcdir + File.separatorChar from the start of + * a String. + * @param val the String + * @return the String with config.srcdir + File.separatorChar + * removed + */ + private static String stripSourcePath(String val) + { + if (val.startsWith(config.srcdir + File.separatorChar) + || val.startsWith(config.srcdir.replace('/', '.') + ".")) + val = val.substring(config.srcdir.length() + ".".length()); + return val; + } + + /** * Removes the "gnu.testlet." from the start of a String. * @param val the String * @return the String with "gnu.testlet." removed @@ -437,7 +456,7 @@ public class Harness { if (val.startsWith("gnu" + File.separatorChar + "testlet") || val.startsWith("gnu.testlet.")) - val = val.substring(12); + val = val.substring("gnu.testlet.".length()); return val; } @@ -898,7 +917,221 @@ public class Harness if (processSingleTest(cname) == 1) processFolder(cname); } - + + /** + * Checks if the corresponding classfile for the given test needs to + * be compiled, or exists and needs to be updated. + * + * @param test name or path of the test + * @return true if the classfile needs to be compiled + */ + private static boolean testNeedsToBeCompiled(String testname) + { + String filename = stripSourcePath(testname); + + if (filename.endsWith(".java")) + filename = + filename.substring(0, filename.length() - ".java".length()); + + String sourcefile = + config.srcdir + File.separatorChar + filename + ".java"; + String classfile = + config.builddir + File.separatorChar + filename + ".class"; + + File sf = new File(sourcefile); + File cf = new File(classfile); + + if (!sf.exists()) + throw new RuntimeException(sourcefile + " does not exists!"); + + if (!cf.exists()) + return true; + + return (sf.lastModified() > cf.lastModified()); + } + + /** + * Parse and process tags in the source file. + * + * @param sourcefile path of the source file + * @param filesToCompile LinkedHashSet of the files to compile + * + * @return true on success, false on error + */ + private static boolean parseTags(String sourcefile, LinkedHashSet filesToCompile, LinkedHashSet filesToCopy, LinkedHashSet testsToRun) + { + File f = new File(sourcefile); + + String base = f.getAbsolutePath(); + base = base.substring(0, base.lastIndexOf(File.separatorChar)); + + try + { + BufferedReader r = new BufferedReader(new FileReader(f)); + String line = null; + line = r.readLine(); + while (line != null) + { + if (line.contains("//")) + { + if (line.contains("Uses:")) + { + processUsesTag(line, base, filesToCompile, filesToCopy, testsToRun); + } + else if (line.contains("Files:")) + { + processFilesTag(line, base, filesToCopy); + } + else if (line.contains("not-a-test")) + { + // Don't run this one but parse it's tags. + testsToRun.remove(sourcefile); + } + } + else if (line.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; + } + + line = r.readLine(); + } + } + catch (IOException ioe) + { + // This shouldn't happen. + ioe.printStackTrace(); + return false; + } + + return true; + } + + /** + * Processes the // Uses: tag in a testlet's source. + * + * @param line string of the current source line + * @param base base directory of the current test + * @param filesToCompile LinkedHashSet of the current files to be compiled + */ + private static void processUsesTag(String line, String base, LinkedHashSet filesToCompile, LinkedHashSet filesToCopy, LinkedHashSet testsToRun) + { + StringTokenizer st = + new StringTokenizer(line.substring(line.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.length() - 6); + if (!depend.endsWith(".java")) + depend += ".java"; + + // Check if the current dependency needs to be compiled (NOTE: + // This check does not include inner classes). + if (testNeedsToBeCompiled(depend)) + { + // Add the current dependency. + filesToCompile.add(depend); + } + + // Now parse the tags of the dependency. + parseTags(depend, filesToCompile, filesToCopy, testsToRun); + } + } + + /** + * Processes the // Files: tag in a testlet's source. + * + * @param base base directory of the current test + * @param line string of the current source line + */ + private static void processFilesTag(String line, String base, LinkedHashSet filesToCopy) + { + StringTokenizer st = + new StringTokenizer(line.substring(line.indexOf("Files:") + 6)); + + while (st.hasMoreTokens()) + { + String src = base; + String t = st.nextToken(); + while (t.startsWith(".." + File.separator)) + { + t = t.substring(3); + src = + src.substring(0, src.lastIndexOf(File.separatorChar)); + } + src += File.separator + t; + + filesToCopy.add(src); + } + } + + /** + * Copy the given files from the source directory to the build + * directory. + * + * @param filesToCopy files to copy + * + * @return true on success, false on error + */ + private static boolean copyFiles(LinkedHashSet filesToCopy) + { + if (filesToCopy.size() == 0) + return true; + + for (Iterator it = filesToCopy.iterator(); it.hasNext(); ) + { + String src = (String) it.next(); + String dest = + config.builddir + File.separatorChar + stripSourcePath(src); + + try + { + File inputFile = new File(src); + File outputFile = new File(dest); + + // Only copy newer files. + if (inputFile.lastModified() <= outputFile.lastModified()) + continue; + + // Create directories up to the new file. + outputFile.getParentFile().mkdirs(); + + FileInputStream fis = new FileInputStream(inputFile); + FileOutputStream fos = new FileOutputStream(outputFile); + byte[] buf = new byte[1024]; + int i = 0; + + while((i = fis.read(buf)) != -1) + { + fos.write(buf, 0, i); + } + + fis.close(); + fos.close(); + } + catch (IOException ioe) + { + ioe.printStackTrace(); + return false; + } + } + + return true; + } + /** * This method is used to potentially run a single test. If runAnyway is * false we've reached here as a result of processing a directory and we @@ -912,6 +1145,10 @@ public class Harness */ private static int processSingleTest(String cname) { + LinkedHashSet filesToCompile = new LinkedHashSet(); + LinkedHashSet filesToCopy = new LinkedHashSet(); + LinkedHashSet testsToRun = new LinkedHashSet(); + // If the test should be excluded return -1, this is a signal // to processTest that it should quit. if (excludeTests.contains(cname)) @@ -919,14 +1156,14 @@ public class Harness // If it's not a single test, return 1, processTest will then try // to process it as a directory. - File jf = new File(cname + ".java"); + String sourcefile = config.srcdir + File.separatorChar + cname + ".java"; + File jf = new File(sourcefile); if (!jf.exists()) return 1; if (!compileTests) { - File cf = new File(cname + ".class"); - if (!cf.exists()) + if (testNeedsToBeCompiled(cname)) { // There is an uncompiled test, but the -nocompile option was given // so we just skip it @@ -935,90 +1172,24 @@ public class Harness } else { - // This section of code reads the file, looking for the "Uses" tag - // and compiles any files it finds listed there. - String base = jf.getAbsolutePath(); - base = base.substring(0, base.lastIndexOf(File.separatorChar)); - try - { - BufferedReader r = new BufferedReader(new FileReader(jf)); - 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.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 = - cname.substring(12). - 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++; - return -1; - } - } - break; - } - else if (temp.contains("not-a-test")) - return - 1; - } - 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. - } - + if (testNeedsToBeCompiled(cname)) + filesToCompile.add(sourcefile); + testsToRun.add(sourcefile); + + // Process all tags in the source file. + if (!parseTags(sourcefile, filesToCompile, filesToCopy, testsToRun)) + return -1; + + if (!copyFiles(filesToCopy)) + return -1; + // If compilation of the test fails, don't try to run it. - if (compileTest(cname + ".java") != 0) + if (!compileFiles(filesToCompile)) return -1; } runTest(cname); + return 0; } @@ -1031,10 +1202,12 @@ public class Harness */ private static void processFolder(String folderName) { - File dir = new File(folderName); + File dir = new File(config.srcdir + File.separatorChar + folderName); String dirPath = dir.getPath(); File[] files = dir.listFiles(); - StringBuffer sb = new StringBuffer(); + LinkedHashSet filesToCompile = new LinkedHashSet(); + LinkedHashSet filesToCopy = new LinkedHashSet(); + LinkedHashSet testsToRun = new LinkedHashSet(); String fullPath = null; boolean compilepassed = true; @@ -1044,173 +1217,82 @@ public class Harness return; // First, compile the list of .java files. - int count = 0; for (int i = 0; i < files.length; i++) { // Ignore the CVS folders. String name = files[i].getName(); fullPath = dirPath + File.separatorChar + name; - if (name.equals("CVS") || excludeTests.contains(fullPath)) + String testName = stripSourcePath(fullPath); + if (name.equals("CVS") || excludeTests.contains(testName)) continue; if (name.endsWith(".java") && - !excludeTests.contains(fullPath. - substring(0, fullPath.length() - 5))) + !excludeTests.contains(testName. + substring(0, testName.length() - 5))) { - 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); - 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. - } + if (testNeedsToBeCompiled(testName)) + filesToCompile.add(fullPath); + testsToRun.add(fullPath); + + // Process all tags in the source file. + if (!parseTags(fullPath, filesToCompile, filesToCopy, testsToRun)) + continue; } else { // Check if it's a folder, if so, call this method on it. if (files[i].isDirectory() && recursion - && ! excludeTests.contains(fullPath)) - processFolder(fullPath); + && ! excludeTests.contains(testName)) + processFolder(testName); } } + if (!copyFiles(filesToCopy)) + return; + // Exit if there were no .java files in this folder. - if (count == 0) + if (testsToRun.size() == 0) return; - // Ignore the .java files in top level gnu/teslet folder. - if (dirPath.equals("gnu" + File.separatorChar + "testlet")) + // Ignore the .java files in top level gnu/testlet folder. + if (dirPath.equals(config.srcdir + File.separatorChar + + "gnu" + File.separatorChar + "testlet")) return; // Now compile all those tests in a batch compilation, unless the // -nocompile option was used. if (compileTests) - compilepassed = compileFolder(sb, folderName); + compilepassed = compileFiles(filesToCompile); // And now run those tests. - runFolder(sb, compilepassed); - } - - private static boolean compileFolder(StringBuffer sb, String folderName) - { - int result = - 1; - compileString = compileStringBase + sb.toString(); - try - { - result = compile(); - } - catch (Exception e) - { - System.err.println("compilation exception"); - e.printStackTrace(); - result = - 1; - } - return result == 0; + runFolder(testsToRun, compilepassed); } /** * Runs all the tests in a folder. If the tests were compiled by * compileFolder, and the compilation failed, then we must check to * see if each individual test compiled before running it. - * @param sb the StringBuffer holding a space delimited list of all the - * tests to run + * + * @param testsToRun a list of all the tests to run * @param compilepassed true if the compilation step happened and all * tests passed or if compilation didn't happen (because of -nocompile). */ - private static void runFolder(StringBuffer sb, boolean compilepassed) + private static void runFolder(LinkedHashSet testsToRun, boolean compilepassed) { - StringTokenizer st = new StringTokenizer(sb.toString()); String nextTest = null; - boolean classExists; - while (st.hasMoreTokens()) + + for (Iterator it = testsToRun.iterator(); it.hasNext(); ) { - nextTest = st.nextToken(); - nextTest = nextTest.substring(0, nextTest.length() - 5); - classExists = (new File(nextTest + ".class")).exists(); - if (classExists - && (compilepassed || ! excludeTests.contains(nextTest + ".java"))) - runTest(nextTest); - } + nextTest = (String) it.next(); + nextTest = stripSourcePath(nextTest); + + if (!testNeedsToBeCompiled(nextTest) + && (compilepassed || !excludeTests.contains(nextTest))) + { + nextTest = nextTest.substring(0, nextTest.length() - 5); + runTest(nextTest); + } + } } /** @@ -1219,7 +1301,7 @@ public class Harness * @return the return value from the compiler * @throws Exception */ - public static int compile () throws Exception + public static int compile() throws Exception { /* * This code depends on the patch in Comment #10 in this bug @@ -1235,23 +1317,34 @@ public class Harness return ((Boolean) ecjMethod.invoke (ecjInstance, new Object[] { compileString, ecjWriterOut, ecjWriterErr})).booleanValue() ? 0 : -1; } - - private static int compileTest(String testName) + + /** + * Compile the given files. + * + * @param filesToCompile LinkedHashSet of the files to compile + * @return true if compilation was successful + */ + private static boolean compileFiles(LinkedHashSet filesToCompile) { - int result = -1; - // Compile the tests before running them, and if compilation fails report - // it as a test failure. + if (filesToCompile.size() == 0) + return true; + + int result = - 1; + compileString = compileStringBase; + for (Iterator it = filesToCompile.iterator(); it.hasNext(); ) + compileString += " " + (String) it.next(); try { - compileString = compileStringBase + " " + testName; result = compile(); } catch (Exception e) { - result = -1; + System.err.println("compilation exception"); + e.printStackTrace(); + result = - 1; } - return result; - } + return result == 0; + } /** * Returns true if the String argument passed is in the format of a Index: Makefile.am =================================================================== RCS file: /cvs/mauve/mauve/Makefile.am,v retrieving revision 1.34 diff -u -3 -p -r1.34 Makefile.am --- Makefile.am 12 Sep 2007 20:42:51 -0000 1.34 +++ Makefile.am 25 Jun 2008 13:57:20 -0000 @@ -14,19 +14,24 @@ EXTRA_DIST = Harness.java RunnerProcess VERSION = ${shell date +%F} harness_files = \ - Harness.java \ - RunnerProcess.java \ + $(srcdir)/Harness.java \ + $(srcdir)/RunnerProcess.java \ + $(srcdir)/gnu/testlet/TestHarness.java \ + $(srcdir)/gnu/testlet/Testlet.java \ + $(srcdir)/gnu/testlet/TestSecurityManager.java \ + $(srcdir)/gnu/testlet/ResourceNotFoundException.java \ + $(srcdir)/gnu/testlet/TestReport.java \ + $(srcdir)/gnu/testlet/TestResult.java \ + $(srcdir)/gnu/testlet/VisualTestlet.java \ + \ gnu/testlet/config.java \ - gnu/testlet/TestHarness.java \ - gnu/testlet/Testlet.java \ - gnu/testlet/TestSecurityManager.java \ - gnu/testlet/ResourceNotFoundException.java \ - gnu/testlet/TestReport.java \ - gnu/testlet/TestResult.java \ - gnu/testlet/VisualTestlet.java + \ + $(srcdir)/junit/framework/*.java \ + $(srcdir)/junit/runner/*.java \ + $(srcdir)/junit/textui/*.java harness: - $(JAVAC) $(harness_files) + $(JAVAC) -d . $(harness_files) all-local: harness Index: Makefile.in =================================================================== RCS file: /cvs/mauve/mauve/Makefile.in,v retrieving revision 1.44 diff -u -3 -p -r1.44 Makefile.in --- Makefile.in 12 Sep 2007 20:42:51 -0000 1.44 +++ Makefile.in 25 Jun 2008 13:57:20 -0000 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -68,6 +68,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUTO_COMPILE = @AUTO_COMPILE@ AWK = @AWK@ +BUILDDIR = @BUILDDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -167,16 +168,21 @@ TESTFLAGS = check_DATA = $(STAMP) EXTRA_DIST = Harness.java RunnerProcess.java gnu junit harness_files = \ - Harness.java \ - RunnerProcess.java \ + $(srcdir)/Harness.java \ + $(srcdir)/RunnerProcess.java \ + $(srcdir)/gnu/testlet/TestHarness.java \ + $(srcdir)/gnu/testlet/Testlet.java \ + $(srcdir)/gnu/testlet/TestSecurityManager.java \ + $(srcdir)/gnu/testlet/ResourceNotFoundException.java \ + $(srcdir)/gnu/testlet/TestReport.java \ + $(srcdir)/gnu/testlet/TestResult.java \ + $(srcdir)/gnu/testlet/VisualTestlet.java \ + \ gnu/testlet/config.java \ - gnu/testlet/TestHarness.java \ - gnu/testlet/Testlet.java \ - gnu/testlet/TestSecurityManager.java \ - gnu/testlet/ResourceNotFoundException.java \ - gnu/testlet/TestReport.java \ - gnu/testlet/TestResult.java \ - gnu/testlet/VisualTestlet.java + \ + $(srcdir)/junit/framework/*.java \ + $(srcdir)/junit/runner/*.java \ + $(srcdir)/junit/textui/*.java SUFFIXES = .class .java all: all-am @@ -266,6 +272,10 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -292,6 +302,8 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -441,20 +453,20 @@ uninstall-am: .PHONY: all all-am all-local am--refresh check check-am check-local \ clean clean-generic clean-local dist dist-all dist-bzip2 \ - dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distcleancheck distdir distuninstallcheck \ - dvi dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am uninstall uninstall-am + dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \ + distclean distclean-generic distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am harness: - $(JAVAC) $(harness_files) + $(JAVAC) -d . $(harness_files) all-local: harness Index: aclocal.m4 =================================================================== RCS file: /cvs/mauve/mauve/aclocal.m4,v retrieving revision 1.24 diff -u -3 -p -r1.24 aclocal.m4 --- aclocal.m4 12 Sep 2007 20:42:51 -0000 1.24 +++ aclocal.m4 25 Jun 2008 13:57:20 -0000 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,12 +11,15 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_if(m4_PACKAGE_VERSION, [2.61],, -[m4_fatal([this file was generated for autoconf 2.61. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -31,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -47,8 +50,10 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -320,7 +325,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -368,13 +373,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS] # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 +# serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -479,16 +484,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -777,7 +783,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) Index: configure =================================================================== RCS file: /cvs/mauve/mauve/configure,v retrieving revision 1.33 diff -u -3 -p -r1.33 configure --- configure 12 Sep 2007 20:42:51 -0000 1.33 +++ configure 25 Jun 2008 13:57:20 -0000 @@ -669,6 +669,7 @@ AUTO_COMPILE JAVA JAVAC SRCDIR +BUILDDIR TMPDIR MAIL_HOST LIBOBJS @@ -3545,6 +3546,8 @@ JAVAC=${JAVAC-javac} SRCDIR=`(cd $srcdir; pwd)` +BUILDDIR=`pwd` + # Check whether --with-tmpdir was given. @@ -4325,13 +4328,14 @@ AUTO_COMPILE!$AUTO_COMPILE$ac_delim JAVA!$JAVA$ac_delim JAVAC!$JAVAC$ac_delim SRCDIR!$SRCDIR$ac_delim +BUILDDIR!$BUILDDIR$ac_delim TMPDIR!$TMPDIR$ac_delim MAIL_HOST!$MAIL_HOST$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -4651,7 +4655,7 @@ echo "$as_me: executing $ac_file command # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ Index: configure.in =================================================================== RCS file: /cvs/mauve/mauve/configure.in,v retrieving revision 1.21 diff -u -3 -p -r1.21 configure.in --- configure.in 12 Sep 2007 20:42:52 -0000 1.21 +++ configure.in 25 Jun 2008 13:57:20 -0000 @@ -56,6 +56,8 @@ AC_SUBST(JAVAC) SRCDIR=`(cd $srcdir; pwd)` AC_SUBST(SRCDIR) +BUILDDIR=`pwd` +AC_SUBST(BUILDDIR) dnl Specify the tempdir. AC_ARG_WITH(tmpdir, Index: gnu/testlet/TestHarness.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/TestHarness.java,v retrieving revision 1.27 diff -u -3 -p -r1.27 TestHarness.java --- gnu/testlet/TestHarness.java 28 Dec 2006 18:31:50 -0000 1.27 +++ gnu/testlet/TestHarness.java 25 Jun 2008 13:57:20 -0000 @@ -281,6 +281,11 @@ public abstract class TestHarness { return srcdir; } + + public String getBuildDirectory () + { + return builddir; + } /** * Provide a directory name for writing temporary files. Index: gnu/testlet/TestReport.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/TestReport.java,v retrieving revision 1.4 diff -u -3 -p -r1.4 TestReport.java --- gnu/testlet/TestReport.java 19 May 2008 08:06:59 -0000 1.4 +++ gnu/testlet/TestReport.java 25 Jun 2008 13:57:20 -0000 @@ -77,6 +77,10 @@ public class TestReport Iterator results = testResults.iterator(); while (results.hasNext()) { + // Send a message to the Harness to let it know that we are + // still writing the XML file. + System.out.println("RunnerProcess:restart-timer"); + TestResult tr = (TestResult) results.next(); String[] failures = tr.getFailMessags(); String[] passes = tr.getPassMessages(); @@ -87,9 +91,12 @@ public class TestReport else out.write("'/>\n"); - for (int i = 0; i < failures.length; i++) + for (int i = 0; i < failures.length; i++) { + // Restart timer. + System.out.println("RunnerProcess:restart-timer"); out.write(" <failure>" + esc(failures[i]) + "</failure>\n"); - + } + if (tr.getException() != null) { Throwable t = tr.getException(); @@ -102,8 +109,11 @@ public class TestReport + "\n </failure>\n"); } - for (int i = 0; i < passes.length; i++) + for (int i = 0; i < passes.length; i++) { + // Restart timer. + System.out.println("RunnerProcess:restart-timer"); out.write(" <pass>" + esc(passes[i]) + "</pass>\n"); + } if (failures.length > 0 || passes.length > 0 || tr.getException() != null) Index: gnu/testlet/config.java.in =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/config.java.in,v retrieving revision 1.6 diff -u -3 -p -r1.6 config.java.in --- gnu/testlet/config.java.in 31 May 2006 17:21:42 -0000 1.6 +++ gnu/testlet/config.java.in 25 Jun 2008 13:57:20 -0000 @@ -28,6 +28,7 @@ public interface config public static final String ecjJar = "@ECJ_JAR@"; public static final String emmaString = "@EMMA@"; public static final String srcdir = "@SRCDIR@"; + public static final String builddir = "@BUILDDIR@"; public static final String tmpdir = "@TMPDIR@"; public static final String pathSeparator = "@CHECK_PATH_SEPARATOR@"; public static final String separator = "@CHECK_FILE_SEPARATOR@"; @@ -39,6 +40,7 @@ public interface config public abstract String getEcjJar (); public abstract String getEmmaString (); public abstract String getSourceDirectory (); + public abstract String getBuildDirectory (); public abstract String getTempDirectory (); public abstract String getPathSeparator (); public abstract String getSeparator (); Index: gnu/testlet/java/io/File/emptyFile.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/io/File/emptyFile.java,v retrieving revision 1.1 diff -u -3 -p -r1.1 emptyFile.java --- gnu/testlet/java/io/File/emptyFile.java 12 Nov 2005 21:24:42 -0000 1.1 +++ gnu/testlet/java/io/File/emptyFile.java 25 Jun 2008 13:57:20 -0000 @@ -39,7 +39,7 @@ public class emptyFile implements Testle { try { - String srcdirstr = harness.getSourceDirectory(); + String srcdirstr = harness.getBuildDirectory(); String pathseperator = File.separator; // the empty test file Index: gnu/testlet/java/lang/Class/security.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/lang/Class/security.java,v retrieving revision 1.6 diff -u -3 -p -r1.6 security.java --- gnu/testlet/java/lang/Class/security.java 6 Feb 2007 16:46:19 -0000 1.6 +++ gnu/testlet/java/lang/Class/security.java 25 Jun 2008 13:57:21 -0000 @@ -43,7 +43,7 @@ public class security implements Testlet // we need a class with a different loader for most of the // checks to occur. Class testClass = new URLClassLoader(new URL[] { - new File(harness.getSourceDirectory()).toURL()}, null).loadClass( + new File(harness.getBuildDirectory()).toURL()}, null).loadClass( getClass().getName()); harness.check(getClass().getClassLoader() != testClass.getClassLoader()); @@ -51,7 +51,7 @@ public class security implements Testlet // classes during tests and the extra checks will make us fail. testClass.getDeclaredClasses(); testClass.getDeclaredMethods(); - + // we need to restrict access to some packages for some of the // checks to occur. String oldrestrictions = Security.getProperty("package.access"); Index: gnu/testlet/java/lang/Thread/security.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/lang/Thread/security.java,v retrieving revision 1.6 diff -u -3 -p -r1.6 security.java --- gnu/testlet/java/lang/Thread/security.java 6 Feb 2007 16:46:19 -0000 1.6 +++ gnu/testlet/java/lang/Thread/security.java 25 Jun 2008 13:57:21 -0000 @@ -47,7 +47,7 @@ public class security implements Testlet // we need a different classloader for some of the checks to occur. Class testClass = new URLClassLoader(new URL[] { - new File(harness.getSourceDirectory()).toURL()}, null).loadClass( + new File(harness.getBuildDirectory()).toURL()}, null).loadClass( getClass().getName()); harness.check(getClass().getClassLoader() != testClass.getClassLoader()); Index: gnu/testlet/java/security/AccessController/contexts.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/security/AccessController/contexts.java,v retrieving revision 1.4 diff -u -3 -p -r1.4 contexts.java --- gnu/testlet/java/security/AccessController/contexts.java 9 Jun 2008 13:54:36 -0000 1.4 +++ gnu/testlet/java/security/AccessController/contexts.java 25 Jun 2008 13:57:21 -0000 @@ -71,8 +71,8 @@ public class contexts implements Testlet jars[0] = new File(base + "1.jar"); JarOutputStream jos = new JarOutputStream(new FileOutputStream(jars[0])); - copyClass(harness.getSourceDirectory(), jos, getClass()); - copyClass(harness.getSourceDirectory(), jos, TestHarness.class); + copyClass(harness.getBuildDirectory(), jos, getClass()); + copyClass(harness.getBuildDirectory(), jos, TestHarness.class); jos.close(); for (int i = 1; i < jars.length; i++) { |
|
|
Re: build directory support, final commitOn Wed, 2008-06-25 at 16:50 +0200, Christian Thalinger wrote:
> Hi! > > This commit finishes my changes to support build directory support. I > have tested these change about 20 days[1] now with our testing framework [1] http://c1.complang.tuwien.ac.at/pipermail/cacao-testresults/2008-June/thread.html |
| Free embeddable forum powered by Nabble | Forum Help |