From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Date: Thu, 5 Dec 2019 22:42:54 +0100 From: Alexander Dahl Message-ID: <20191205214253.uq3d2z4ru2rm2gir@falbala.internal.home.lespocky.de> References: <20191129091124.8652-1-post@lespocky.de> <20191205151915.GJ14948@pengutronix.de> MIME-Version: 1.0 In-Reply-To: <20191205151915.GJ14948@pengutronix.de> Subject: Re: [ptxdist] [PATCH] cmocka: new package List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: multipart/mixed; boundary="===============0097088497==" Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.de, Alexander Dahl , Rouven Czerwinski --===============0097088497== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="igbpmomuy4nuuowg" Content-Disposition: inline --igbpmomuy4nuuowg Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hei hei, seems I stumbled over some magic I was not aware of, see below. On Thu, Dec 05, 2019 at 04:19:15PM +0100, Michael Olbrich wrote: > On Fri, Nov 29, 2019 at 10:11:24AM +0100, Alexander Dahl wrote: > > From: Alexander Dahl > >=20 > > This adds the unit testing framework for C called 'cmocka'. > >=20 > > Signed-off-by: Alexander Dahl > > --- > > I tried modifying the opensc package for building its cmocka based > > tests, but autoconf could not find or interpret the pkg-config file > > provided by cmocka. Maybe someone else wants to look deeper into this? = =20 >=20 > What kind of error do you get there? I could solve the prepare stage. Seems like pkg-config behaves differently depending on menuconfig settings in ptxdist? What I tried first: config OPENSC_TESTSUITE = =20 bool "install testsuite" = =20 depends on CMOCKA = =20 This gets me the following in =2E.latform-v7a/build-target/OpenSC-0.19.0/config.log: configure:15477: checking for cmocka >=3D 1.0.1 configure:15484: $PKG_CONFIG --exists --print-errors "cmocka >=3D 1.0.1" arm-v7a-linux-gnueabihf-pkg-config: warning: blocking 'cmocka': not select= ed by 'opensc' configure:15487: $? =3D 1 configure:15501: $PKG_CONFIG --exists --print-errors "cmocka >=3D 1.0.1" arm-v7a-linux-gnueabihf-pkg-config: warning: blocking 'cmocka': not select= ed by 'opensc' configure:15504: $? =3D 1 configure:15518: result: no arm-v7a-linux-gnueabihf-pkg-config: warning: blocking 'cmocka': not select= ed by 'opensc' I used the usual 'select CMOCKA if OPENSC_TESTSUITE' then, which succeeds. Alas, I had to add another 'depends on OPENSC_OPENSSL' there. I can send that patch along with a v2 series, beware it won't build, because compilation fails then, because upstream OpenSC did not put a header file they have in their git tree into their tarball =E2=80=A6 > > --- > > rules/cmocka.in | 13 ++++++++++ > > rules/cmocka.make | 62 +++++++++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 75 insertions(+) > > create mode 100644 rules/cmocka.in > > create mode 100644 rules/cmocka.make > >=20 > > diff --git a/rules/cmocka.in b/rules/cmocka.in > > new file mode 100644 > > index 000000000..d18cf00ff > > --- /dev/null > > +++ b/rules/cmocka.in > > @@ -0,0 +1,13 @@ > > +## SECTION=3Dtest_suites > > + > > +config CMOCKA > > + tristate > > + prompt "cmocka" > > + select HOST_CMAKE > > + help > > + cmocka is ... an elegant unit testing framework for C with > > + support for mock objects. It only requires the standard C > > + library, works on a range of computing platforms (including > > + embedded) and with different compilers. > > + > > +# vim: ft=3Dkconfig noet tw=3D72 ts=3D8 sw=3D8 > > diff --git a/rules/cmocka.make b/rules/cmocka.make > > new file mode 100644 > > index 000000000..a4d25aece > > --- /dev/null > > +++ b/rules/cmocka.make > > @@ -0,0 +1,62 @@ > > +# -*-makefile-*- > > +# > > +# Copyright (C) 2019 by Alexander Dahl > > +# > > +# For further information about the PTXdist project and license condit= ions > > +# see the README file. > > +# > > + > > +# > > +# We provide this package > > +# > > +PACKAGES-$(PTXCONF_CMOCKA) +=3D cmocka > > + > > +# > > +# Paths and names > > +# > > +CMOCKA_VER_MINOR :=3D 1.1 > > +CMOCKA_VER_PATCH :=3D 5 > > +CMOCKA_VERSION :=3D $(CMOCKA_VER_MINOR).$(CMOCKA_VER_PATCH) > > +CMOCKA_MD5 :=3D 91f95cd5db88b9b120d191b18d367193 > > +CMOCKA :=3D cmocka-$(CMOCKA_VERSION) > > +CMOCKA_SUFFIX :=3D tar.xz > > +CMOCKA_URL :=3D https://cmocka.org/files/$(CMOCKA_VER_MINOR)/$(CMOCKA= ).$(CMOCKA_SUFFIX) >=20 > CMOCKA_URL :=3D https://cmocka.org/files/$(basename $(CMOCKA_VERSION))/$= (CMOCKA).$(CMOCKA_SUFFIX) >=20 > Then you can just define CMOCKA_VERSION. Nice, that makes CMOCKA_VERSION :=3D 1.1.5 possible, which is much more readable. I'll put that into v2. Alex >=20 > Michael >=20 > > +CMOCKA_SOURCE :=3D $(SRCDIR)/$(CMOCKA).$(CMOCKA_SUFFIX) > > +CMOCKA_DIR :=3D $(BUILDDIR)/$(CMOCKA) > > +CMOCKA_LICENSE :=3D Apache-2.0 > > +CMOCKA_LICENSE_FILES :=3D file://COPYING;md5=3D3b83ef96387f14655fc854d= dc3c6bd57 > > + > > +# --------------------------------------------------------------------= -------- > > +# Prepare > > +# --------------------------------------------------------------------= -------- > > + > > +CMOCKA_CONF_TOOL :=3D cmake > > +CMOCKA_CONF_OPT :=3D \ > > + $(CROSS_CMAKE_USR) \ > > + -DBUILD_TESTING=3DOFF \ > > + -DPICKY_DEVELOPER:BOOL=3DOFF \ > > + -DUNIT_TESTING:BOOL=3DOFF \ > > + -DWITH_CMOCKERY_SUPPORT:BOOL=3DOFF \ > > + -DWITH_EXAMPLES:BOOL=3DOFF \ > > + -DWITH_STATIC_LIB=3DOFF > > + > > +# --------------------------------------------------------------------= -------- > > +# Target-Install > > +# --------------------------------------------------------------------= -------- > > + > > +$(STATEDIR)/cmocka.targetinstall: > > + @$(call targetinfo) > > + > > + @$(call install_init, cmocka) > > + @$(call install_fixup, cmocka,PRIORITY,optional) > > + @$(call install_fixup, cmocka,SECTION,base) > > + @$(call install_fixup, cmocka,AUTHOR,"Alexander Dahl ") > > + @$(call install_fixup, cmocka,DESCRIPTION,missing) > > + > > + @$(call install_lib, cmocka, 0, 0, 0644, libcmocka) > > + > > + @$(call install_finish, cmocka) > > + > > + @$(call touch) > > + > > +# vim: ft=3Dmake noet tw=3D72 ts=3D8 sw=3D8 > > --=20 > > 2.20.1 > >=20 > >=20 > > _______________________________________________ > > ptxdist mailing list > > ptxdist@pengutronix.de > >=20 >=20 > --=20 > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | >=20 > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de --=20 /"\ ASCII RIBBON | =C2=BBWith the first link, the chain is forged. The first \ / CAMPAIGN | speech censured, the first thought forbidden, the X AGAINST | first freedom denied, chains us all irrevocably.=C2=AB / \ HTML MAIL | (Jean-Luc Picard, quoting Judge Aaron Satie) --igbpmomuy4nuuowg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEwo7muQJjlc+Prwj6NK3NAHIhXMYFAl3pedkACgkQNK3NAHIh XMZOVg/+KEQXWmReaeQ3OoGvFBVBEBuHWev+pYNrnA/H8P1E1J7LqjkANr7x3zu0 uu5kNhGp6Rzf69GLDgVIpvDGQ5BvsvDUJvtjKTRUk04uABcxQbrLK2a5HkAVK1hv SqI5/cjQ7lvU8J8WrrcPfksfE3TForLqxjRR4ORtbdqCc0C2unJDCJT9dpsfcdca e26/BAKsENk6NhVEK9LmDPpgn9mWHBIWkzSeA/oMmQD9eEzRdxv9I1MYP1I1MPwH 12kVPqvKCrGzUGeEQ4YUNnrtTflsx4WYFNK8zGCvm3LwnjG8XO1xnptmsvIlTKYg QvRKLyZVLjSp+kb4XibLkt2ZhjxCwaWTjHeY8qQjSHWdYx24qkkzBZ5b3m+s7MLE 2gC9kMbLId8quI4tO6WXDXbbZmJbB19+vomZQvG0MXgDf7cU8sX4nbqp/oYXi/qN JU85T0kkjx/E6voro0bZt/m+Q7Mt6QmKndjd6X7bnIA9+DxZkO0Tb9IrCwOLoAn3 dOu81twiyyAPuB1EqhuQU2Mx3ex+As5WxnW31dzix6VlJM/kUvqQhKeqKk7/+ojw iqkDMG1epOm85q8Eh2qnITADcKp+lLt05TnXfkKnPmH+9SIvaDQVuAVlplvPKnnG GZr0u31L7JSHKFSmxFzUvIxeYkIgrlazXOGEZkZN6Ff5UkfvoI4= =7uT5 -----END PGP SIGNATURE----- --igbpmomuy4nuuowg-- --===============0097088497== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de --===============0097088497==--