changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/ffi/btrfs/tests.lisp

changeset 698: 96958d3eb5b0
parent: f57e2bbee438
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 ;;; src/fs/btrfs/tests.lisp --- BTRFS common-lisp tests
2 
3 ;;; Code:
4 (defpackage btrfs/tests
5  (:use :cl :std :rt :btrfs :sb-alien))
6 (in-package :btrfs/tests)
7 
8 (defsuite :btrfs)
9 (in-suite :btrfs)
10 (load-btrfs)
11 (load-btrfsutil)
12 
13 (defvar *test-btrfs-pathname* (directory-path (symbol-name (gensym "/tmp/btrfs"))))
14 
15 (deftest sanity ()
16  (is (typep +btrfs-lib-version+ 'fixnum))
17  (is (eq 0 (btrfs-util-error :ok)))
18  (is (equal "Cannot allocate memory" (btrfs-util-strerror (btrfs-util-error :no-memory))))
19  (is (btrfs::allocate-btrfs-qgroup-limit))
20  (is (btrfs::allocate-btrfs-util-subvolume-info)))
21 
22 ;; for a complete test we need to be have fs permissions.
23 
24 ;; To run these tests, pass a filesystem path as fixture input when running as
25 ;; root.
26 
27 (deftest basic (:skip t)
28  ;; will only work when root filesystem is BTRFS
29  (is (zerop (btrfs::btrfs-util-subvolume-is-valid "/")))
30  (is (zerop (btrfs::btrfs-util-fs-sync "/")))
31  ;; (sb-alien:with-alien ((id (unsigned 64)))
32  ;; (btrfs-util-strerror (btrfs::btrfs-util-subvolume-get-default "/" (addr id))))
33  (sb-alien:with-alien ((id (unsigned 64))
34  (path c-string (make-alien-string ""))
35  (iter (* btrfs-util-subvolume-iterator)))
36  (btrfs-util-subvolume-iter-create "/" 0 0 (addr iter))
37  (btrfs-util-subvolume-iter-destroy iter)))
38