M gnu/local.mk => gnu/local.mk +1 -0
@@ 2413,6 2413,7 @@ dist_patch_DATA = \
%D%/packages/patches/ucx-tcp-iface-ioctl.patch \
%D%/packages/patches/uftrace-fix-tests.patch \
%D%/packages/patches/ultrastar-deluxe-no-freesans.patch \
+ %D%/packages/patches/unity-test-set-subdir-correctly.patch \
%D%/packages/patches/ungoogled-chromium-extension-search-path.patch \
%D%/packages/patches/ungoogled-chromium-RUNPATH.patch \
%D%/packages/patches/ungoogled-chromium-system-nspr.patch \
M gnu/packages/check.scm => gnu/packages/check.scm +46 -0
@@ 58,6 58,7 @@
;;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2025 nomike Postmann <nomike@nomike.com>
;;; Copyright © 2025 Josep Bigorra <jjbigorra@gmail.com>
+;;; Copyright © 2025 Murilo <murilo@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ 109,6 110,7 @@
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages python-science)
+ #:use-module (gnu packages ruby)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages time)
@@ 3431,6 3433,50 @@ of advanced library and language features, which means it should be easily
portable to just about any platform.")
(license license:expat)))
+(define-public unity-test
+ (package
+ (name "unity-test")
+ (version "2.6.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ThrowTheSwitch/Unity")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1s0jj9f2zav49mn9ib90idcmb6hq93aczbqysn5hj6binjmrnjw3"))
+ (patches (search-patches "unity-test-set-subdir-correctly.patch"))))
+ (build-system meson-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "-Dsupport_double=true")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'patch-source-shebangs 'patch-more-shebangs
+ (lambda _
+ (substitute* '("auto/unity_test_summary.rb")
+ (("/usr/bin/ruby")
+ (string-append #$(this-package-input "ruby")
+ "/bin/ruby")))
+ (substitute* '("auto/stylize_as_junit.py"
+ "auto/unity_test_summary.py")
+ (("#! python3")
+ (string-append #$(this-package-input "python")
+ "/bin/python3")))))
+ (add-after 'install 'install-extra
+ (lambda _
+ (for-each (lambda (x)
+ (install-file x
+ (string-append #$output "/share/unity-test")))
+ (find-files "../source/auto")))))))
+ (native-inputs (list pkg-config))
+ (inputs (list python ruby))
+ (home-page "https://github.com/ThrowTheSwitch/Unity")
+ (synopsis "Simple unit testing for C")
+ (description "This package provides a unit testing framework built for C,
+with a focus on working with embedded toolchains.")
+ (license license:expat)))
+
(define-public libfaketime
(package
(name "libfaketime")
A gnu/packages/patches/unity-test-set-subdir-correctly.patch => gnu/packages/patches/unity-test-set-subdir-correctly.patch +30 -0
@@ 0,0 1,30 @@
+From 4c8dab0edd16ce6a4b7b628430de1cd42d03f31a Mon Sep 17 00:00:00 2001
+From: Ross Smyth <rsmyth@electrocraft.com>
+Date: Mon, 10 Mar 2025 16:00:38 -0400
+Subject: [PATCH] Fix meson pkg-config generation
+
+The pkg-config file does not include the subdir
+in its build flags, so files will fail to find the
+Unity headers.
+---
+ meson.build | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 6585129c..9489aef4 100644
+--- a/meson.build
++++ b/meson.build
+@@ -64,10 +64,10 @@ unity_dep = declare_dependency(
+ if not meson.is_subproject()
+ pkg = import('pkgconfig')
+ pkg.generate(
+- name: meson.project_name(),
++ unity_lib,
+ version: meson.project_version(),
+- libraries: [ unity_lib ],
+- description: 'C Unit testing framework.'
++ subdirs: 'unity',
++ extra_cflags: unity_args,
+ )
+ endif
+