summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2026-04-11 17:35:04 +0200
committerVagrant Cascadian <vagrant@debian.org>2026-08-21 16:44:38 -0700
commitf460bbb1f67e1364157bd4b9bd37350fc380129a (patch)
tree67bbeda76dbc3a5f38b9b39d11b9fcc38255e0b9 /gnu
parente72dbc1a3546e54028f4c13e2cfd2d5973b17c22 (diff)
gnu: Add xfstests.
This is a follow-up to b485b1f548dce7d401d87472c49f396b0b5475f9 which removed this package. * gnu/packages/file-systems.scm (xfstests): New variable. Change-Id: I2a536f31033f6dcec17feb0122bc243dfc3bc1f3 Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/file-systems.scm146
1 files changed, 146 insertions, 0 deletions
diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index afe0c7ae02c..8c729fe5dfb 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -1501,6 +1501,152 @@ can create and compare snapshots, revert differences between them, and
1501supports automatic snapshots timelines.") 1501supports automatic snapshots timelines.")
1502 (license license:gpl2))) 1502 (license license:gpl2)))
1503 1503
1504(define-public xfstests
1505 (package
1506 (name "xfstests")
1507 (version "2026.03.20")
1508 (source
1509 (origin
1510 (method git-fetch)
1511 (uri (git-reference
1512 (url "git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git")
1513 (commit (string-append "v" version))))
1514 (file-name (git-file-name name version))
1515 (sha256
1516 (base32 "04x24izan3g2znnq6lzn3zlq0bl34qad530cp4ynm412w6q97kbz"))))
1517 (build-system gnu-build-system)
1518 (arguments
1519 (list
1520 #:make-flags
1521 #~(list (string-append "INSTALL="
1522 (search-input-file %build-inputs "/bin/install")))
1523 #:phases
1524 #~(modify-phases %standard-phases
1525 (add-after 'unpack 'patch-tool-locations
1526 (lambda* (#:key inputs #:allow-other-keys)
1527 (substitute* "common/config"
1528 ;; Make absolute file names relative.
1529 (("(MKFS_PROG=\").*(\")" _ pre post)
1530 (string-append pre "mkfs" post)))
1531 (for-each (lambda (file)
1532 (substitute* file
1533 (("( -s|#.|[= ])(/bin/sh|/bin/bash)" _ pre match)
1534 (string-append pre
1535 (search-input-file inputs match)))
1536 (("/bin/(rm|true)" match)
1537 (search-input-file inputs match))
1538 (("/usr(/bin/time)" _ match)
1539 (search-input-file inputs match))))
1540 (append (find-files "common" ".*")
1541 (find-files "tests" ".*")
1542 (find-files "tools" ".*")
1543 (find-files "src" "\\.(c|sh)$")))))
1544 (add-before 'bootstrap 'fix-hardcoded-binaries
1545 (lambda* (#:key make-flags #:allow-other-keys)
1546 (substitute* "m4/package_utilies.m4"
1547 ;; Fix the bogus hard-coded paths for every single binary.
1548 (("(AC_PATH_PROG\\(.*, ).*(\\))" _ pre post)
1549 (string-append pre (getenv "PATH") post)))))
1550 (add-after 'install 'wrap-xfstests/check
1551 ;; Keep wrapping distinct from 'create-helper-script below: users
1552 ;; must be able to invoke xfstests/check directly if they prefer.
1553 (lambda* (#:key inputs #:allow-other-keys)
1554 (wrap-program (string-append #$output "/xfstests/check")
1555 ;; Prefix the user's PATH with the minimum required tools.
1556 ;; The suite has many other optional dependencies and will
1557 ;; automatically select tests based on the original PATH.
1558 `("PATH" ":" prefix
1559 ,(map (lambda (file)
1560 (dirname (search-input-file inputs file)))
1561 (list "bin/setfacl" ; acl
1562 "bin/attr" ; attr
1563 "bin/bc" ; bc
1564 "bin/df" ; coreutils
1565 "bin/hostname" ; inetutils
1566 "bin/perl" ; perl
1567 "sbin/mkfs.xfs")))))) ; xfsprogs
1568 (add-after 'install 'create-helper
1569 ;; Upstream installs only a ‘check’ script that's not in $PATH and
1570 ;; would try to write to the store without explaining how to change
1571 ;; that. Install a simple helper script to make it discoverable.
1572 (lambda* (#:key inputs #:allow-other-keys)
1573 (let* ((check (string-append #$output "/xfstests/check"))
1574 (bin (string-append #$output "/bin"))
1575 (helper (string-append bin "/xfstests-check")))
1576 (mkdir-p bin)
1577 (with-output-to-file helper
1578 (lambda _
1579 (format #t "#!~a --no-auto-compile\n!#\n"
1580 (search-input-file inputs "/bin/guile"))
1581 (write
1582 `(begin
1583 (define (try proc dir)
1584 "Try to PROC DIR. Return DIR on success, else #f."
1585 (with-exception-handler (const #f)
1586 (lambda _ (proc dir) dir)
1587 #:unwind? #t))
1588
1589 (define args
1590 (cdr (command-line)))
1591
1592 (when (or (member "--help" args)
1593 (member "-h" args))
1594 (format #t "Usage: ~a [OPTION]...
1595This Guix helper sets up a new writable RESULT_BASE if it's unset, then executes
1596xfstest's \"~a\" command (with any OPTIONs) as documented below.\n\n"
1597 ,(basename helper)
1598 ,(basename check)))
1599
1600 (let* ((gotenv-base (getenv "RESULT_BASE"))
1601 (base (or gotenv-base
1602 (let loop ((count 0))
1603 (or (try mkdir
1604 (format #f "xfstests.~a"
1605 count))
1606 (loop (+ 1 count))))))
1607 (result-base (if (string-prefix? "/" base)
1608 base
1609 (string-append (getcwd) "/"
1610 base))))
1611 (setenv "RESULT_BASE" result-base)
1612 ;; CHECK must run in its own directory or will fail.
1613 (chdir ,(dirname check))
1614 (let ((status
1615 (status:exit-val (apply system* ,check args))))
1616 (unless gotenv-base
1617 (try rmdir result-base))
1618 status))))))
1619 (chmod helper #o755)))))))
1620 (native-inputs
1621 (list autoconf-2.71 automake libtool pkg-config))
1622 (inputs
1623 (list acl
1624 attr
1625 bash-minimal
1626 bc
1627 guile-3.0 ; for our xfstests-check helper script
1628 inetutils
1629 `(,util-linux "lib")
1630 perl
1631 time
1632 xfsprogs))
1633 (home-page "https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git")
1634 (synopsis "File system @acronym{QA, Quality Assurance} test suite")
1635 (description
1636 "The @acronym{FSQA, File System Quality Assurance} regression test suite,
1637more commonly known as xfstests, comprises over 1,500 tests that exercise
1638(@dfn{torture}) both the user- and kernel-space parts of many different file
1639systems.
1640
1641As the package's name subtly implies, it was originally developed to test the
1642XFS file system. Today, xfstests is the primary test suite for all major file
1643systems supported by the kernel Linux including XFS, ext4, and Btrfs, but also
1644virtual and network file systems such as NFS, 9P, and the overlay file system.
1645
1646The packaged @command{check} script is not in @env{PATH} but can be invoked
1647with the included @command{xfstests-check} helper.")
1648 (license license:gpl2)))
1649
1504(define-public zfs 1650(define-public zfs
1505 (package 1651 (package
1506 (name "zfs") 1652 (name "zfs")