-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow mounting a single directory without a name (#555)
* Allow mounting a single directory without a name To utilize `VZSingleDirectoryShare` which seems more stable than `VZMultipleDirectoryShare`. We've been having reports from users that mounted directories occasionally return "no such file" errors when building large projects. I took a stab at reproducing the issue by running https://github.com/devMEremenko/XcodeBenchmark in a mounted directory: ```bash tart run --dir=workdir-test:~/workspace-temp/XcodeBenchmark ventura-xcode ``` And I was able to reproduce the "no such file" error on the first try! After looking into the issue I decided to try `VZSingleDirectoryShare` as this PR changes and to my pleasant surprise it all worked like a charm the next run. So it seems there is a bug in `VZMultipleDirectoryShare` integration with virtiofs. Since in most cases users only mount a single directory it makes sense to allow doing it wihtout providing a `name`. So now it will be possible to run the following command: ```bash tart run --dir=~/workspace-temp/XcodeBenchmark ventura-xcode ``` Which will make `~/workspace-temp/XcodeBenchmark` available under `/Volumes/My Shared Files/` without any intermediate directories. * Reformat * Updated description
- Loading branch information
Showing
2 changed files
with
95 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import XCTest | ||
@testable import tart | ||
|
||
final class DirectoryShareTests: XCTestCase { | ||
func testNamedParsing() throws { | ||
let share = try DirectoryShare(parseFrom: "build:/Users/admin/build") | ||
XCTAssertEqual(share.name, "build") | ||
XCTAssertEqual(share.path, URL(filePath: "/Users/admin/build")) | ||
XCTAssertFalse(share.readOnly) | ||
} | ||
|
||
func testNamedReadOnlyParsing() throws { | ||
let share = try DirectoryShare(parseFrom: "build:/Users/admin/build:ro") | ||
XCTAssertEqual(share.name, "build") | ||
XCTAssertEqual(share.path, URL(filePath: "/Users/admin/build")) | ||
XCTAssertTrue(share.readOnly) | ||
} | ||
|
||
func testOptionalNameParsing() throws { | ||
let share = try DirectoryShare(parseFrom: "/Users/admin/build") | ||
XCTAssertNil(share.name) | ||
XCTAssertEqual(share.path, URL(filePath: "/Users/admin/build")) | ||
XCTAssertFalse(share.readOnly) | ||
} | ||
|
||
func testOptionalNameReadOnlyParsing() throws { | ||
let share = try DirectoryShare(parseFrom: "/Users/admin/build:ro") | ||
XCTAssertNil(share.name) | ||
XCTAssertEqual(share.path, URL(filePath: "/Users/admin/build")) | ||
XCTAssertTrue(share.readOnly) | ||
} | ||
} |