Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jul 2022 18:47:23 GMT
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: c32decee33ce - main - devel/criterion: New port: C and C++ unit testing framework for the 21st century
Message-ID:  <202207031847.263IlNcr063292@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c32decee33ce9db095fb2b77e4ece07c5ec50f59

commit c32decee33ce9db095fb2b77e4ece07c5ec50f59
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-07-03 18:45:28 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-07-03 18:47:18 +0000

    devel/criterion: New port: C and C++ unit testing framework for the 21st century
    
    This KISS-compliant library makes testsuites as simple as possible.
---
 devel/Makefile                          |  1 +
 devel/criterion/Makefile                | 48 +++++++++++++++++++++++++++++++
 devel/criterion/distinfo                |  7 +++++
 devel/criterion/files/example.c         |  5 ++++
 devel/criterion/files/patch-meson.build | 22 ++++++++++++++
 devel/criterion/pkg-descr               | 15 ++++++++++
 devel/criterion/pkg-plist               | 51 +++++++++++++++++++++++++++++++++
 7 files changed, 149 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index e8208656b11c..dd52006d2766 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -441,6 +441,7 @@
     SUBDIR += crc32c
     SUBDIR += creduce
     SUBDIR += critcl
+    SUBDIR += criterion
     SUBDIR += cscope
     SUBDIR += cscout
     SUBDIR += csmith
diff --git a/devel/criterion/Makefile b/devel/criterion/Makefile
new file mode 100644
index 000000000000..be7142673f0b
--- /dev/null
+++ b/devel/criterion/Makefile
@@ -0,0 +1,48 @@
+PORTNAME=	criterion
+DISTVERSIONPREFIX=	v
+DISTVERSION=	2.4.1
+CATEGORIES=	devel
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	C and C++ unit testing framework for the 21st century
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}protobuf>0:devel/py-protobuf@${PY_FLAVOR} \
+		nanopb>0:devel/nanopb \
+		cmake:devel/cmake \
+		protoc:devel/protobuf
+LIB_DEPENDS=	libboxfort.so:devel/boxfort \
+		libffi.so:devel/libffi \
+		libgit2.so:devel/libgit2 \
+		libnanomsg.so:net/nanomsg \
+		libprotobuf-nanopb.so:devel/nanopb
+RUN_DEPENDS=	nanopb>0:devel/nanopb
+
+USES=		gettext localbase:ldflags meson python pkgconfig shebangfix
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	Snaipe
+GH_PROJECT=	Criterion
+GH_TUPLE=	attractivechaos:klib:cdb7e92:klib/dependencies/klib \
+		MrAnno:debugbreak:83bf7e9:debugbreak/dependencies/debugbreak
+
+SHEBANG_FILES=	src/protocol/gen-pb.py
+
+MESON_ARGS=	-Db_lundef=false # remove -Wl,--no-undefined to work around bug#265008
+MESON_ARGS=	-Dtests=false -Dsamples=false
+
+CFLAGS+=	-fPIC
+CXXFLAGS+=	-fPIC
+
+quick-test:
+	@cd ${TEST_WRKSRC} && \
+		${CC} ${CFLAGS} -I${STAGEDIR}${PREFIX}/include \
+			${STAGEDIR}${PREFIX}/lib/libcriterion.a \
+			-L${LOCALBASE}/lib -lboxfort -lprotobuf-nanopb -lgit2 -lnanomsg \
+			${FILESDIR}/example.c && \
+		./a.out # test succeeds when simple::Test fails with assertion
+
+.include <bsd.port.mk>
diff --git a/devel/criterion/distinfo b/devel/criterion/distinfo
new file mode 100644
index 000000000000..9e662f28da98
--- /dev/null
+++ b/devel/criterion/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1656832146
+SHA256 (Snaipe-Criterion-v2.4.1_GH0.tar.gz) = 34eb5c92c2663e0c0a0b77f7c4c2f6d5600ee08a4e41833e06859b7af089c891
+SIZE (Snaipe-Criterion-v2.4.1_GH0.tar.gz) = 870842
+SHA256 (attractivechaos-klib-cdb7e92_GH0.tar.gz) = 659a9b920bc77a88c30e61053cfaecd673ab2120df31efadaf544c195415f390
+SIZE (attractivechaos-klib-cdb7e92_GH0.tar.gz) = 99298
+SHA256 (MrAnno-debugbreak-83bf7e9_GH0.tar.gz) = 6ec24bdf3d361ec2bb7d128c56b8e870a1bb2d6b22eab3c2821eb1e15ccb8919
+SIZE (MrAnno-debugbreak-83bf7e9_GH0.tar.gz) = 7060
diff --git a/devel/criterion/files/example.c b/devel/criterion/files/example.c
new file mode 100644
index 000000000000..57d5bdd31c03
--- /dev/null
+++ b/devel/criterion/files/example.c
@@ -0,0 +1,5 @@
+#include <criterion/criterion.h>
+
+Test(simple, Test) {
+	cr_assert(false, "Hello World!");
+}
diff --git a/devel/criterion/files/patch-meson.build b/devel/criterion/files/patch-meson.build
new file mode 100644
index 000000000000..769ec915be7f
--- /dev/null
+++ b/devel/criterion/files/patch-meson.build
@@ -0,0 +1,22 @@
+- use the shared library for nanopb
+
+--- meson.build.orig	2022-07-03 16:28:55 UTC
++++ meson.build
+@@ -171,7 +171,7 @@ else
+ 	config.set('NN_REQREP_H', '<nanomsg/reqrep.h>')
+ endif
+ 
+-nanopb = dependency('nanopb', required: false, method: 'cmake', modules: ['nanopb::protobuf-nanopb-static'])
++nanopb = dependency('nanopb', required: false, method: 'cmake', modules: ['nanopb::protobuf-nanopb'])
+ must_regenerate_pb = nanopb.found()
+ if not nanopb.found()
+ 	nanopb_proj = cmake.subproject('nanopb',
+@@ -181,7 +181,7 @@ if not nanopb.found()
+ 			'-DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1',
+ 			'-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
+ 		])
+-	nanopb = nanopb_proj.dependency('protobuf-nanopb-static')
++	nanopb = nanopb_proj.dependency('protobuf-nanopb')
+ endif
+ 
+ libgit2 = dependency('libgit2', required: false)
diff --git a/devel/criterion/pkg-descr b/devel/criterion/pkg-descr
new file mode 100644
index 000000000000..1040d9d56d4a
--- /dev/null
+++ b/devel/criterion/pkg-descr
@@ -0,0 +1,15 @@
+Criterion is a cross-platform C and C++ unit testing framework for the
+21st century.
+
+Most test frameworks for C require a lot of boilerplate code to set up
+tests and test suites -- you need to create a main, then register new
+test suites, then register the tests within these suites, and finally
+call the right functions.
+
+This gives the user great control, at the unfortunate cost of
+simplicity.
+
+Criterion follows the KISS principle, while keeping the control the
+user would have with other frameworks.
+
+WWW: https://github.com/Snaipe/Criterion
diff --git a/devel/criterion/pkg-plist b/devel/criterion/pkg-plist
new file mode 100644
index 000000000000..700e6d4d3cc6
--- /dev/null
+++ b/devel/criterion/pkg-plist
@@ -0,0 +1,51 @@
+include/criterion/abort.h
+include/criterion/alloc.h
+include/criterion/assert.h
+include/criterion/criterion.h
+include/criterion/embedded.h
+include/criterion/event.h
+include/criterion/hooks.h
+include/criterion/internal/asprintf-compat.h
+include/criterion/internal/assert.h
+include/criterion/internal/assert/complex.h
+include/criterion/internal/assert/exceptions.h
+include/criterion/internal/assert/ieee.h
+include/criterion/internal/assert/memory.h
+include/criterion/internal/assert/op.h
+include/criterion/internal/assert/op.hxx
+include/criterion/internal/assert/stream.h
+include/criterion/internal/assert/tag.h
+include/criterion/internal/assert/tostr.h
+include/criterion/internal/assert/types.h
+include/criterion/internal/capabilities.h
+include/criterion/internal/common.h
+include/criterion/internal/deprecation.h
+include/criterion/internal/designated-initializer-compat.h
+include/criterion/internal/hooks.h
+include/criterion/internal/new_asserts.h
+include/criterion/internal/ordered-set.h
+include/criterion/internal/parameterized.h
+include/criterion/internal/preprocess.h
+include/criterion/internal/redirect.h
+include/criterion/internal/stdio_filebuf.hxx
+include/criterion/internal/stream.hxx
+include/criterion/internal/test.h
+include/criterion/internal/theories.h
+include/criterion/logging.h
+include/criterion/new/assert.h
+include/criterion/new/memory.h
+include/criterion/new/stream.h
+include/criterion/options.h
+include/criterion/output.h
+include/criterion/parameterized.h
+include/criterion/redirect.h
+include/criterion/stats.h
+include/criterion/theories.h
+include/criterion/types.h
+lib/libcriterion.a
+lib/libcriterion.so
+lib/libcriterion.so.3
+lib/libcriterion.so.3.2.0
+libdata/pkgconfig/criterion.pc
+share/locale/de/LC_MESSAGES/criterion.mo
+share/locale/fr/LC_MESSAGES/criterion.mo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207031847.263IlNcr063292>