From 1f29170be5d9e3edf21489fff680cf80df42c8bd Mon Sep 17 00:00:00 2001 From: Slava Barinov Date: Wed, 9 Sep 2020 16:52:45 +0300 Subject: [PATCH] packaging: Add support for %run_tests_on_device This variable allows to prepare buildroot for running testsuite on device Change-Id: I14d652d198f65f6662bf22deb23d6cbf6dd156af Signed-off-by: Slava Barinov --- packaging/glibc.spec | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/packaging/glibc.spec b/packaging/glibc.spec index bb24a35..0782863 100644 --- a/packaging/glibc.spec +++ b/packaging/glibc.spec @@ -16,6 +16,23 @@ %define glibc_run_tests 1 %endif +# Enable this when testing on device to: +# 1. Enable macro to turn on testsuite building ('glibc_run_tests 1') +# 2. Keep 'build-dir/' folder in build stage as we do not want to rebuild all +# glibc again on device after invoking rpmbuild --short-circuit -bc ... +# 3. Skip configure and make commands and go directly to 'make check' +%if 0%{?run_tests_on_device} +%define glibc_run_tests 1 +%define glibc_keep_build_dir 1 +%define glibc_skip_configure 1 +%define glibc_skip_make 1 +%endif + +# Exit right after 'make ..' step to keep all object files produced by glibc build +%if 0%{?exit_on_make_finish} +%define glibc_exit_on_make_finish 1 +%endif + %if 0%{?dump_configure} %define glibc_dump_configure 1 %endif @@ -326,6 +343,9 @@ configure_and_build_glibc() { local dirname="$1"; shift local cflags="$1"; shift local addons="$1"; shift + %{!?glibc_keep_build_dir: + rm -rf "cc-$dirname" + } mkdir "cc-$dirname" cd "cc-$dirname" conf_cflags="$cflags -funwind-tables -fPIC" @@ -337,6 +357,7 @@ configure_and_build_glibc() { profile="--enable-profile" fi %endif +%{!?glibc_skip_configure: CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ CC="$BuildCC" CXX="$BuildCCplus" ../configure \ --prefix=%{_prefix} \ @@ -359,15 +380,20 @@ configure_and_build_glibc() { --disable-nscd \ --disable-experimental-malloc \ libc_cv_cc_pie_default=yes - # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) - make %{?_smp_mflags} #CFLAGS="$cflags" BUILD_CFLAGS="$cflags" + } +%{!?glibc_skip_make: + make %{?_smp_mflags} %{?glibc_dump_configure: dump_configure.pl .. . \ --project glibc \ --project-version %{version} \ --out_db glibc-%{version}-%{release}-%_project-%_repository.db } + %{?glibc_exit_on_make_finish: + exit 1 + } cd .. + } } configure_flags="--prefix=/usr --without-cvs --without-selinux --enable-stackguard-randomization --enable-obsolete-rpc --disable-mathvec" -- 2.7.4