-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[tests] Disables tests on Apple mobile platforms #95757
Conversation
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos Issue DetailsDescriptionThe folder used to store files needs to have a shorter path on Apple mobile platforms as it exceeds 100 bytes ( Fixes #88049
|
/azp run runtime-ioslike,runtime-ioslikesimulator |
Azure Pipelines successfully started running 2 pipeline(s). |
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS | ||
// the folder used to store files needs to have a shorter path on Apple mobile platforms, | ||
// because the TempDirectory gets created in folder with a path longer than 100 bytes | ||
using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); |
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.
This should work on simulator and maybe catalyst, but should fail on device. As far as I know, there's no way to shrink the app bundle path (where your app gets a tmp directory).
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.
According to the TempDirectory
class, it is possible to specify the full path:
public TempDirectory(string path)
{
Path = path;
Directory.CreateDirectory(path);
}
One concern regarding this is permissions and possibility to create a particular directory.
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.
It seems that the #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
condition in the library test is evaluated as FALSE
on Apple mobile targets. Without the macro condition and with shorter temporary directory using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp");
the tests seem to work on Apple mobile targets.
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.
Thanks for making this change! Left some comments for you to consider.
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS | ||
// the folder used to store files needs to have a shorter path on Apple mobile platforms, | ||
// because the TempDirectory gets created in folder with a path longer than 100 bytes | ||
using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); |
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.
Can you please store the string "/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"
in a field, to avoid repetition?
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS | ||
// the folder used to store files needs to have a shorter path on Apple mobile platforms, | ||
// because the TempDirectory gets created in folder with a path longer than 100 bytes | ||
using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); |
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.
The /Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir
string is 68 chars long. In the tests where we use them, feel free to reduce the names of the files to even shorter lengths if needed (let's see if the CI does not complain). For example, instead of file.txt
, you can just use f
.
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.
I will try to shrink the path even more. One concern regarding this is permissions and possibility to create a particular directory.
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS | ||
// the folder used to store files needs to have a shorter path on Apple mobile platforms, | ||
// because the TempDirectory gets created in folder with a path longer than 100 bytes | ||
using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); |
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.
Do you have control over tempDir
? Could it just be tmp
, or t
?
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.
It is an arbitrary name and probably we can set even shorter name.
/azp run runtime-ioslike,runtime-ioslikesimulator |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run runtime-ioslikesimulator |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-ioslikesimulator |
Azure Pipelines successfully started running 1 pipeline(s). |
I don't think we should make this change, as Steve said this will never work on devices and even for simulators writing outside of the simulator-managed paths is a big no no (paths won't get cleaned up when the app is uninstalled etc). I think we should just disable these tests. |
The tests are already disabled. We can close this PR. |
@kotlarmilos can you please replace the ActiveIssue attributes with SkipOnPlatform and add a comment? |
The tests are failing on the |
/azp run runtime-ioslike,runtime-ioslikesimulator |
Azure Pipelines successfully started running 2 pipeline(s). |
Yes. |
/backport to release/7.0-staging |
Started backporting to release/7.0-staging: https://github.com/dotnet/runtime/actions/runs/7169718852 |
Description
This PR disables tests on Apple mobile platforms due to temporary directory that exceeds the path length limit.