MCPcopy Create free account
hub / github.com/bootc-dev/bootc / test_tmpfiles_entry_get_path

Function test_tmpfiles_entry_get_path

crates/tmpfiles/src/lib.rs:539–560  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

537
538 #[test]
539 fn test_tmpfiles_entry_get_path() {
540 let cases = [
541 ("z /dev/kvm 0666 - kvm -", "/dev/kvm"),
542 ("d /run/lock/lvm 0700 root root -", "/run/lock/lvm"),
543 (
544 "a+ /var/lib/tpm2-tss/system/keystore - - - - default:group:tss:rwx",
545 "/var/lib/tpm2-tss/system/keystore",
546 ),
547 (
548 "d \"/run/file with spaces/foo\" 0700 root root -",
549 "/run/file with spaces/foo",
550 ),
551 (
552 r#"d /spaces\x20\x20here/foo 0700 root root -"#,
553 "/spaces here/foo",
554 ),
555 ];
556 for (input, expected) in cases {
557 let path = tmpfiles_entry_get_path(input).unwrap();
558 assert_eq!(path, Path::new(expected), "Input: {input}");
559 }
560 }
561
562 fn newroot() -> Result<cap_std_ext::cap_tempfile::TempDir> {
563 let root = cap_std_ext::cap_tempfile::tempdir(cap_std::ambient_authority())?;

Callers

nothing calls this directly

Calls 1

tmpfiles_entry_get_pathFunction · 0.85

Tested by

no test coverage detected