8342930: New tests from JDK-8335912 are failing

Reviewed-by: jpai
This commit is contained in:
Henry Jen 2024-10-25 14:35:11 +00:00
parent 1e35da8d33
commit 5cbd578fbe
4 changed files with 27 additions and 11 deletions

View File

@ -118,6 +118,9 @@ Updates an existing JAR file.
.TP
\f[V]-x\f[R] or \f[V]--extract\f[R]
Extracts the named (or all) files from the archive.
If a file with the same name appears more than once in the archive, each
copy will be extracted, with later copies overwriting (replacing)
earlier copies unless -k is specified.
.TP
\f[V]-d\f[R] or \f[V]--describe-module\f[R]
Prints the module descriptor or automatic module name.
@ -212,6 +215,14 @@ time-zone format, to use for the timestamp of the entries, e.g.
.TP
\f[V]--dir\f[R] \f[I]DIR\f[R]
Directory into which the JAR file will be extracted.
.TP
\f[V]-k\f[R] or \f[V]--keep-old-files\f[R]
Do not overwrite existing files.
If a Jar file entry with the same name exists in the target directory,
the existing file will not be overwritten.
As a result, if a file appears more than once in an archive, later
copies will not overwrite earlier copies.
Also note that some file system can be case insensitive.
.SH OTHER OPTIONS
.PP
The following options are recognized by the \f[V]jar\f[R] command and

View File

@ -724,9 +724,6 @@ javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.ja
# core_tools
tools/jar/ExtractFilesTest.java 8342930 generic-all
tools/jar/MultipleManifestTest.java 8342930 generic-all
############################################################################

View File

@ -88,7 +88,7 @@ import jdk.test.lib.util.FileUtils;
" inflated: testfile1" + nl +
" inflated: testfile2" + nl;
rm("META-INF testfile1 testfile2");
Assertions.assertArrayEquals(baos.toByteArray(), output.getBytes());
assertOutputContains(output);
}
/**
@ -105,7 +105,7 @@ import jdk.test.lib.util.FileUtils;
" inflated: testfile2" + nl;
Assertions.assertEquals("testfile1", cat("testfile1"));
rm("META-INF testfile1 testfile2");
Assertions.assertArrayEquals(baos.toByteArray(), output.getBytes());
assertOutputContains(output);
}
/**
@ -123,7 +123,7 @@ import jdk.test.lib.util.FileUtils;
Assertions.assertEquals("", cat("testfile1"));
Assertions.assertEquals("testfile2", cat("testfile2"));
rm("META-INF testfile1 testfile2");
Assertions.assertArrayEquals(baos.toByteArray(), output.getBytes());
assertOutputContains(output);
}
/**
@ -141,7 +141,7 @@ import jdk.test.lib.util.FileUtils;
Assertions.assertEquals("", cat("testfile1"));
Assertions.assertEquals("", cat("testfile2"));
rm("META-INF testfile1 testfile2");
Assertions.assertArrayEquals(baos.toByteArray(), output.getBytes());
assertOutputContains(output);
}
/**
@ -159,7 +159,7 @@ import jdk.test.lib.util.FileUtils;
Assertions.assertEquals("testfile1", cat("testfile1"));
Assertions.assertEquals("", cat("testfile2"));
rm("META-INF testfile1 testfile2");
Assertions.assertArrayEquals(baos.toByteArray(), output.getBytes());
assertOutputContains(output);
}
/**
@ -175,10 +175,14 @@ import jdk.test.lib.util.FileUtils;
"testfile1" + nl +
"testfile2" + nl;
Assertions.assertArrayEquals(baos.toByteArray(), output.getBytes());
assertOutputContains(output);
Assertions.assertEquals("Warning: The --keep-old-files/-k/k option is not valid with current usage, will be ignored." + nl, err);
}
private void assertOutputContains(String expected) {
Assertions.assertTrue(baos.toString().contains(expected));
}
private Stream<Path> mkpath(String... args) {
return Arrays.stream(args).map(d -> Path.of(".", d.split("/")));
}

View File

@ -154,7 +154,7 @@ class MultipleManifestTest {
" inflated: entry1.txt" + nl +
" inflated: META-INF/MANIFEST.MF" + nl +
" inflated: entry2.txt" + nl;
Assertions.assertArrayEquals(baos.toByteArray(), output.getBytes());
assertOutputContains(output);
}
/**
@ -170,7 +170,7 @@ class MultipleManifestTest {
" inflated: entry1.txt" + nl +
" skipped: META-INF/MANIFEST.MF exists" + nl +
" inflated: entry2.txt" + nl;
Assertions.assertArrayEquals(baos.toByteArray(), output.getBytes());
assertOutputContains(output);
}
private String getManifestVersion() throws IOException {
@ -199,6 +199,10 @@ class MultipleManifestTest {
}
}
private void assertOutputContains(String expected) {
Assertions.assertTrue(baos.toString().contains(expected));
}
private void println() throws IOException {
System.out.println(new String(baos.toByteArray()));
}