]> git.proxmox.com Git - proxmox.git/commitdiff
sys: fs: move tests to a sub-module
authorLukas Wagner <l.wagner@proxmox.com>
Mon, 21 Aug 2023 13:44:38 +0000 (15:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 30 Aug 2023 15:37:31 +0000 (17:37 +0200)
This ensures that test code is not compiled in regular builds

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
proxmox-sys/src/fs/dir.rs

index bdef85e4e5a50c8eba49d0c0f12b0c6205024934..6aee31685b8fcfb44c66ecf6eaa26864f2ff8cc7 100644 (file)
@@ -152,16 +152,21 @@ fn create_path_at_do(
     }
 }
 
-#[test]
-fn test_create_path() {
-    create_path(
-        "testdir/testsub/testsub2/testfinal",
-        Some(CreateOptions::new().perm(stat::Mode::from_bits_truncate(0o755))),
-        Some(
-            CreateOptions::new()
-                .owner(nix::unistd::Uid::effective())
-                .group(nix::unistd::Gid::effective()),
-        ),
-    )
-    .expect("expected create_path to work");
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_create_path() {
+        create_path(
+            "testdir/testsub/testsub2/testfinal",
+            Some(CreateOptions::new().perm(stat::Mode::from_bits_truncate(0o755))),
+            Some(
+                CreateOptions::new()
+                    .owner(nix::unistd::Uid::effective())
+                    .group(nix::unistd::Gid::effective()),
+            ),
+        )
+        .expect("expected create_path to work");
+    }
 }