Skip to content

Commit

Permalink
8346871: Improve robustness of java/util/zip/EntryCount64k.java test
Browse files Browse the repository at this point in the history
Reviewed-by: lancea
  • Loading branch information
jaikiran committed Dec 30, 2024
1 parent bd0fde7 commit 24c5ff7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/jdk/java/util/zip/EntryCount64k.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013 Google Inc. All rights reserved.
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -47,9 +48,12 @@
import jdk.test.lib.process.ProcessTools;

public class EntryCount64k {

private static final String MAIN_CLASS_MSG = "foo bar hello world Main";

public static class Main {
public static void main(String[] args) {
System.out.print("Main");
System.out.println(MAIN_CLASS_MSG);
}
}

Expand Down Expand Up @@ -162,7 +166,10 @@ static void checkCanRead(File zipFile, int entryCount) throws Throwable {
// Check java -jar
OutputAnalyzer a = ProcessTools.executeTestJava("-jar", zipFile.getName());
a.shouldHaveExitValue(0);
a.stdoutShouldMatch("\\AMain\\Z");
// expect the message from the application on stdout
a.stdoutContains(MAIN_CLASS_MSG);
// nothing is expected on stderr (apart from any probable deprecation
// warnings from the launcher/JVM)
a.stderrShouldMatchIgnoreDeprecatedWarnings("\\A\\Z");
}
}

0 comments on commit 24c5ff7

Please sign in to comment.