packaging: Enable testing infrastructure sandbox/vbarinov/tizen_6_base
authorSlava Barinov <v.barinov@samsung.com>
Thu, 30 Jan 2020 13:12:02 +0000 (16:12 +0300)
committerSlava Barinov <v.barinov@samsung.com>
Mon, 3 Feb 2020 14:07:11 +0000 (17:07 +0300)
binutils-testresults package added

Signed-off-by: Slava Barinov <v.barinov@samsung.com>
packaging/binutils-aarch64.spec
packaging/binutils-armv7hl.spec
packaging/binutils-armv7l.spec
packaging/binutils.spec

index 4114cfe..c187a90 100644 (file)
 %define binutils_run_tests 1
 %endif
 
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all binutils
+# 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 binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
 Name:           binutils%{?cross:-%{cross}}
 BuildRequires:  makeinfo
 BuildRequires:  bison
@@ -100,9 +117,19 @@ GDB, the GNU debugger, allows you to debug programs written in C, C++,
 Java, and other languages, by executing them in a controlled fashion
 and printing their data.
 
-This package provides a program that allows you to run GDB on a different machine than the one 
+This package provides a program that allows you to run GDB on a different machine than the one
 which is running the program being debugged.
 
+%{?binutils_run_tests:
+%package testresults
+Summary:       Testsuite results
+License:       SUSE-Public-Domain
+Group:         Development/Languages
+%description testresults
+Results from running the gcc and target library testsuites.
+}
+
+
 %prep
 %setup -q -n binutils-%{version}
 cp %{SOURCE1001} .
@@ -113,9 +140,13 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
 export CFLAGS="${RPM_OPT_FLAGS}"
 export CXXFLAGS="${RPM_OPT_FLAGS}"
 
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
 mkdir build-dir
 cd build-dir
 
+%{!?binutils_skip_configure:
 ../configure \
        --prefix=%{_prefix} --libdir=%{_libdir} \
        --infodir=%{_infodir} --mandir=%{_mandir} \
@@ -144,12 +175,22 @@ cd build-dir
         --with-separate-debug-dir=/usr/lib/debug        \
         --disable-sim                                   \
         --with-expat
-
+}
+%{!?binutils_skip_make:
 make %{?_smp_mflags}
+}
+
+%{?binutils_exit_on_make_finish:
+ exit 1
+}
 
-%check
 %{?binutils_run_tests:
-    make %{?_smp_mflags} -C build-dir check -k
+  echo "Run testsuite"
+  # asan needs a whole shadow address space
+  ulimit -v unlimited || true
+  make -k check %{?_smp_mflags} || true
+  mkdir ../testresults
+  ../contrib/test_summary | tee ../testresults/test_summary.txt
 }
 
 %install
@@ -171,6 +212,12 @@ done
 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
 
+%{?binutils_run_tests:
+  find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \; 
+  mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults 
+  find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
 # Remove unwanted files to shut up rpm
 %{remove_docs}
 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
@@ -217,4 +264,11 @@ rm -rf %{buildroot}%{_datadir}
 %{_bindir}/gdbserver
 }
 
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
 %changelog
index bb9823c..17be8d6 100644 (file)
 %define binutils_run_tests 1
 %endif
 
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all binutils
+# 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 binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
 Name:           binutils%{?cross:-%{cross}}
 BuildRequires:  makeinfo
 BuildRequires:  bison
@@ -100,9 +117,19 @@ GDB, the GNU debugger, allows you to debug programs written in C, C++,
 Java, and other languages, by executing them in a controlled fashion
 and printing their data.
 
-This package provides a program that allows you to run GDB on a different machine than the one 
+This package provides a program that allows you to run GDB on a different machine than the one
 which is running the program being debugged.
 
+%{?binutils_run_tests:
+%package testresults
+Summary:       Testsuite results
+License:       SUSE-Public-Domain
+Group:         Development/Languages
+%description testresults
+Results from running the gcc and target library testsuites.
+}
+
+
 %prep
 %setup -q -n binutils-%{version}
 cp %{SOURCE1001} .
@@ -113,9 +140,13 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
 export CFLAGS="${RPM_OPT_FLAGS}"
 export CXXFLAGS="${RPM_OPT_FLAGS}"
 
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
 mkdir build-dir
 cd build-dir
 
+%{!?binutils_skip_configure:
 ../configure \
        --prefix=%{_prefix} --libdir=%{_libdir} \
        --infodir=%{_infodir} --mandir=%{_mandir} \
@@ -144,12 +175,22 @@ cd build-dir
         --with-separate-debug-dir=/usr/lib/debug        \
         --disable-sim                                   \
         --with-expat
-
+}
+%{!?binutils_skip_make:
 make %{?_smp_mflags}
+}
+
+%{?binutils_exit_on_make_finish:
+ exit 1
+}
 
-%check
 %{?binutils_run_tests:
-    make %{?_smp_mflags} -C build-dir check -k
+  echo "Run testsuite"
+  # asan needs a whole shadow address space
+  ulimit -v unlimited || true
+  make -k check %{?_smp_mflags} || true
+  mkdir ../testresults
+  ../contrib/test_summary | tee ../testresults/test_summary.txt
 }
 
 %install
@@ -171,6 +212,12 @@ done
 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
 
+%{?binutils_run_tests:
+  find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \; 
+  mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults 
+  find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
 # Remove unwanted files to shut up rpm
 %{remove_docs}
 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
@@ -217,4 +264,11 @@ rm -rf %{buildroot}%{_datadir}
 %{_bindir}/gdbserver
 }
 
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
 %changelog
index 3d72059..03bd436 100644 (file)
 %define binutils_run_tests 1
 %endif
 
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all binutils
+# 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 binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
 Name:           binutils%{?cross:-%{cross}}
 BuildRequires:  makeinfo
 BuildRequires:  bison
@@ -100,9 +117,19 @@ GDB, the GNU debugger, allows you to debug programs written in C, C++,
 Java, and other languages, by executing them in a controlled fashion
 and printing their data.
 
-This package provides a program that allows you to run GDB on a different machine than the one 
+This package provides a program that allows you to run GDB on a different machine than the one
 which is running the program being debugged.
 
+%{?binutils_run_tests:
+%package testresults
+Summary:       Testsuite results
+License:       SUSE-Public-Domain
+Group:         Development/Languages
+%description testresults
+Results from running the gcc and target library testsuites.
+}
+
+
 %prep
 %setup -q -n binutils-%{version}
 cp %{SOURCE1001} .
@@ -113,9 +140,13 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
 export CFLAGS="${RPM_OPT_FLAGS}"
 export CXXFLAGS="${RPM_OPT_FLAGS}"
 
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
 mkdir build-dir
 cd build-dir
 
+%{!?binutils_skip_configure:
 ../configure \
        --prefix=%{_prefix} --libdir=%{_libdir} \
        --infodir=%{_infodir} --mandir=%{_mandir} \
@@ -144,12 +175,22 @@ cd build-dir
         --with-separate-debug-dir=/usr/lib/debug        \
         --disable-sim                                   \
         --with-expat
-
+}
+%{!?binutils_skip_make:
 make %{?_smp_mflags}
+}
+
+%{?binutils_exit_on_make_finish:
+ exit 1
+}
 
-%check
 %{?binutils_run_tests:
-    make %{?_smp_mflags} -C build-dir check -k
+  echo "Run testsuite"
+  # asan needs a whole shadow address space
+  ulimit -v unlimited || true
+  make -k check %{?_smp_mflags} || true
+  mkdir ../testresults
+  ../contrib/test_summary | tee ../testresults/test_summary.txt
 }
 
 %install
@@ -171,6 +212,12 @@ done
 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
 
+%{?binutils_run_tests:
+  find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \; 
+  mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults 
+  find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
 # Remove unwanted files to shut up rpm
 %{remove_docs}
 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
@@ -217,4 +264,11 @@ rm -rf %{buildroot}%{_datadir}
 %{_bindir}/gdbserver
 }
 
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
 %changelog
index 78051e2..d6e1623 100644 (file)
 %define binutils_run_tests 1
 %endif
 
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all binutils
+# 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 binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
 Name:           binutils%{?cross:-%{cross}}
 BuildRequires:  makeinfo
 BuildRequires:  bison
@@ -97,9 +114,19 @@ GDB, the GNU debugger, allows you to debug programs written in C, C++,
 Java, and other languages, by executing them in a controlled fashion
 and printing their data.
 
-This package provides a program that allows you to run GDB on a different machine than the one 
+This package provides a program that allows you to run GDB on a different machine than the one
 which is running the program being debugged.
 
+%{?binutils_run_tests:
+%package testresults
+Summary:       Testsuite results
+License:       SUSE-Public-Domain
+Group:         Development/Languages
+%description testresults
+Results from running the gcc and target library testsuites.
+}
+
+
 %prep
 %setup -q -n binutils-%{version}
 cp %{SOURCE1001} .
@@ -110,9 +137,13 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
 export CFLAGS="${RPM_OPT_FLAGS}"
 export CXXFLAGS="${RPM_OPT_FLAGS}"
 
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
 mkdir build-dir
 cd build-dir
 
+%{!?binutils_skip_configure:
 ../configure \
        --prefix=%{_prefix} --libdir=%{_libdir} \
        --infodir=%{_infodir} --mandir=%{_mandir} \
@@ -141,12 +172,22 @@ cd build-dir
         --with-separate-debug-dir=/usr/lib/debug        \
         --disable-sim                                   \
         --with-expat
-
+}
+%{!?binutils_skip_make:
 make %{?_smp_mflags}
+}
+
+%{?binutils_exit_on_make_finish:
+ exit 1
+}
 
-%check
 %{?binutils_run_tests:
-    make %{?_smp_mflags} -C build-dir check -k
+  echo "Run testsuite"
+  # asan needs a whole shadow address space
+  ulimit -v unlimited || true
+  make -k check %{?_smp_mflags} || true
+  mkdir ../testresults
+  ../contrib/test_summary | tee ../testresults/test_summary.txt
 }
 
 %install
@@ -168,6 +209,12 @@ done
 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
 
+%{?binutils_run_tests:
+  find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \; 
+  mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults 
+  find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
 # Remove unwanted files to shut up rpm
 %{remove_docs}
 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
@@ -214,4 +261,11 @@ rm -rf %{buildroot}%{_datadir}
 %{_bindir}/gdbserver
 }
 
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
 %changelog