This is an archive of the discontinued LLVM Phabricator instance.

Fixed frontend clang tests in windows read-only container
ClosedPublic

Authored by justice_adams on Aug 10 2018, 8:51 AM.

Details

Summary

When mounting LLVM source into a windows container in read-only mode, certain tests fail. Ideally, we want all these tests to pass so that developers can mount the same source folder into multiple (windows) containers simultaneously, allowing them to build/test the same source code using various different configurations simultaneously.

Fix: I've found that when attempting to open a file for writing on windows, if you don't have the correct permissions (trying to open a file for writing in a read-only folder), you get Access is denied. In llvm, we map this error message to a linux based error, see: https://github.com/llvm-mirror/llvm/blob/master/lib/Support/ErrorHandling.cpp

This is why we see "Permission denied" in our output as opposed to the expected "No such file or directory", thus causing the tests to fail.

I've changed the test locally to instead point to the root drive so that they can successfully bypass the Access is denied error when LLVM is mounted in as a read-only directory. This way, the test operate exactly the same, but we can get around the windows-complications of what error to expect in a read-only directory.

Diff Detail

Event Timeline

justice_adams created this revision.Aug 10 2018, 8:51 AM

@cfe-commits ping requesting a review on this patch

@cfe-commits Re-pinging this group to request a review on this patch

justice_adams edited the summary of this revision. (Show Details)Dec 13 2018, 8:51 AM
ormris added a subscriber: ormris.Dec 13 2018, 9:44 AM
stella.stamenova requested changes to this revision.Dec 14 2018, 10:57 AM
stella.stamenova added inline comments.
test/Frontend/output-failures.c
0–1

I don't think this is the right solution - more specifically, I don't think we should be blindly looking for a file in the root directory that we do not control and adding a new property in the configuration for it.

A better solution would be to use a %t file here (for example, %t.doesnotexist) and run your tests out of tree (see test_exec_root).

This revision now requires changes to proceed.Dec 14 2018, 10:57 AM

@stella.stamenova Good suggestion, I think you are right. I have updated the diff to use %t, that way any end-users can control the way their lit test work in a read-only mount by simply altering the test_exec_root in their config

stella.stamenova requested changes to this revision.Jan 23 2019, 1:51 PM

Thanks. You have to change a couple of the locations to '%T' though - '%t' is a file and '%T' is a directory - and you're using '%t' as a directory in a couple of the places.

This revision now requires changes to proceed.Jan 23 2019, 1:51 PM

@stella.stamenova Thanks for the input, what about now?

stella.stamenova accepted this revision.Jan 24 2019, 8:58 AM
This revision is now accepted and ready to land.Jan 24 2019, 8:58 AM

@stella.stamenova thanks for the review. I don't have commit access, would you mind committing this for me?

This revision was automatically updated to reflect the committed changes.

@thakis Thanks for the information, I had actually missed that.

The way this test is written, it needs to use a directory (so %T is "correct"), but to remove %T, it could be changed to use something like `%t.doesnotexist.somename``` instead. If you feel strongly about not introducing an additional usage of %T, I can look at making the change.

@stella.stamenova @thakis Thanks for the feedback all, I will go ahead and make this change to the way I'm representing directories, open a new diff for review, and add you as a reviewer.