Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Mono support #29

Merged
merged 14 commits into from
Apr 22, 2016
Merged

Mono support #29

merged 14 commits into from
Apr 22, 2016

Conversation

asbjornu
Copy link
Member

@asbjornu asbjornu commented Apr 20, 2016

TODO

Overview

This PR adds a Travis build to ensure Linux/Mono compatibility and upgrades LibGit2Sharp to version 0.23.0-pre20150419160303 so we get the fixes in libgit2/libgit2sharp#1298.

GitTools.Testing

This PR depends on GitTools/GitTools.Testing#2 needs to be merged and released on NuGet, so that dependency can be updated.

When all of the above is figured out and fixed, it would be nice to have this merged and pre-released on NuGet, so I can go on to update GitVersion as well.

Upgrade NUnit from version 2.6.4 to version 3.2.1 and make ReSharper run the tests with NUnit 3.
Upgrade LibGit2Sharp from version 0.22.0 to version 0.23.0-pre20150419160303 and LibGit2Sharp.NativeBinaries from version 1.0.129 to version 1.0.137.
Supress CS0414: The private field 'field' is assigned but its value is never used.
Supress CS1701: Assuming assembly reference "Assembly Name GitTools#1" matches "Assembly Name GitTools#2", you may need to supply runtime policy.
Use Path.DirectorySeparatorChar instead of hard coded backslashes for improved Unix and Linux support.
If deleting a file ends up with a `FileNotFoundException` or deleting a directory ends up with a `DirectoryNotFoundException`, there's no reason for the operation to fail; the file or directory is gone and we shouldn't care why we can't delete it.
@asbjornu asbjornu force-pushed the feature/mono-support branch from 371ed87 to 20295a2 Compare April 20, 2016 08:50
@asbjornu
Copy link
Member Author

asbjornu commented Apr 20, 2016

@JakeGinnivan The only thing left to fix now are two tests failing on Travis (Linux) with something like this:

The provided expression
    should be
"/tmp/.git"
    but was
"/tmp/_4/.git"

On OS X they fail with something along these lines:

The provided expression
    should be
"/var/folders/_t/hkn5jvjd6blcf9tf8zv5cx8c0000gn/T/.git"
    but was
"/private/var/folders/_t/hkn5jvjd6blcf9tf8zv5cx8c0000gn/T/_5/.git"

Seems like Path.GetTempPath() returning a symlink on OS X is still a problem although mono/maccore#42 was merged 3 years ago.

Do you have any idea how we can make these temporary path tests a little more robust?

@dazinator
Copy link
Member

Was just curious to know the reason behind using the temp directory.. why not force a directory to be specified, or default to the current working dir?

@asbjornu
Copy link
Member Author

asbjornu commented Apr 20, 2016

@dazinator I think using temporary paths for testing is reasonable. Hard coding a path would be difficult to get right across different build environments, don't you agree? What I'm unsure of, is why the path is asserted in the first place. I don't understand the semantics of the assertion, so I'm unable to figure out another way to do it. Only @JakeGinnivan can help out there, I think.

@dazinator
Copy link
Member

dazinator commented Apr 20, 2016

@asbjornu - perhaps i'm mistaken but I would have thought using a path thats relative to the test projects output directory wouldn't be too difficult, and would avoid the use of the temp directory. I dont think the temp dir is bad per say, but Ive always preferred to keep assets under the checkout / working dir and not use global / system / shared directories when it can be avoided!

@asbjornu
Copy link
Member Author

@dazinator Good point. If you have time to spare, do you think you could contribute some time to fixing this in the few tests that are failing? You don't need to do a PR or anything; just fork the branch of this PR and push your stuff to your fork and I'll pull it into this PR after. That would be very much appreciated! ❤️

@dazinator
Copy link
Member

dazinator commented Apr 21, 2016

@asbjornu - The tests seem to fail because they are a little brittle.

Basically in the failing test - this happens

GitTools.Tests.Git.GitRepositoryFactoryTests.PicksAnotherDirectoryNameWhenDynamicRepoFolderTaken

Basically this tries to establish a folder name in the temp directory for the repo, based on the repo name. If the folder name is already taken it recursively appends a number - _N to the path and checks again, until it finds a folder name that that is available to put the repo.

The test is not expecting this to happen. So it expects it to be placed in the temp dir, without this number being appended to the path, but because on the system that is running the tests, the temp dir is probably polluted, it ends up not using the expected folder, and creates a unique folder by appending this number to the path instead.

So it's actually doing what it is meant to do, but the test is brittle and fails it.

This probably lends wait to the hazard of using system / global / shared directories during tests and not keeping things isolated!

I think it makes sense to switch away from using the temp dir as I have mentioned previously, but such a change would potentially impact GitVersion, so I have raised an issue over there to figure out what the consequence is if we swtiched: GitTools/GitVersion#822

Once that's clarified, i'd be happy to contribute :)

@JakeGinnivan JakeGinnivan merged commit 244cca3 into GitTools:master Apr 22, 2016
asbjornu added a commit to asbjornu/GitTools.Core that referenced this pull request May 13, 2016
Ignore tests that fail on Unix / Mono due to pathing problems, as explained in GitTools#29.
asbjornu added a commit to asbjornu/GitTools.Core that referenced this pull request May 13, 2016
Ignore tests that fail on Unix / Mono due to pathing problems, as explained in GitTools#29.
@asbjornu asbjornu mentioned this pull request May 13, 2016
@asbjornu
Copy link
Member Author

@dazinator I've ignored the failing tests in #31, but you're more than welcome to submit a PR that un-ignores the tests and fixes the underlying problem! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants