From a14076a661df6eb145c2d922dc132011bb07f6bd Mon Sep 17 00:00:00 2001 From: Dridi Boukelmoune Date: Aug 09 2019 07:00:22 +0000 Subject: Conditionally build the test suite The setup is a bit convoluted, and it only works on x86_64. However with Koji it is not possible to build and run the test suite, I disabled it by default. --- diff --git a/kcov.spec b/kcov.spec index fdb163c..99a5a4f 100644 --- a/kcov.spec +++ b/kcov.spec @@ -1,6 +1,15 @@ +%bcond_with tests + +%if %{with tests} +%ifarch x86_64 +%global kcov_tests 1 +%endif +%endif + + Name: kcov Version: 36 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Code coverage tool without special compilation options # Licenses of kcov itself and its bundled js libraries (see below) @@ -18,8 +27,11 @@ BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(libdw) BuildRequires: pkgconfig(libelf) BuildRequires: pkgconfig(zlib) -BuildRequires: python3 -BuildRequires: /usr/bin/python +BuildRequires: python2 + +%if 0%{?kcov_tests} +BuildRequires: glibc-devel(x86-32) +%endif # NB: Last I tried to unbundle those dependencies I hit a first roadblock in # the sense that all three were available in Fedora but packaged differently @@ -59,14 +71,34 @@ long-running applications. %setup -q rm -frv external/ # remove LLDB headers bundled for MacOS +# NB: python means python3 starting with f31. +# https://github.com/SimonKagstrom/kcov/issues/305 +sed -i 's:#!/usr/bin/env python:#!/usr/bin/env python2:' \ + $(grep -lr '#!/usr/bin/env python$' src tests) + %build -%cmake . -%make_build +# NB: the test suite is not built using the %%cmake macro, on purpose. +%if 0%{?kcov_tests} +cmake -S tests -B build-tests -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON +%make_build -C build-tests +%endif + +cmake -S tools -B build-tools -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON +%make_build -C build-tools + +%cmake -S . -B build +%make_build -C build %install -%make_install +%make_install -C build + + +%check +%if 0%{?kcov_tests} +tests/tools/run-tests build/src/kcov /tmp/ build-tests/ $(pwd) -v +%endif %files @@ -77,6 +109,11 @@ rm -frv external/ # remove LLDB headers bundled for MacOS %changelog +* Fri Aug 09 2019 Dridi Boukelmoune - 36-2 +- Temporarily move python shebangs to python2 +- Build the test suite on x86_64 and run it conditionally +- Build tools/line2addr (but don't install it) + * Wed Aug 07 2019 Dridi Boukelmoune - 36-1 - Bump to version 36