diff --git a/Cargo.toml b/Cargo.toml index a13c1b1bf2f..d63f0313aeb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,8 @@ delog = "0.1.0" cbor-smol = { version = "0.5", features = ["heapless-bytes-v0-3"] } heapless-bytes = { version = "0.3.0" } interchange = "0.3.0" -littlefs2 = "0.4.0" +littlefs2 = "0.5.0" +littlefs2-core = { version = "0.1", features = ["heapless-bytes03"] } p256-cortex-m4 = { version = "0.1.0-alpha.6", features = ["prehash", "sec1-signatures"] } salty = { version = "0.3.0", features = ["cose"] } serde-indexed = "0.1.0" @@ -145,6 +146,3 @@ test-attestation-cert-ids = [] [package.metadata.docs.rs] features = ["serde-extensions", "virt"] rustdoc-args = ["--cfg", "docsrs"] - -[patch.crates-io] -littlefs2 = { git = "https://github.com/sosthene-nitrokey/littlefs2.git", rev = "2b45a7559ff44260c6dd693e4cb61f54ae5efc53" } diff --git a/src/service.rs b/src/service.rs index 57da1502f2d..16dbe3a5f17 100644 --- a/src/service.rs +++ b/src/service.rs @@ -1,8 +1,4 @@ -use littlefs2::{ - object_safe::DynFilesystem, - path, - path::{Path, PathBuf}, -}; +use littlefs2_core::{path, DynFilesystem, Path, PathBuf}; use rand_chacha::ChaCha8Rng; pub use rand_core::{RngCore, SeedableRng}; @@ -122,7 +118,7 @@ impl ServiceResources

{ } pub fn trussed_filestore(&mut self) -> ClientFilestore { - ClientFilestore::new(PathBuf::from("trussed"), self.platform.store()) + ClientFilestore::new(PathBuf::from(path!("trussed")), self.platform.store()) } pub fn keystore(&mut self, client_id: PathBuf) -> Result> { @@ -182,7 +178,7 @@ impl ServiceResources

{ #[cfg(feature = "crypto-client-attest")] Request::Attest(request) => { let mut attn_keystore: ClientKeystore = ClientKeystore::new( - PathBuf::from("attn"), + PathBuf::from(path!("attn")), self.rng().map_err(|_| Error::EntropyMalfunction)?, full_store, ); @@ -419,7 +415,7 @@ impl ServiceResources

{ recursively_list(fs, entry.path()); } if entry.file_type().is_file() { - let _contents = fs.read::<256>(entry.path()).unwrap(); + let _contents = fs.read::>(entry.path()).unwrap(); // info_now!("{} ?= {}", entry.metadata().len(), contents.len()).ok(); // info_now!("{:?}", &contents).ok(); } @@ -858,7 +854,7 @@ impl Service

{ syscall: S, interrupt: Option<&'static InterruptFlag>, ) -> Result, Error> { - ClientBuilder::new(client_id) + ClientBuilder::new(PathBuf::try_from(client_id).unwrap()) .interrupt(interrupt) .prepare(self) .map(|p| p.build(syscall)) @@ -872,7 +868,7 @@ impl Service

{ client_id: &str, interrupt: Option<&'static InterruptFlag>, ) -> Result, Error> { - ClientBuilder::new(client_id) + ClientBuilder::new(PathBuf::try_from(client_id).unwrap()) .interrupt(interrupt) .prepare(self) .map(|p| p.build(self)) @@ -885,7 +881,7 @@ impl Service

{ client_id: &str, interrupt: Option<&'static InterruptFlag>, ) -> Result, Error> { - ClientBuilder::new(client_id) + ClientBuilder::new(PathBuf::try_from(client_id).unwrap()) .interrupt(interrupt) .prepare(&mut self) .map(|p| p.build(self)) diff --git a/src/store.rs b/src/store.rs index 2908f0ac54e..a8d77a0bc7c 100644 --- a/src/store.rs +++ b/src/store.rs @@ -75,7 +75,7 @@ use littlefs2::{driver::Storage, fs::Filesystem}; use crate::error::Error; -use crate::types::{Bytes, Location, PathBuf}; +use crate::types::{Bytes, Location}; #[allow(unused_imports)] use littlefs2::{ fs::{DirEntry, Metadata}, @@ -492,24 +492,10 @@ macro_rules! store { }; } -// TODO: replace this with "fs.create_dir_all(path.parent())" pub fn create_directories(fs: &dyn DynFilesystem, path: &Path) -> Result<(), Error> { - let path_bytes = path.as_ref().as_bytes(); - - for i in 0..path_bytes.len() { - if path_bytes[i] == b'/' { - let dir_bytes = &path_bytes[..i]; - let dir = PathBuf::from(dir_bytes); - // let dir_str = core::str::from_utf8(dir).unwrap(); - // fs.create_dir(dir).map_err(|_| Error::FilesystemWriteFailure)?; - match fs.create_dir(&dir) { - Err(littlefs2::io::Error::EntryAlreadyExisted) => {} - Ok(()) => {} - error => { - panic!("{:?}", &error); - } - } - } + if let Some(parent) = path.parent() { + fs.create_dir_all(&parent) + .map_err(|_| Error::FilesystemWriteFailure)?; } Ok(()) } @@ -525,7 +511,6 @@ pub fn read( store .fs(location) .read(path) - .map(From::from) .map_err(|_| Error::FilesystemReadFailure) } @@ -581,7 +566,7 @@ pub fn metadata( debug_now!("checking existence of {}", &path); match store.fs(location).metadata(path) { Ok(metadata) => Ok(Some(metadata)), - Err(littlefs2::io::Error::NoSuchEntry) => Ok(None), + Err(littlefs2::io::Error::NO_SUCH_ENTRY) => Ok(None), Err(_) => Err(Error::FilesystemReadFailure), } } diff --git a/src/store/certstore.rs b/src/store/certstore.rs index 54352b68d0f..0a0be8bb877 100644 --- a/src/store/certstore.rs +++ b/src/store/certstore.rs @@ -1,4 +1,4 @@ -use littlefs2::{path, path::PathBuf}; +use littlefs2_core::{path, PathBuf}; use rand_chacha::ChaCha8Rng; use crate::{ @@ -66,7 +66,7 @@ impl ClientCertstore { let mut path = PathBuf::new(); path.push(&self.client_id); path.push(path!("x5c")); - path.push(&PathBuf::from(id.hex().as_slice())); + path.push(&id.hex_path()); path } diff --git a/src/store/counterstore.rs b/src/store/counterstore.rs index 1b14c82d35f..7cbbcd95a35 100644 --- a/src/store/counterstore.rs +++ b/src/store/counterstore.rs @@ -1,4 +1,4 @@ -use littlefs2::{path, path::PathBuf}; +use littlefs2_core::{path, PathBuf}; use rand_chacha::ChaCha8Rng; use crate::{ @@ -31,7 +31,7 @@ impl ClientCounterstore { let mut path = PathBuf::new(); path.push(&self.client_id); path.push(path!("ctr")); - path.push(&PathBuf::from(id.hex().as_slice())); + path.push(&id.hex_path()); path } diff --git a/src/store/filestore.rs b/src/store/filestore.rs index 12cf2fffa00..4a813318805 100644 --- a/src/store/filestore.rs +++ b/src/store/filestore.rs @@ -8,7 +8,7 @@ use crate::{ types::{Location, Message, UserAttribute}, Bytes, }; -use littlefs2::path; +use littlefs2_core::{path, DirEntry, Metadata, Path, PathBuf}; #[derive(Clone)] pub struct ReadDirState { @@ -25,11 +25,6 @@ pub struct ReadDirFilesState { user_attribute: Option, } -use littlefs2::{ - fs::{DirEntry, Metadata}, - path::{Path, PathBuf}, -}; - pub struct ClientFilestore where S: Store, @@ -81,7 +76,7 @@ impl ClientFilestore { // oh oh oh .unwrap(); let dat_offset = "/dat/".len(); - PathBuf::from(&bytes[end_of_namespace + 1 + offset + dat_offset..]) + PathBuf::try_from(&bytes[end_of_namespace + 1 + offset + dat_offset..]).unwrap() } } @@ -204,7 +199,7 @@ impl ClientFilestore { // `read_dir_and_then` wants to see Results (although we naturally have an Option // at this point) }) - .ok_or(littlefs2::io::Error::Io) + .ok_or(littlefs2_core::Error::IO) }) .ok()) } @@ -241,7 +236,7 @@ impl ClientFilestore { (entry, read_dir_state) }) - .ok_or(littlefs2::io::Error::Io) + .ok_or(littlefs2_core::Error::IO) }) .ok()) } @@ -268,14 +263,17 @@ impl ClientFilestore { // take first entry that meets requirements .find(|(_, entry)| { if let Some(user_attribute) = user_attribute.as_ref() { + let mut buffer = UserAttribute::new(); + buffer.resize_to_capacity(); let mut path = dir.clone(); path.push(entry.file_name()); let attribute = fs - .attribute(&path, crate::config::USER_ATTRIBUTE_NUMBER) + .attribute(&path, crate::config::USER_ATTRIBUTE_NUMBER, &mut buffer) .unwrap(); if let Some(attribute) = attribute { - user_attribute == attribute.data() + user_attribute.len() == attribute.total_size() + && user_attribute == attribute.data() } else { false } @@ -295,7 +293,7 @@ impl ClientFilestore { // `read_dir_and_then` wants to see Results (although we naturally have an Option // at this point) }) - .ok_or(littlefs2::io::Error::Io) + .ok_or(littlefs2_core::Error::IO) }) .ok() .map(|(i, data)| { @@ -335,13 +333,16 @@ impl ClientFilestore { // take first entry that meets requirements .find(|(_, entry)| { if let Some(user_attribute) = user_attribute.as_ref() { + let mut buffer = UserAttribute::new(); + buffer.resize_to_capacity(); let mut path = real_dir.clone(); path.push(entry.file_name()); let attribute = fs - .attribute(&path, crate::config::USER_ATTRIBUTE_NUMBER) + .attribute(&path, crate::config::USER_ATTRIBUTE_NUMBER, &mut buffer) .unwrap(); if let Some(attribute) = attribute { - user_attribute == attribute.data() + user_attribute.len() == attribute.total_size() + && user_attribute == attribute.data() } else { false } @@ -355,7 +356,7 @@ impl ClientFilestore { (i, data) }) // convert Option into Result, again because `read_dir_and_then` expects this - .ok_or(littlefs2::io::Error::Io) + .ok_or(littlefs2_core::Error::IO) }) .ok() .map(|(i, data)| { @@ -493,7 +494,7 @@ impl Filestore for ClientFilestore { .filter_map(|entry| { let is_file = entry.file_type().is_file(); if is_file { - if PathBuf::from(entry.file_name()) == PathBuf::from(filename) { + if entry.file_name() == filename { Some(PathBuf::from(entry.path())) } else { None @@ -503,7 +504,7 @@ impl Filestore for ClientFilestore { } }) .next() - .ok_or(littlefs2::io::Error::Io) + .ok_or(littlefs2_core::Error::IO) }) .ok() } diff --git a/src/store/keystore.rs b/src/store/keystore.rs index c31db885f2b..91849b1ffdf 100644 --- a/src/store/keystore.rs +++ b/src/store/keystore.rs @@ -1,4 +1,4 @@ -use littlefs2::{path, path::PathBuf}; +use littlefs2_core::{path, PathBuf}; use rand_chacha::ChaCha8Rng; use crate::{ @@ -86,7 +86,7 @@ impl ClientKeystore { pub fn key_path(&self, secrecy: key::Secrecy, id: &KeyId) -> PathBuf { let mut path = self.key_directory(secrecy); - path.push(&PathBuf::from(id.hex().as_slice())); + path.push(&id.hex_path()); path } } diff --git a/src/tests.rs b/src/tests.rs index fd2fbb641e5..0f78d2289f4 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -7,6 +7,7 @@ use littlefs2::const_ram_storage; use littlefs2::driver::Storage as LfsStorage; use littlefs2::fs::{Allocation, Filesystem}; use littlefs2::io::Result as LfsResult; +use littlefs2_core::path; use rand_core::{CryptoRng, RngCore}; #[cfg(any(feature = "p256", feature = "p384", feature = "p521",))] @@ -172,7 +173,7 @@ macro_rules! setup { let (test_trussed_requester, test_trussed_responder) = crate::pipe::TRUSSED_INTERCHANGE .claim() .expect("could not setup TEST TrussedInterchange"); - let test_client_id = "TEST"; + let test_client_id = path!("TEST"); assert!(trussed .add_endpoint(test_trussed_responder, test_client_id, &[], None) @@ -873,10 +874,11 @@ fn rng() { #[test] #[serial] fn filesystem() { + let path = PathBuf::from(path!("test_file")); setup!(client); assert!(block!(client - .entry_metadata(Location::Internal, PathBuf::from("test_file")) + .entry_metadata(Location::Internal, path.clone()) .expect("no client error")) .expect("no errors") .metadata @@ -884,24 +886,19 @@ fn filesystem() { let data = Bytes::from_slice(&[0; 20]).unwrap(); block!(client - .write_file( - Location::Internal, - PathBuf::from("test_file"), - data.clone(), - None, - ) + .write_file(Location::Internal, path.clone(), data.clone(), None,) .expect("no client error")) .expect("no errors"); let recv_data = block!(client - .read_file(Location::Internal, PathBuf::from("test_file")) + .read_file(Location::Internal, path.clone()) .expect("no client error")) .expect("no errors") .data; assert_eq!(data, recv_data); let metadata = block!(client - .entry_metadata(Location::Internal, PathBuf::from("test_file")) + .entry_metadata(Location::Internal, path.clone()) .expect("no client error")) .expect("no errors") .metadata @@ -910,11 +907,11 @@ fn filesystem() { // This returns an error because the name doesn't exist block!(client - .remove_file(Location::Internal, PathBuf::from("bad_name")) + .remove_file(Location::Internal, path!("bad_name").into()) .expect("no client error")) .ok(); let metadata = block!(client - .entry_metadata(Location::Internal, PathBuf::from("test_file")) + .entry_metadata(Location::Internal, path.clone()) .expect("no client error")) .expect("no errors") .metadata @@ -922,11 +919,11 @@ fn filesystem() { assert!(metadata.is_file()); block!(client - .remove_file(Location::Internal, PathBuf::from("test_file")) + .remove_file(Location::Internal, path.clone()) .expect("no client error")) .expect("no errors"); assert!(block!(client - .entry_metadata(Location::Internal, PathBuf::from("test_file")) + .entry_metadata(Location::Internal, path.clone()) .expect("no client error")) .expect("no errors") .metadata diff --git a/src/types.rs b/src/types.rs index a359b630bdc..8c533760ff5 100644 --- a/src/types.rs +++ b/src/types.rs @@ -7,12 +7,8 @@ pub use heapless::{String, Vec}; pub use crate::Bytes; -pub use littlefs2::{ - driver::Storage as LfsStorage, - fs::{DirEntry, Filesystem, Metadata}, - io::Result as LfsResult, - path::{Path, PathBuf}, -}; +pub use littlefs2::{driver::Storage as LfsStorage, fs::Filesystem}; +pub use littlefs2_core::{DirEntry, Metadata, Path, PathBuf, Result as LfsResult}; use rand_core::{CryptoRng, RngCore}; use serde::{Deserialize, Serialize}; @@ -85,6 +81,10 @@ impl Id { buffer } + pub fn hex_path(&self) -> PathBuf { + PathBuf::try_from(self.hex().as_slice()).unwrap() + } + /// skips leading zeros pub fn hex_clean(&self) -> String<32> { const HEX_CHARS: &[u8] = b"0123456789abcdef"; @@ -285,7 +285,7 @@ impl From for CoreContext { impl From<&str> for CoreContext { fn from(s: &str) -> Self { - Self::new(s.into()) + Self::new(s.try_into().unwrap()) } } diff --git a/src/virt.rs b/src/virt.rs index aca130fbef2..76fff3c18a4 100644 --- a/src/virt.rs +++ b/src/virt.rs @@ -143,7 +143,7 @@ impl Platform { test: impl FnOnce(Client) -> R, ) -> R { let mut service = Service::with_dispatch(self, dispatch); - let client = ClientBuilder::new(client_id) + let client = ClientBuilder::new(littlefs2::path::PathBuf::try_from(client_id).unwrap()) .backends(backends) .prepare(&mut service) .unwrap() @@ -157,8 +157,11 @@ impl Platform { test: impl FnOnce([MultiClient; N]) -> R, ) -> R { let mut service = Service::new(self); - let prepared_clients = - client_ids.map(|id| ClientBuilder::new(id).prepare(&mut service).unwrap()); + let prepared_clients = client_ids.map(|id| { + ClientBuilder::new(littlefs2::path::PathBuf::try_from(id).unwrap()) + .prepare(&mut service) + .unwrap() + }); let service = Arc::new(Mutex::new(service)); test(prepared_clients.map(|builder| builder.build(service.clone()))) } @@ -172,7 +175,7 @@ impl Platform { ) -> R { let mut service = Service::with_dispatch(self, dispatch); let prepared_clients = client_ids.map(|(id, backends)| { - ClientBuilder::new(id) + ClientBuilder::new(littlefs2::path::PathBuf::try_from(id).unwrap()) .backends(backends) .prepare(&mut service) .unwrap() diff --git a/src/virt/store.rs b/src/virt/store.rs index 3d691c4e23c..20ce0cc91ce 100644 --- a/src/virt/store.rs +++ b/src/virt/store.rs @@ -66,7 +66,7 @@ impl Storage for FilesystemStorage { fn write(&mut self, offset: usize, data: &[u8]) -> LfsResult { debug!("write: offset: {}, len: {}", offset, data.len()); if offset + data.len() > STORAGE_SIZE { - return Err(littlefs2::io::Error::NoSpace); + return Err(littlefs2::io::Error::NO_SPACE); } let mut file = OpenOptions::new().write(true).open(&self.0).unwrap(); file.seek(SeekFrom::Start(offset as _)).unwrap(); @@ -79,7 +79,7 @@ impl Storage for FilesystemStorage { fn erase(&mut self, offset: usize, len: usize) -> LfsResult { debug!("erase: offset: {}, len: {}", offset, len); if offset + len > STORAGE_SIZE { - return Err(littlefs2::io::Error::NoSpace); + return Err(littlefs2::io::Error::NO_SPACE); } let mut file = OpenOptions::new().write(true).open(&self.0).unwrap(); file.seek(SeekFrom::Start(offset as _)).unwrap(); diff --git a/tests/backends.rs b/tests/backends.rs index dfbec4d5f80..c4557b279ed 100644 --- a/tests/backends.rs +++ b/tests/backends.rs @@ -1,5 +1,6 @@ #![cfg(feature = "virt")] +use littlefs2_core::path; use trussed::{ api::{reply::ReadFile, Reply, Request}, backend::{self, BackendId}, @@ -61,7 +62,7 @@ fn run(backends: &'static [BackendId], f: F) { #[test] fn override_syscall() { - let path = PathBuf::from("test"); + let path = PathBuf::from(path!("test")); run(&[], |client| { assert!(trussed::try_syscall!(client.read_file(Location::Internal, path.clone())).is_err()); }); diff --git a/tests/filesystem.rs b/tests/filesystem.rs index ca4f9e89390..c8327237999 100644 --- a/tests/filesystem.rs +++ b/tests/filesystem.rs @@ -2,6 +2,7 @@ use std::assert_eq; +use littlefs2_core::path; use trussed::{ client::{CryptoClient, FilesystemClient}, error::Error, @@ -17,27 +18,27 @@ fn escape_namespace_parent() { let key = syscall!(client.generate_key(Mechanism::P256, StorageAttributes::new())).key; // first approach: directly escape namespace - let mut path = PathBuf::from(".."); - path.push(&PathBuf::from("sec")); - path.push(&PathBuf::from(key.hex().as_slice())); + let mut path = PathBuf::from(path!("..")); + path.push(path!("sec")); + path.push(&key.hex_path()); assert_eq!( try_syscall!(client.read_file(Location::Volatile, path)), Err(Error::InvalidPath), ); // second approach: start with subdir, then escape namespace - let mut path = PathBuf::from("foobar/../.."); - path.push(&PathBuf::from("sec")); - path.push(&PathBuf::from(key.hex().as_slice())); + let mut path = PathBuf::from(path!("foobar/../..")); + path.push(path!("sec")); + path.push(&key.hex_path()); assert_eq!( try_syscall!(client.read_file(Location::Volatile, path)), Err(Error::InvalidPath), ); // false positive: does not escape namespace but still forbidden - let mut path = PathBuf::from("foobar/.."); - path.push(&PathBuf::from("sec")); - path.push(&PathBuf::from(key.hex().as_slice())); + let mut path = PathBuf::from(path!("foobar/..")); + path.push(path!("sec")); + path.push(&key.hex_path()); assert_eq!( try_syscall!(client.read_file(Location::Volatile, path)), Err(Error::InvalidPath), @@ -49,9 +50,9 @@ fn escape_namespace_parent() { fn escape_namespace_root() { client::get(|client| { let key = syscall!(client.generate_key(Mechanism::P256, StorageAttributes::new())).key; - let mut path = PathBuf::from("/test"); - path.push(&PathBuf::from("sec")); - path.push(&PathBuf::from(key.hex().as_slice())); + let mut path = PathBuf::from(path!("/test")); + path.push(path!("sec")); + path.push(&key.hex_path()); assert!(try_syscall!(client.read_file(Location::Volatile, path)).is_err()); }) } @@ -60,17 +61,17 @@ fn iterating(location: Location) { client::get(|client| { syscall!(client.write_file( location, - PathBuf::from("foo"), + PathBuf::from(path!("foo")), Bytes::from_slice(b"foo").unwrap(), None )); syscall!(client.write_file( location, - PathBuf::from("bar"), + PathBuf::from(path!("bar")), Bytes::from_slice(b"bar").unwrap(), None )); - let first_entry = syscall!(client.read_dir_first(location, PathBuf::from(""), None)) + let first_entry = syscall!(client.read_dir_first(location, PathBuf::new(), None)) .entry .unwrap(); assert_eq!(first_entry.file_name(), "bar"); @@ -78,7 +79,7 @@ fn iterating(location: Location) { let next_entry = syscall!(client.read_dir_next()).entry.unwrap(); assert_eq!(next_entry.file_name(), "foo"); - let first_data = syscall!(client.read_dir_files_first(location, PathBuf::from(""), None)) + let first_data = syscall!(client.read_dir_files_first(location, PathBuf::new(), None)) .data .unwrap(); assert_eq!(first_data, b"bar"); @@ -88,7 +89,7 @@ fn iterating(location: Location) { } fn iterating_first(location: Location) { - use littlefs2::path; + use littlefs2_core::path; client::get(|client| { let files = [ path!("foo"), @@ -141,7 +142,7 @@ fn iterating_first(location: Location) { } let first_entry = - syscall!(client.read_dir_first_alphabetical(location, PathBuf::from(""), None)) + syscall!(client.read_dir_first_alphabetical(location, PathBuf::from(path!("")), None)) .entry .unwrap(); assert_eq!(first_entry.path(), files_sorted_lfs[0]); @@ -153,8 +154,8 @@ fn iterating_first(location: Location) { let first_entry = syscall!(client.read_dir_first_alphabetical( location, - PathBuf::from(""), - Some(PathBuf::from("fo")) + PathBuf::from(path!("")), + Some(PathBuf::from(path!("fo"))) )) .entry .unwrap(); @@ -169,7 +170,7 @@ fn iterating_first(location: Location) { } fn iterating_files_and_dirs(location: Location) { - use littlefs2::path; + use littlefs2_core::path; client::get(|client| { let files = [ path!("foo"), @@ -257,7 +258,7 @@ fn iterating_files_and_dirs(location: Location) { ); let first_entry = - syscall!(client.read_dir_first_alphabetical(location, PathBuf::from(""), None)) + syscall!(client.read_dir_first_alphabetical(location, PathBuf::from(path!("")), None)) .entry .unwrap(); assert_eq!(first_entry.path(), all_entries_sorted_lfs[0]); @@ -269,8 +270,8 @@ fn iterating_files_and_dirs(location: Location) { let first_entry = syscall!(client.read_dir_first_alphabetical( location, - PathBuf::from(""), - Some(PathBuf::from("dir")) + PathBuf::from(path!("")), + Some(PathBuf::from(path!("dir"))) )) .entry .unwrap(); diff --git a/tests/virt.rs b/tests/virt.rs index 93f2dbb8217..d39cfbb1727 100644 --- a/tests/virt.rs +++ b/tests/virt.rs @@ -1,5 +1,6 @@ #![cfg(feature = "virt")] +use littlefs2_core::path; use std::time::Duration; use trussed::{ client::{FilesystemClient as _, ManagementClient as _}, @@ -10,12 +11,13 @@ use trussed::{ fn run_test(data: u8) { let location = Location::Internal; - let path = PathBuf::from("test"); + let path = PathBuf::from(path!("test")); let mut write_data = Bytes::new(); write_data.push(data).unwrap(); virt::with_ram_client("test", |mut client| { // ensure that the filesystem is empty - let read_dir = syscall!(client.read_dir_first(location, PathBuf::from(""), None)).entry; + let read_dir = + syscall!(client.read_dir_first(location, PathBuf::from(path!("")), None)).entry; assert!( read_dir.is_none(), "Filesystem not empty: {:?}",