devel/criterion: New port: C and C++ unit testing framework for the 21st century

This KISS-compliant library makes testsuites as simple as possible.
This commit is contained in:
Yuri Victorovich 2022-07-03 11:45:28 -07:00
parent e1e0b2a0c4
commit c32decee33
7 changed files with 149 additions and 0 deletions

View file

@ -441,6 +441,7 @@
SUBDIR += crc32c
SUBDIR += creduce
SUBDIR += critcl
SUBDIR += criterion
SUBDIR += cscope
SUBDIR += cscout
SUBDIR += csmith

48
devel/criterion/Makefile Normal file
View file

@ -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>

7
devel/criterion/distinfo Normal file
View file

@ -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

View file

@ -0,0 +1,5 @@
#include <criterion/criterion.h>
Test(simple, Test) {
cr_assert(false, "Hello World!");
}

View file

@ -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)

15
devel/criterion/pkg-descr Normal file
View file

@ -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

51
devel/criterion/pkg-plist Normal file
View file

@ -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