Revision: 5386 http://jnode.svn.sourceforge.net/jnode/?rev=5386&view=rev Author: crawley Date: 2009-05-03 04:18:52 +0000 (Sun, 03 May 2009)
Log Message: ----------- Change the way we deal with testspec pathnames so that absolute names will work in the 'sandbox'. Modified Paths: -------------- trunk/shell/src/test/org/jnode/test/shell/harness/TestHarness.java trunk/shell/src/test/org/jnode/test/shell/harness/TestSpecificationParser.java Modified: trunk/shell/src/test/org/jnode/test/shell/harness/TestHarness.java =================================================================== --- trunk/shell/src/test/org/jnode/test/shell/harness/TestHarness.java 2009-05-03 04:17:51 UTC (rev 5385) +++ trunk/shell/src/test/org/jnode/test/shell/harness/TestHarness.java 2009-05-03 04:18:52 UTC (rev 5386) @@ -123,7 +123,11 @@ for (int i = firstArg; i < args.length; i++) { String arg = args[i]; try { - specs = loadTestSetSpecification(arg, useResources ? "/" : "."); + File specFile = new File(arg); + if (useResources && !specFile.isAbsolute()) { + specFile = new File("/", arg); + } + specs = loadTestSetSpecification(specFile); if (specs != null) { execute(specs); } @@ -159,24 +163,23 @@ } } - public TestSetSpecification loadTestSetSpecification(String specName, String base) throws Exception { + public TestSetSpecification loadTestSetSpecification(File specFile) throws Exception { TestSpecificationParser parser = new TestSpecificationParser(); InputStream is = null; - File file = new File(base, specName); try { if (useResources) { - String resourceName = file.getPath(); + String resourceName = specFile.getPath(); is = this.getClass().getResourceAsStream(resourceName); if (is == null) { report("Cannot find resource for '" + resourceName + "'"); return null; } } else { - is = new FileInputStream(file); + is = new FileInputStream(specFile); } - return parser.parse(this, is, file.getParent()); + return parser.parse(this, is, specFile.getParent()); } catch (Exception ex) { - diagnose(ex, specName); + diagnose(ex, specFile.getPath()); return null; } finally { if (is != null) { Modified: trunk/shell/src/test/org/jnode/test/shell/harness/TestSpecificationParser.java =================================================================== --- trunk/shell/src/test/org/jnode/test/shell/harness/TestSpecificationParser.java 2009-05-03 04:17:51 UTC (rev 5385) +++ trunk/shell/src/test/org/jnode/test/shell/harness/TestSpecificationParser.java 2009-05-03 04:18:52 UTC (rev 5386) @@ -75,7 +75,11 @@ } else if (name.equals("include")) { String specName = extractAttribute(argChild, "setName"); // (indirectly recursive) - TestSetSpecification included = harness.loadTestSetSpecification(specName, base); + File includedFile = new File(specName); + if (!includedFile.isAbsolute()) { + includedFile = new File(base, specName); + } + TestSetSpecification included = harness.loadTestSetSpecification(includedFile); if (included != null) { res.addTestSetSpecification(included); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf _______________________________________________ Jnode-svn-commits mailing list Jnode-svn-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits