< prev index next >
test/tools/jlink/plugins/ExcludeVMPluginTest.java
Print this page
*** 153,177 ****
for (String arch : ARCHITECTURES) {
String[] winput = new String[input.length];
String[] woutput = new String[expectedOutput.length];
for (int i = 0; i < input.length; i++) {
! winput[i] = "/java.base/native" + arch + input[i];
}
for (int i = 0; i < expectedOutput.length; i++) {
! woutput[i] = "/java.base/native" + arch + expectedOutput[i];
}
doCheckVM(vm, winput, jvmcfg, woutput, expectdJvmCfg);
}
}
private void doCheckVM(String vm, String[] input, String jvmcfg, String[] expectedOutput, String expectdJvmCfg) throws Exception {
// Create a pool with jvm.cfg and the input paths.
byte[] jvmcfgContent = jvmcfg.getBytes();
ResourcePoolManager poolMgr = new ResourcePoolManager();
poolMgr.add(
! ResourcePoolEntry.create("/java.base/native/jvm.cfg",
ResourcePoolEntry.Type.NATIVE_LIB, jvmcfgContent));
// java.base/module-info.class is used by exclude vm plugin
// to get current osName(). We read it from jrt-fs and add a
// ResourcePoolEntry
--- 153,177 ----
for (String arch : ARCHITECTURES) {
String[] winput = new String[input.length];
String[] woutput = new String[expectedOutput.length];
for (int i = 0; i < input.length; i++) {
! winput[i] = "/java.base/lib" + arch + input[i];
}
for (int i = 0; i < expectedOutput.length; i++) {
! woutput[i] = "/java.base/lib" + arch + expectedOutput[i];
}
doCheckVM(vm, winput, jvmcfg, woutput, expectdJvmCfg);
}
}
private void doCheckVM(String vm, String[] input, String jvmcfg, String[] expectedOutput, String expectdJvmCfg) throws Exception {
// Create a pool with jvm.cfg and the input paths.
byte[] jvmcfgContent = jvmcfg.getBytes();
ResourcePoolManager poolMgr = new ResourcePoolManager();
poolMgr.add(
! ResourcePoolEntry.create("/java.base/lib/jvm.cfg",
ResourcePoolEntry.Type.NATIVE_LIB, jvmcfgContent));
// java.base/module-info.class is used by exclude vm plugin
// to get current osName(). We read it from jrt-fs and add a
// ResourcePoolEntry
*** 190,200 ****
config.put(ExcludeVMPlugin.NAME, vm);
}
p.configure(config);
ResourcePool out = p.transform(poolMgr.resourcePool(), outMgr.resourcePoolBuilder());
! String newContent = new String(out.findEntry("/java.base/native/jvm.cfg").get().contentBytes());
if (!expectdJvmCfg.equals(newContent)) {
throw new Exception("Got content " + newContent + " expected " + expectdJvmCfg);
}
--- 190,200 ----
config.put(ExcludeVMPlugin.NAME, vm);
}
p.configure(config);
ResourcePool out = p.transform(poolMgr.resourcePool(), outMgr.resourcePoolBuilder());
! String newContent = new String(out.findEntry("/java.base/lib/jvm.cfg").get().contentBytes());
if (!expectdJvmCfg.equals(newContent)) {
throw new Exception("Got content " + newContent + " expected " + expectdJvmCfg);
}
*** 207,217 ****
});
throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 2));
}
out.entries().forEach(md -> {
! if (md.path().equals("/java.base/native/jvm.cfg") ||
md.path().equals("/java.base/module-info.class")) {
return;
}
boolean contained = false;
for (String o : expectedOutput) {
--- 207,217 ----
});
throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 2));
}
out.entries().forEach(md -> {
! if (md.path().equals("/java.base/lib/jvm.cfg") ||
md.path().equals("/java.base/module-info.class")) {
return;
}
boolean contained = false;
for (String o : expectedOutput) {
< prev index next >