diff --git a/makefile b/makefile index ae3da55383..4eaeafa092 100755 --- a/makefile +++ b/makefile @@ -1474,13 +1474,20 @@ ifeq ($(continuations),true) $(build)/compile-x86-asm.o: $(src)/continuations-x86.$(asm-format) endif -$(build)/run-tests.sh: $(test-classes) makefile +$(build)/run-tests.sh: $(test-classes) makefile $(build)/extra-dir/multi-classpath-test.txt $(build)/test/multi-classpath-test.txt echo 'cd $$(dirname $$0)' > $(@) echo "sh ./test.sh 2>/dev/null \\" >> $(@) - echo "$(shell echo $(library-path) | sed 's|$(build)|\.|g') ./$(name)-unittest${exe-suffix} ./$(notdir $(test-executable)) $(mode) \"-Djava.library.path=. -cp test\" \\" >> $(@) + echo "$(shell echo $(library-path) | sed 's|$(build)|\.|g') ./$(name)-unittest${exe-suffix} ./$(notdir $(test-executable)) $(mode) \"-Djava.library.path=. -cp test:extra-dir\" \\" >> $(@) echo "$(call class-names,$(test-build),$(filter-out $(test-support-classes), $(test-classes))) \\" >> $(@) echo "$(continuation-tests) $(tail-tests)" >> $(@) +$(build)/extra-dir/multi-classpath-test.txt: + mkdir -p $(build)/extra-dir + echo "$@" > $@ + +$(build)/test/multi-classpath-test.txt: + echo "$@" > $@ + $(build)/test.sh: $(test)/test.sh cp $(<) $(@) diff --git a/test/Misc.java b/test/Misc.java index 91195d5f13..b0fde2d44b 100644 --- a/test/Misc.java +++ b/test/Misc.java @@ -1,3 +1,7 @@ +import java.io.IOException; +import java.net.URL; +import java.util.Enumeration; + public class Misc { private static class μClass { public int μField; @@ -262,6 +266,27 @@ public class Misc { expect((Protected.class.getModifiers() & java.lang.reflect.Modifier.PUBLIC) == 0); + + try { + int count = 0; + boolean test = false, extraDir = false; + ClassLoader loader = Misc.class.getClassLoader(); + Enumeration resources = loader.getResources("multi-classpath-test.txt"); + while (resources.hasMoreElements()) { + ++count; + String url = resources.nextElement().toString(); + if (url.contains("extra-dir")) { + extraDir = true; + } else if (url.contains("test")) { + test = true; + } + } + expect(count == 2); + expect(test); + expect(extraDir); + } catch (IOException e) { + throw new RuntimeException(e); + } } protected class Protected { }