packaging: Add macroses to test linaro-gcc on target device 14/188014/3
authorMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Thu, 30 Aug 2018 09:20:25 +0000 (12:20 +0300)
committerDongkyun Son <dongkyun.s@samsung.com>
Thu, 6 Sep 2018 13:01:15 +0000 (13:01 +0000)
- run_tests_on_device:
  1. Turn on linaro-gcc tests.
  2. Do not remove 'obj/' directory.
  3. Skip configure/make commands in the %build stage.

- exit_on_make_finish:
  Exit right after "make BOOT_CFLAGS=..." step.

Change-Id: I77a85befa7756922963b63488aaf8cdc431fec0f

packaging/gcc-aarch64.spec
packaging/gcc-armv7hl.spec
packaging/gcc-armv7l.spec
packaging/linaro-gcc.spec

index 8b48e63..a6b21c7 100644 (file)
 %define gcc_run_tests 1
 %endif
 
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('gcc_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all gcc
+# 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 gcc_run_tests 1
+%define gcc_keep_build_dir 1
+%define gcc_skip_configure 1
+%define gcc_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by gcc build
+%if 0%{?exit_on_make_finish}
+%define gcc_exit_on_make_finish 1
+%endif
+
 %define quadmath_arch %ix86 x86_64 ia64
 %define tsan_arch x86_64 aarch64
 %define esan_arch x86_64 armv7l
@@ -685,8 +702,10 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -marm -Wa,-mimplicit-it=arm -fno-omit-frame-pointe
 %endif
 }
 %{?esan:%gcc_unforce_options}
+%{!?gcc_keep_build_dir:
 rm -rf obj
 mkdir obj
+}
 cd obj
 
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g' -e 's/-fexceptions//' -e 's/\([[:space:]]\+.*-D_FORTIFY_SOURCE=\)[[:alnum:]]\+/\10/g'
@@ -713,6 +732,7 @@ fi
 %undefine gcc_profiledbootstrap
 %endif
 
+%{!?gcc_skip_configure:
 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
 ../configure \
@@ -801,8 +821,16 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
        --target=%{target_arch} \
        --host=%{host_arch} \
        --build=%{host_arch}
+}
 
+%{!?gcc_skip_make:
 make BOOT_CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} %{!?cross:%{?gcc_profiledbootstrap:profiledbootstrap}}
+}
+
+%{?gcc_exit_on_make_finish:
+ exit 1
+}
+
 %{?gcc_run_tests:
   echo "Run testsuite"
   # asan needs a whole shadow address space
index 7a7e3d7..022cf6f 100644 (file)
 %define gcc_run_tests 1
 %endif
 
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('gcc_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all gcc
+# 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 gcc_run_tests 1
+%define gcc_keep_build_dir 1
+%define gcc_skip_configure 1
+%define gcc_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by gcc build
+%if 0%{?exit_on_make_finish}
+%define gcc_exit_on_make_finish 1
+%endif
+
 %define quadmath_arch %ix86 x86_64 ia64
 %define tsan_arch x86_64 aarch64
 %define esan_arch x86_64 armv7l
@@ -685,8 +702,10 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -marm -Wa,-mimplicit-it=arm -fno-omit-frame-pointe
 %endif
 }
 %{?esan:%gcc_unforce_options}
+%{!?gcc_keep_build_dir:
 rm -rf obj
 mkdir obj
+}
 cd obj
 
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g' -e 's/-fexceptions//' -e 's/\([[:space:]]\+.*-D_FORTIFY_SOURCE=\)[[:alnum:]]\+/\10/g'
@@ -713,6 +732,7 @@ fi
 %undefine gcc_profiledbootstrap
 %endif
 
+%{!?gcc_skip_configure:
 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
 ../configure \
@@ -801,8 +821,16 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
        --target=%{target_arch} \
        --host=%{host_arch} \
        --build=%{host_arch}
+}
 
+%{!?gcc_skip_make:
 make BOOT_CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} %{!?cross:%{?gcc_profiledbootstrap:profiledbootstrap}}
+}
+
+%{?gcc_exit_on_make_finish:
+ exit 1
+}
+
 %{?gcc_run_tests:
   echo "Run testsuite"
   # asan needs a whole shadow address space
index 83cb8ca..4503e9f 100644 (file)
 %define gcc_run_tests 1
 %endif
 
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('gcc_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all gcc
+# 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 gcc_run_tests 1
+%define gcc_keep_build_dir 1
+%define gcc_skip_configure 1
+%define gcc_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by gcc build
+%if 0%{?exit_on_make_finish}
+%define gcc_exit_on_make_finish 1
+%endif
+
 %define quadmath_arch %ix86 x86_64 ia64
 %define tsan_arch x86_64 aarch64
 %define esan_arch x86_64 armv7l
@@ -685,8 +702,10 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -marm -Wa,-mimplicit-it=arm -fno-omit-frame-pointe
 %endif
 }
 %{?esan:%gcc_unforce_options}
+%{!?gcc_keep_build_dir:
 rm -rf obj
 mkdir obj
+}
 cd obj
 
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g' -e 's/-fexceptions//' -e 's/\([[:space:]]\+.*-D_FORTIFY_SOURCE=\)[[:alnum:]]\+/\10/g'
@@ -713,6 +732,7 @@ fi
 %undefine gcc_profiledbootstrap
 %endif
 
+%{!?gcc_skip_configure:
 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
 ../configure \
@@ -801,8 +821,16 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
        --target=%{target_arch} \
        --host=%{host_arch} \
        --build=%{host_arch}
+}
 
+%{!?gcc_skip_make:
 make BOOT_CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} %{!?cross:%{?gcc_profiledbootstrap:profiledbootstrap}}
+}
+
+%{?gcc_exit_on_make_finish:
+ exit 1
+}
+
 %{?gcc_run_tests:
   echo "Run testsuite"
   # asan needs a whole shadow address space
index c21edda..1ef45d2 100644 (file)
 %define gcc_run_tests 1
 %endif
 
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('gcc_run_tests 1')
+# 2. Keep 'obj/' folder in build stage as we do not want to rebuild all gcc
+# 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 gcc_run_tests 1
+%define gcc_keep_build_dir 1
+%define gcc_skip_configure 1
+%define gcc_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by gcc build
+%if 0%{?exit_on_make_finish}
+%define gcc_exit_on_make_finish 1
+%endif
+
 %define quadmath_arch %ix86 x86_64 ia64
 %define tsan_arch x86_64 aarch64
 %define esan_arch x86_64 armv7l
@@ -682,8 +699,10 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -marm -Wa,-mimplicit-it=arm -fno-omit-frame-pointe
 %endif
 }
 %{?esan:%gcc_unforce_options}
+%{!?gcc_keep_build_dir:
 rm -rf obj
 mkdir obj
+}
 cd obj
 
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g' -e 's/-fexceptions//' -e 's/\([[:space:]]\+.*-D_FORTIFY_SOURCE=\)[[:alnum:]]\+/\10/g'
@@ -710,6 +729,7 @@ fi
 %undefine gcc_profiledbootstrap
 %endif
 
+%{!?gcc_skip_configure:
 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
 ../configure \
@@ -798,8 +818,16 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
        --target=%{target_arch} \
        --host=%{host_arch} \
        --build=%{host_arch}
+}
 
+%{!?gcc_skip_make:
 make BOOT_CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} %{!?cross:%{?gcc_profiledbootstrap:profiledbootstrap}}
+}
+
+%{?gcc_exit_on_make_finish:
+ exit 1
+}
+
 %{?gcc_run_tests:
   echo "Run testsuite"
   # asan needs a whole shadow address space