-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8287902: UnreadableRB case in MissingResourceCauseTest is not working reliably on Windows #9061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… reliably on Windows
👋 Welcome back ihse! A progress list of the required criteria for merging this PR into |
Webrevs
|
/label i18n |
@magicus |
@@ -45,6 +45,9 @@ private static void callGetBundle(String baseName, | |||
|
|||
private static void callGetBundle(String baseName, Locale locale, | |||
Class<? extends Throwable> expectedCause) { | |||
if (baseName.equals("UnreadableRB") && System.getProperty("os.name").startsWith("Windows")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @magicus, perhaps we could do this check in the main
of this class (line 37) before calling the callGetBundle
for the UnreadableRB
base name? That way this method doesn't have to bother about which baseName
is being passed.
I had a quick look at how other tests do the OS name checks and they use the Platform.isWindows()
API which is part of the test library. I suspect you may not be able to use it here though since this MissingResourceCauseTest
class gets launched manually through the MissingResourceCauseTestRun
. So using System.getProperty
I think is fine. Nit - perhaps we could match this check to do whatever Platform.isWindows()
is doing (which seems to be checking that the os name starts with win
, ignoring the case).
I had quick look at the CI setup we have access to. It appears that this test passes there successfully on Windows. Could it be something to do with Windows version being used? |
Thanks for the investigation, Magnus. I believe it is a bug to include the Windows environment in refactoring the shell script to Java. Why it's been working? No idea. Could be |
@naotoj Yes, that could be a likely possibility. Perhaps the file were never created, or not in the expected place? |
I'd guess something like that too. Anyways, eliminating this unreliability in test is a good clean up. Approving the fix assuming Jai's comment is addressed. |
@magicus This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 76 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 975316e.
Your commit was automatically rebased without conflicts. |
The test
test/jdk/java/util/ResourceBundle/Control/MissingResourceCauseTest.java
verifies different failure modes of resource bundles. One of the failures is that the runner class,MissingResourceCauseTestRun.java
, creates a fileUnreadableRB
, and runschmod 000
on it, to make it unreadable by the test. Then MissingResourceCauseTest is called, and theUnreadableRB
file is removed.This does not work reliably on Windows. On msys2,
chmod
is essentially a no-op, so the file is not made unreadable, and hence the test fails. In my personal cygwin test environment, the chmod command does have some effect, but it is still not enough to make the file unreadable, and so the test fails.The test was originally a shell script test that got converted to Java in JDK-4354216. The original shell script code explicitly excluded Windows from testing. This was changed in the rewrite, for reasons I cannot determine.
What suprises me, though, is the "how can this ever has worked???" factor. Apparently the test passes on the current Cygwin setup on GHA. I have failed to reproduce the working conditions that makes a file actually unreadable for the owner on Windows, neither on my GHA test repo, nor locally. I've searched the web to figure out how to properly set file permissions on Windows to make the file unreadable, using Windows native tools, to no avail. I've even asked a Stack Overflow question; which as of yet is still unanswered.
Since I feel I've spent far more time than reasonable trying to get this to work properly, I suggest we instead skip the unreadable test on Windows. It is clearly unstable and highly depending on the Windows environment, the test was never originally supported or intended for Windows, and at the of the day, testing file unreadability is not an important regression test for JDK-4354216.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9061/head:pull/9061
$ git checkout pull/9061
Update a local copy of the PR:
$ git checkout pull/9061
$ git pull https://git.openjdk.org/jdk pull/9061/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9061
View PR using the GUI difftool:
$ git pr show -t 9061
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9061.diff