635 private boolean useBootClassPath(File classdir) throws TestClassException {
636 try {
637 String rel = locations.absBaseClsDir().toURI().relativize(classdir.toURI()).getPath();
638 return testSuite.useBootClassPath(rel);
639 } catch (TestSuite.Fault f) {
640 throw new TestClassException(f.toString());
641 }
642 }
643
644 enum PathKind {
645 BOOTCLASSPATH_APPEND,
646 CLASSPATH,
647 MODULEPATH,
648 MODULESOURCEPATH,
649 PATCHPATH,
650 SOURCEPATH
651 }
652
653 Map<PathKind, SearchPath> getCompilePaths(LibLocn libLocn, boolean multiModule, String module)
654 throws TestRunException {
655 SearchPath bcp = new SearchPath();
656 SearchPath cp = new SearchPath();
657 SearchPath mp = new SearchPath();
658 SearchPath msp = new SearchPath();
659 SearchPath pp = new SearchPath();
660 SearchPath sp = new SearchPath();
661
662 // Test:
663 if (libLocn == null || libLocn.name == null) {
664 if (multiModule) {
665 msp.append(locations.absTestSrcDir());
666 } else {
667 File testSrcDir = locations.absTestSrcDir(module);
668 sp.append(testSrcDir);
669 // Ideally, the source directory need only go on the source path
670 // but some tests rely on precompiled .class files existing in
671 // the source directory. Allow such legacy usage for package-
672 // oriented tests, and also put the source dir on classpath.
673 // Note: it is not enough to just put it on the classpath only
674 // in those cases where there are other items on the source path.
675 cp.append(testSrcDir);
676 }
677 }
678
679 if (!multiModule)
680 cp.append(locations.absTestClsDir());
681
682 if (useModulePath()) {
683 mp.append(locations.absTestModulesDir());
684 }
685
686 if (usePatchModules()) {
687 pp.append(locations.absTestPatchDir());
688 }
689
690 // Libraries:
691 if (libLocn != null) {
692 if (multiModule)
693 msp.append(libLocn.absSrcDir);
694 else if (module != null)
695 sp.append(new File(libLocn.absSrcDir, module));
696 }
697
698 if (module == null) {
699 sp.append(locations.absLibSrcList(LibLocn.Kind.PACKAGE));
700 }
|
635 private boolean useBootClassPath(File classdir) throws TestClassException {
636 try {
637 String rel = locations.absBaseClsDir().toURI().relativize(classdir.toURI()).getPath();
638 return testSuite.useBootClassPath(rel);
639 } catch (TestSuite.Fault f) {
640 throw new TestClassException(f.toString());
641 }
642 }
643
644 enum PathKind {
645 BOOTCLASSPATH_APPEND,
646 CLASSPATH,
647 MODULEPATH,
648 MODULESOURCEPATH,
649 PATCHPATH,
650 SOURCEPATH
651 }
652
653 Map<PathKind, SearchPath> getCompilePaths(LibLocn libLocn, boolean multiModule, String module)
654 throws TestRunException {
655 return getCompilePaths(libLocn, multiModule, module, null);
656 }
657 Map<PathKind, SearchPath> getCompilePaths(LibLocn libLocn, boolean multiModule, String module, File destDir)
658 throws TestRunException {
659 SearchPath bcp = new SearchPath();
660 SearchPath cp = new SearchPath();
661 SearchPath mp = new SearchPath();
662 SearchPath msp = new SearchPath();
663 SearchPath pp = new SearchPath();
664 SearchPath sp = new SearchPath();
665
666 // Test:
667 if (libLocn == null || libLocn.name == null) {
668 if (multiModule) {
669 msp.append(locations.absTestSrcDir());
670 } else {
671 File testSrcDir = locations.absTestSrcDir(module);
672 sp.append(testSrcDir);
673 // Ideally, the source directory need only go on the source path
674 // but some tests rely on precompiled .class files existing in
675 // the source directory. Allow such legacy usage for package-
676 // oriented tests, and also put the source dir on classpath.
677 // Note: it is not enough to just put it on the classpath only
678 // in those cases where there are other items on the source path.
679 cp.append(testSrcDir);
680 }
681 }
682
683 if (!multiModule) {
684 File f = locations.absTestClsDir();
685 if (f != null && destDir != null && !f.equals(destDir)) {
686 // We are compiling a library -- libraries cannot depend on classes provided by the test!
687 } else {
688 cp.append(locations.absTestClsDir());
689 }
690 }
691
692 if (useModulePath()) {
693 mp.append(locations.absTestModulesDir());
694 }
695
696 if (usePatchModules()) {
697 pp.append(locations.absTestPatchDir());
698 }
699
700 // Libraries:
701 if (libLocn != null) {
702 if (multiModule)
703 msp.append(libLocn.absSrcDir);
704 else if (module != null)
705 sp.append(new File(libLocn.absSrcDir, module));
706 }
707
708 if (module == null) {
709 sp.append(locations.absLibSrcList(LibLocn.Kind.PACKAGE));
710 }
|