Add a cap-std-apis feature with open/create
I'm trying to make more use of `cap-std` in our stack, and this will be a key enabling API. Actually a notable side benefit of this is that we don't need to teach the ostree C code itself to use `openat2`, we inherit cap-std's setup. All of the internal ostree code using the prior `openat()` should continue to work. I only did basic sanity checking of this; there may be bugs in other APIs.
This commit is contained in:
1 parent
4f7eea6aa7
commit
6940896c4e
5 files changed
+68
No files matched your search
@@ -26,6 +26,26 @@ fn should_commit_content_to_repo_and_list_refs_again() {
|
||||
assert_eq!(checksum, refs["test"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "cap-std-apis")]
|
||||
fn cap_std_commit() {
|
||||
let test_repo = CapTestRepo::new();
|
||||
|
||||
assert!(test_repo.repo.require_rev("nosuchrev").is_err());
|
||||
|
||||
let mtree = create_mtree(&test_repo.repo);
|
||||
let checksum = commit(&test_repo.repo, &mtree, "test");
|
||||
|
||||
assert_eq!(test_repo.repo.require_rev("test").unwrap(), checksum);
|
||||
|
||||
let repo2 = ostree::Repo::open_at_dir(&test_repo.dir, ".").unwrap();
|
||||
let refs = repo2
|
||||
.list_refs(None, NONE_CANCELLABLE)
|
||||
.expect("failed to list refs");
|
||||
assert_eq!(1, refs.len());
|
||||
assert_eq!(checksum, refs["test"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repo_traverse_and_read() {
|
||||
let test_repo = TestRepo::new();
|
||||
|
||||
Reference in new issue
Block a user