From 4573a69a87fcfc1696da5621a4093e529f92378e Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Apr 24 2019 01:37:52 +0000 Subject: [PATCH 1/6] llvm-test fixes Try to simply lit config file generation by adding standalone fedora specific config file. In the future, when we need to customize the lit config for the llvm-test package, we can just update lit.fedora.cfg.py rather than trying to patch the default config from the spec file. This patch also makes the run-lit-tests script identical on all arches, so it will no longer cause multi-lib conflicts. --- diff --git a/lit.fedora.cfg.py b/lit.fedora.cfg.py new file mode 100644 index 0000000..1c918b4 --- /dev/null +++ b/lit.fedora.cfg.py @@ -0,0 +1,17 @@ + +config.llvm_tools_dir = '/usr/bin' +config.llvm_shlib_dir = '%(llvm_shlib_dir)s' % lit_config.params + +if hasattr(config, 'host_triple'): + # This means we are running lit regression tests + + # Regression tests write output to this directory, so we need to be able to specify + # a temp directory when invoking lit. e.g. lit -Dllvm_obj_root=/tmp/lit + config.llvm_obj_root = "%(llvm_obj_root)s" % lit_config.params + lit_config.load_config(config, '%(llvm_test_root)s/lit.cfg.py' % lit_config.params) +else: + # This means we are running lit unit tests + + # For unit tests, llvm_obj_root is used to find the unit test binaries. + config.llvm_obj_root = '%(llvm_unittest_bindir)s' % lit_config.params + lit_config.load_config(config, '%(llvm_test_root)s/Unit/lit.cfg.py' % lit_config.params) diff --git a/llvm.spec b/llvm.spec index 36037b7..e3f921c 100644 --- a/llvm.spec +++ b/llvm.spec @@ -40,13 +40,14 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 1%{?rc_ver:.rc%{rc_ver}}%{?dist} +Release: 2%{?rc_ver:.rc%{rc_ver}}%{?dist} Summary: The Low Level Virtual Machine License: NCSA URL: http://llvm.org Source0: http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src.tar.xz Source1: run-lit-tests +Source2: lit.fedora.cfg.py Patch5: 0001-PATCH-llvm-config.patch Patch7: 0001-PATCH-Filter-out-cxxflags-not-supported-by-clang.patch @@ -148,8 +149,6 @@ pathfix.py -i %{__python3} -pn \ test/BugPoint/compile-custom.ll.py \ tools/opt-viewer/*.py -sed -i 's~@TOOLS_DIR@~%{_bindir}~' %{SOURCE1} - %build mkdir -p _build cd _build @@ -258,25 +257,27 @@ done install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{_libdir} %global install_srcdir %{buildroot}%{_datadir}/llvm/src -%global lit_cfg test/lit.site.cfg.py -%global lit_unit_cfg test/Unit/lit.site.cfg.py +%global lit_cfg test/%{_arch}.site.cfg.py +%global lit_unit_cfg test/Unit/%{_arch}.site.cfg.py +%global lit_fedora_cfg %{_datadir}/llvm/lit.fedora.cfg.py # Install gtest sources so clang can use them for gtest install -d %{install_srcdir} install -d %{install_srcdir}/utils/ cp -R utils/unittest %{install_srcdir}/utils/ -# Generate lit config files. -cat _build/test/lit.site.cfg.py >> %{lit_cfg} - -# Unit tests write output to this directory, so it can't be in /usr. -sed -i 's~\(config.llvm_obj_root = \)"[^"]\+"~\1"."~' %{lit_cfg} +# Generate lit config files. Strip off the last line that initiates the +# test run, so we can customize the configuration. +head -n -1 _build/test/lit.site.cfg.py >> %{lit_cfg} +head -n -1 _build/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg} -cat _build/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg} -sed -i -e s~`pwd`/_build~%{_prefix}~g -e s~`pwd`~.~g %{lit_cfg} %{lit_cfg} %{lit_unit_cfg} +# Install custom fedora config file +cp %{SOURCE2} %{buildroot}%{lit_fedora_cfg} -# obj_root needs to be set to the directory containing the unit test binaries. -sed -i 's~\(config.llvm_obj_root = \)"[^"]\+"~\1"%{_bindir}"~' %{lit_unit_cfg} +# Patch lit config files to load custom fedora config: +for f in %{lit_cfg} %{lit_unit_cfg}; do + echo "lit_config.load_config(config, '%{lit_fedora_cfg}')" >> $f +done install -d %{buildroot}%{_libexecdir}/tests/llvm install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/tests/llvm @@ -291,6 +292,15 @@ mkdir -p %{build_llvm_libdir} cp -R _build/unittests %{build_llvm_libdir}/ rm -rf `find %{build_llvm_libdir} -iname 'cmake*'` +# Install libraries used for testing +install -m 0755 %{build_libdir}/BugpointPasses.so %{buildroot}%{_libdir} +install -m 0755 %{build_libdir}/LLVMHello.so %{buildroot}%{_libdir} + +# Install test inputs for PDB tests +echo "%{_datadir}/llvm/src/unittests/DebugInfo/PDB" > %{build_llvm_libdir}/unittests/DebugInfo/PDB/llvm.srcdir.txt +mkdir -p %{buildroot}%{_datadir}/llvm/src/unittests/DebugInfo/PDB/ +cp -R unittests/DebugInfo/PDB/Inputs %{buildroot}%{_datadir}/llvm/src/unittests/DebugInfo/PDB/ + %else # Add version suffix to binaries @@ -422,13 +432,17 @@ fi %files test %{_libexecdir}/tests/llvm/ %{llvm_libdir}/unittests/ +%{_datadir}/llvm/src/unittests %{_datadir}/llvm/src/test.tar.gz +%{_datadir}/llvm/lit.fedora.cfg.py %{_bindir}/not %{_bindir}/count %{_bindir}/yaml-bench %{_bindir}/lli-child-target %{_bindir}/llvm-isel-fuzzer %{_bindir}/llvm-opt-fuzzer +%{_libdir}/BugpointPasses.so +%{_libdir}/LLVMHello.so %files googletest %{_datadir}/llvm/src/utils @@ -437,6 +451,9 @@ fi %endif %changelog +* Fri Mar 22 2019 Tom Stellard - 8.0.0-2 +- llvm-test fixes + * Wed Mar 20 2019 sguelton@redhat.com - 8.0.0-1 - 8.0.0 final diff --git a/run-lit-tests b/run-lit-tests index a0a5d5b..a0f27d8 100755 --- a/run-lit-tests +++ b/run-lit-tests @@ -2,7 +2,9 @@ usage() { echo "usage: `basename $0` [OPTIONS]" - echo " --threads NUM The number of threads to use for running tests." + echo " --threads NUM The number of threads to use for running tests." + echo " --multilib-arch ARCH Use this option to test 32-bit libs/binaries on" + echo " 64-bit hosts." } threads_arg='' @@ -13,6 +15,10 @@ while [ $# -gt 0 ]; do shift threads_arg="--threads $1" ;; + --multilib-arch) + shift + ARCH=$1 + ;; * ) echo "unknown option: $1" echo "" @@ -25,15 +31,28 @@ done set -xe -TOOLS_DIR=@TOOLS_DIR@ +if [ -z "$ARCH" ]; then + ARCH=`rpm --eval '%_arch'` +fi + +case $ARCH in + arm) + ;& + i686) + LIB_DIR="/usr/lib/" + ;; + *) + LIB_DIR="/usr/lib64/" + ;; +esac + cd $(mktemp -d) ln -s /usr/include include tar -xzf /usr/share/llvm/src/test.tar.gz -PATH=$PATH:$TOOLS_DIR lit -v -s $threads_arg test \ - -DFileCheck=$TOOLS_DIR/FileCheck \ - -Dcount=$TOOLS_DIR/count \ - -Dnot=$TOOLS_DIR/not \ - -Dlli-child-target=$TOOLS_DIR/lli-child-target \ - -Dllvm-isel-fuzzer=$TOOLS_DIR/llvm-isel-fuzzer \ - -Dllvm-opt-fuzzer=$TOOLS_DIR/llvm-opt-fuzzer \ - -Dyaml-bench=$TOOLS_DIR/yaml-bench +ln -s $ARCH.site.cfg.py test/lit.site.cfg.py +ln -s $ARCH.site.cfg.py test/Unit/lit.site.cfg.py +lit -v -s $threads_arg test \ + -Dllvm_obj_root=`pwd` \ + -Dllvm_test_root=`pwd`/test \ + -Dllvm_unittest_bindir=$LIB_DIR/llvm \ + -Dllvm_shlib_dir=$LIB_DIR From d7ccaa55e9cf643f71d0a4b4ba2641ff3eaeae0a Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Apr 24 2019 01:37:57 +0000 Subject: [PATCH 2/6] Fix ninja check --- diff --git a/llvm.spec b/llvm.spec index e3f921c..045a6f5 100644 --- a/llvm.spec +++ b/llvm.spec @@ -40,7 +40,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 2%{?rc_ver:.rc%{rc_ver}}%{?dist} +Release: 3%{?rc_ver:.rc%{rc_ver}}%{?dist} Summary: The Low Level Virtual Machine License: NCSA @@ -338,7 +338,10 @@ rm -Rf %{build_install_prefix}/share/opt-viewer %check -ninja check-all -C _build || : +# We have disabled rpath, so we need to add the build's library directory +# to LD_LIBRARY_PATH. +LD_LIBRARY_PATH=`pwd`/_build/%{_lib}:$LD_LIBRARY_PATH \ + ninja check-all -C _build || : %ldconfig_scriptlets libs @@ -451,6 +454,9 @@ fi %endif %changelog +* Tue Mar 26 2019 Tom Stellard - 8.0.0-3 +- Fix ninja check + * Fri Mar 22 2019 Tom Stellard - 8.0.0-2 - llvm-test fixes From 216e1c969131bed0fde669f1d0b5142eb0a41463 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Apr 24 2019 01:38:02 +0000 Subject: [PATCH 3/6] Backport r351577 from trunk to fix ninja check failures --- diff --git a/0001-Fix-the-buildbot-issue-introduced-by-r351421.patch b/0001-Fix-the-buildbot-issue-introduced-by-r351421.patch new file mode 100644 index 0000000..e34ffc7 --- /dev/null +++ b/0001-Fix-the-buildbot-issue-introduced-by-r351421.patch @@ -0,0 +1,29 @@ +From eaa421d1f9c3748c550e2a91fcb134a3d2a8ebff Mon Sep 17 00:00:00 2001 +From: Sanjin Sijaric +Date: Fri, 18 Jan 2019 19:34:20 +0000 +Subject: [PATCH] Fix the buildbot issue introduced by r351421 + +The EXPENSIVE_CHECK x86_64 Windows buildbot is failing due to this change. Fix +the map access. + +llvm-svn: 351577 +--- + lib/MC/MCWin64EH.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/MC/MCWin64EH.cpp b/lib/MC/MCWin64EH.cpp +index 8bc1f08..3ef1514 100644 +--- a/lib/MC/MCWin64EH.cpp ++++ b/lib/MC/MCWin64EH.cpp +@@ -522,7 +522,7 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) { + if (MatchingEpilog) { + assert(EpilogInfo.find(MatchingEpilog) != EpilogInfo.end() && + "Duplicate epilog not found"); +- EpilogInfo[EpilogStart] = EpilogInfo[MatchingEpilog]; ++ EpilogInfo[EpilogStart] = EpilogInfo.lookup(MatchingEpilog); + // Clear the unwind codes in the EpilogMap, so that they don't get output + // in the logic below. + EpilogInstrs.clear(); +-- +1.8.3.1 + diff --git a/llvm.spec b/llvm.spec index 045a6f5..29d65bc 100644 --- a/llvm.spec +++ b/llvm.spec @@ -40,7 +40,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 3%{?rc_ver:.rc%{rc_ver}}%{?dist} +Release: 4%{?rc_ver:.rc%{rc_ver}}%{?dist} Summary: The Low Level Virtual Machine License: NCSA @@ -51,6 +51,7 @@ Source2: lit.fedora.cfg.py Patch5: 0001-PATCH-llvm-config.patch Patch7: 0001-PATCH-Filter-out-cxxflags-not-supported-by-clang.patch +Patch8: 0001-Fix-the-buildbot-issue-introduced-by-r351421.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -340,8 +341,14 @@ rm -Rf %{build_install_prefix}/share/opt-viewer %check # We have disabled rpath, so we need to add the build's library directory # to LD_LIBRARY_PATH. +# TODO: Fix test failures on arm LD_LIBRARY_PATH=`pwd`/_build/%{_lib}:$LD_LIBRARY_PATH \ - ninja check-all -C _build || : + ninja check-all -C _build || \ +%ifarch %{arm} + : +%else + false +%endif %ldconfig_scriptlets libs @@ -454,6 +461,9 @@ fi %endif %changelog +* Wed Mar 27 2019 Tom Stellard - 8.0.0-4 +- Backport r351577 from trunk to fix ninja check failures + * Tue Mar 26 2019 Tom Stellard - 8.0.0-3 - Fix ninja check From fa5ea465548a2fc9b40b2bca97b06da73874b929 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Apr 24 2019 01:38:09 +0000 Subject: [PATCH 4/6] Enable build rpath while keeping install rpath disabled --- diff --git a/llvm.spec b/llvm.spec index 29d65bc..78ea1f9 100644 --- a/llvm.spec +++ b/llvm.spec @@ -40,7 +40,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 4%{?rc_ver:.rc%{rc_ver}}%{?dist} +Release: 5%{?rc_ver:.rc%{rc_ver}}%{?dist} Summary: The Low Level Virtual Machine License: NCSA @@ -160,12 +160,16 @@ cd _build %endif # force off shared libs as cmake macros turns it on. +# +# -DCMAKE_INSTALL_RPATH=";" is a workaround for llvm manually setting the +# rpath of libraries and binaries. llvm will skip the manual setting +# if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value +# as nothing, so it sets the rpath to "" when installing. %cmake .. -G Ninja \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DLLVM_PARALLEL_LINK_JOBS=1 \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_SKIP_RPATH:BOOL=ON \ - -DCMAKE_INSTALL_RPATH:BOOL=OFF \ + -DCMAKE_INSTALL_RPATH=";" \ %ifarch s390 %{arm} %ix86 -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ @@ -339,11 +343,8 @@ rm -Rf %{build_install_prefix}/share/opt-viewer %check -# We have disabled rpath, so we need to add the build's library directory -# to LD_LIBRARY_PATH. # TODO: Fix test failures on arm -LD_LIBRARY_PATH=`pwd`/_build/%{_lib}:$LD_LIBRARY_PATH \ - ninja check-all -C _build || \ +ninja check-all -C _build || \ %ifarch %{arm} : %else @@ -461,6 +462,9 @@ fi %endif %changelog +* Sat Mar 30 2019 Tom Stellard - 8.0.0-5 +- Enable build rpath while keeping install rpath disabled + * Wed Mar 27 2019 Tom Stellard - 8.0.0-4 - Backport r351577 from trunk to fix ninja check failures From 0433c3030538e8c3ec9d882de677539de96c9b2b Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Apr 24 2019 13:45:42 +0000 Subject: [PATCH 5/6] Make sure we aren't passing -g on s390x --- diff --git a/llvm.spec b/llvm.spec index 78ea1f9..cf34033 100644 --- a/llvm.spec +++ b/llvm.spec @@ -40,7 +40,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 5%{?rc_ver:.rc%{rc_ver}}%{?dist} +Release: 6%{?rc_ver:.rc%{rc_ver}}%{?dist} Summary: The Low Level Virtual Machine License: NCSA @@ -170,7 +170,7 @@ cd _build -DLLVM_PARALLEL_LINK_JOBS=1 \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_RPATH=";" \ -%ifarch s390 %{arm} %ix86 +%ifarch s390 s390x %{arm} %ix86 -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif @@ -462,6 +462,9 @@ fi %endif %changelog +* Wed Apr 24 2019 Tom Stellard - 8.0.0-6 +- Make sure we aren't passing -g on s390x + * Sat Mar 30 2019 Tom Stellard - 8.0.0-5 - Enable build rpath while keeping install rpath disabled From f2dd90f8af0f8b4f1ec4b94212b4d828a14f1646 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Apr 24 2019 13:45:42 +0000 Subject: [PATCH 6/6] Enable gating tests --- diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..219cd2c --- /dev/null +++ b/gating.yaml @@ -0,0 +1,12 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_testing +rules: + - !PassingTestCaseRule {test_case_name: org.centos.prod.ci.pipeline.allpackages-build.package.test.functional.complete} +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +rules: + - !PassingTestCaseRule {test_case_name: org.centos.prod.ci.pipeline.allpackages-build.package.test.functional.complete}