Add test package

This commit is contained in:
Tom Stellard 2018-03-28 06:01:07 +00:00
parent db33d7e163
commit ffe9038285
3 changed files with 78 additions and 1 deletions

View file

@ -7,12 +7,13 @@
Name: libomp Name: libomp
Version: 6.0.0 Version: 6.0.0
Release: 2%{?dist} Release: 3%{?dist}
Summary: OpenMP runtime for clang Summary: OpenMP runtime for clang
License: NCSA License: NCSA
URL: http://openmp.llvm.org URL: http://openmp.llvm.org
Source0: http://llvm.org/releases/%{version}/openmp-%{version}%{?rc_ver:rc%{rc_ver}}.src.tar.xz Source0: http://llvm.org/releases/%{version}/openmp-%{version}%{?rc_ver:rc%{rc_ver}}.src.tar.xz
Source1: runtest.sh
Patch0: 0001-CMake-Make-LIBOMP_HEADERS_INSTALL_PATH-a-cache-varia.patch Patch0: 0001-CMake-Make-LIBOMP_HEADERS_INSTALL_PATH-a-cache-varia.patch
@ -38,6 +39,19 @@ Requires: clang-devel%{?isa} = %{version}
%description devel %description devel
OpenMP header files. OpenMP header files.
%package test
Summary: OpenMP regression tests
Requires: %{name}%{?isa} = %{version}
Requires: %{name}-devel%{?isa} = %{version}
Requires: clang
Requires: llvm
Requires: gcc
Requires: gcc-c++
Requires: python3-lit
%description test
OpenMP regression tests
%prep %prep
%autosetup -n openmp-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1 %autosetup -n openmp-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1
@ -60,6 +74,45 @@ cd _build
%install %install
%make_install -C _build %make_install -C _build
# Test package setup
%global libomp_srcdir %{_datadir}/libomp/src/
%global libomp_testdir %{libomp_srcdir}/runtime/test/
%global gcc_lit_cfg %{buildroot}%{libomp_testdir}/gcc.site.cfg
%global clang_lit_cfg %{buildroot}%{libomp_testdir}/clang.site.cfg
install -d %{buildroot}%{libomp_srcdir}/runtime
cp -R runtime/test %{buildroot}%{libomp_srcdir}/runtime
cp -R runtime/src %{buildroot}%{libomp_srcdir}/runtime
# Add symlinks to the libomp headers/library so gcc can find them.
ln -s %{_libdir}/clang/%{version}/include/omp.h %{buildroot}%{libomp_testdir}/omp.h
ln -s %{_libdir}/clang/%{version}/include/ompt.h %{buildroot}%{libomp_testdir}/ompt.h
ln -s %{_libdir}/libomp.so %{buildroot}%{libomp_testdir}/libgomp.so
# Generic test config
echo "import tempfile" > %{gcc_lit_cfg}
cat _build/runtime/test/lit.site.cfg >> %{gcc_lit_cfg}
sed -i 's~\(config.test_filecheck = \)""~\1"%{_libdir}/llvm/FileCheck"~' %{gcc_lit_cfg}
sed -i 's~\(config.omp_header_directory = \)"[^"]\+"~\1"%{_includedir}"~' %{gcc_lit_cfg}
sed -i 's~\(config.libomp_obj_root = \)"[^"]\+"~\1tempfile.mkdtemp()[1]~' %{gcc_lit_cfg}
sed -i 's~\(lit_config.load_config(config, \)"[^"]\+"~\1"%{libomp_testdir}/lit.cfg"~' %{gcc_lit_cfg}
# GCC config
# test_compiler_features was already populated with gcc information if gcc was used
# to compile libomp.
sed -i 's~\(config.test_c_compiler = \)"[^"]\+"~\1"%{_bindir}/gcc"~' %{gcc_lit_cfg}
sed -i 's~\(config.test_cxx_compiler = \)"[^"]\+"~\1"%{_bindir}/g++"~' %{gcc_lit_cfg}
sed -i 's~\(config.library_dir = \)"[^"]\+"~\1"%{libomp_testdir}"~' %{gcc_lit_cfg}
# Clang config
cp %{gcc_lit_cfg} %{clang_lit_cfg}
sed -i 's~\(config.test_compiler_features = \)\[[^\[]\+]~\1["clang"]~' %{clang_lit_cfg}
sed -i 's~\(config.test_c_compiler = \)"[^"]\+"~\1"%{_bindir}/clang"~' %{clang_lit_cfg}
sed -i 's~\(config.test_cxx_compiler = \)"[^"]\+"~\1"%{_bindir}/clang++"~' %{clang_lit_cfg}
sed -i 's~\(config.library_dir = \)"[^"]\+"~\1"%{_libdir}"~' %{clang_lit_cfg}
install -m 0755 %{SOURCE1} %{buildroot}%{_datadir}/libomp
%files %files
%{_libdir}/libomp.so %{_libdir}/libomp.so
@ -74,7 +127,13 @@ cd _build
%{_libdir}/clang/%{version}/include/ompt.h %{_libdir}/clang/%{version}/include/ompt.h
%endif %endif
%files test
%{_datadir}/libomp
%changelog %changelog
* Wed Mar 28 2018 Tom Stellard <tstellar@redhat.com> - 6.0.0-3
- Add test package
* Wed Mar 28 2018 Tom Stellard <tstellar@redhat.com> - 6.0.0-2 * Wed Mar 28 2018 Tom Stellard <tstellar@redhat.com> - 6.0.0-2
- Enable libomptarget plugins - Enable libomptarget plugins

8
runtest.sh Normal file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -x
lit -v --config-prefix clang /usr/share/libomp/src/runtime/test
fail=$?
lit -v --config-prefix gcc /usr/share/libomp/src/runtime/test
exit $fail || $?

10
tests/tests.yml Normal file
View file

@ -0,0 +1,10 @@
- hosts: localhost
roles:
- role: standard-test-basic
tests:
- libomp-regression-tests
environment:
TEST_CMD:
"/usr/share/libomp/runtest.sh"
required_packages:
- libomp-test