Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test-suite #1758

Open
wants to merge 5 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions components/admin/test-suite/SPECS/tests.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,74 @@
#
#----------------------------------------------------------------------------eh-

%global __brp_mangle_shebangs_exclude bats
%undefine __brp_mangle_shebangs

%include %{_sourcedir}/OHPC_macros

%global testuser ohpc-test
%global homedir %(sed -n "s/^\s*HOME=\s*//p" /etc/default/useradd || echo "/home" )

Summary: Integration test suite for OpenHPC
Name: test-suite%{PROJ_DELIM}
Version: 2.6.0
Version: 2.7.0
Release: 1
License: Apache-2.0
Group: %{PROJ_NAME}/admin
BuildArch: noarch
URL: https://github.com/openhpc/ohpc/tests
Source0: tests-ohpc.tar
# In the OHPC source root dir, create with "tar -cf tests-ohpc.tar tests/"

BuildRequires: autoconf%{PROJ_DELIM}
BuildRequires: automake%{PROJ_DELIM}
BuildRequires: sed, findutils

%global __brp_mangle_shebangs_exclude bats
%undefine __brp_mangle_shebangs

%if 0%{?suse_version}
%if 0%{?suse_version} || 0%{?sle_version}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I saw in rpm --showrc checking for %{?sle_version} should be enough I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're correct, but I'm going by the chart here:
https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
It implies that someone running Tumbleweed requires a suse_version check. I know it's not formally supported, but I still want it to work.
I've been kicking around adding %{suse} to OHPC_MACROS as the counterpart to %{rhel}.

Requires(pre): shadow
Requires: python-base
Requires: python3-base
%endif

%if 0%{?rhel_version}
%if 0%{?rhel}
Requires(pre): shadow-utils
Requires: python2
Requires: python3
%endif

%define testuser ohpc-test

%description

This package provides a suite of integration tests used by the OpenHPC project
during continuous integration. Most components can be tested individually, but
a default configuration is setup to enable collective testing. The test suite
is made available under an '%{testuser}' user account.


%prep
%setup -n tests-ohpc
find . -name .gitignore -exec rm {} \;

%build

%build
export PATH=/opt/ohpc/pub/utils/autotools/bin:$PATH
cd tests
./bootstrap


%install
mkdir -p %{buildroot}%{homedir}/%{testuser}
cp -a tests %{buildroot}%{homedir}/%{testuser}/

cd tests
%{__mkdir_p} %{buildroot}/home/%{testuser}/tests
cp -a * %{buildroot}/home/%{testuser}/tests
find %{buildroot}/home/%{testuser}/tests -name .gitignore -exec rm {} \;

%pre
getent passwd %{testuser} >/dev/null || \
/usr/sbin/useradd -U -c "OpenHPC integration test account" \
-s /bin/bash -m -b /home %{testuser}
%if 0%{?suse_version}
-s /bin/bash -m -b %{homedir} %{testuser}
if [ $(getent group singularity) ]; then
usermod -a -G singularity ohpc-test
usermod -a -G singularity %{testuser}
fi
if [ $(getent group geopm) ]; then
usermod -a -G geopm %{testuser}
fi
%endif
exit 0


%files
%defattr(-,%{testuser},%{testuser},-)
%dir /home/%{testuser}
/home/%{testuser}/tests

%{homedir}/%{testuser}/tests
2 changes: 1 addition & 1 deletion misc/build_srpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ SRPM=$(build_srpm "${SPEC}" "${MPI_FAMILY}")
RESULT=$?
if [ "${RESULT}" == "1" ]; then
echo "Building the SRPM for ${BASE} failed."
echo "Trying to fetch Source0"
echo "Trying to fetch Sources"
"${ROOT}"/misc/get_source.sh "${BASE}"
fi

Expand Down
24 changes: 18 additions & 6 deletions misc/get_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,27 @@ do
BASE=$(basename "${file}")

SOURCES=$(rpmspec --parse --define '_sourcedir ../../..' "${FLAGS[@]}" "${BASE}" | grep Source)
for u in ${SOURCES}; do
echo "${u}"
if [[ "${u}" != *"http"* ]]; then
for s in ${SOURCES}; do
echo "${s}"
# Remove the Source header
u=$(awk '{ print $2 }' <<< "${s}")
# Special handler for tests and docs
if [[ "${u}" == "docs-ohpc.tar" || "${u}" == "tests-ohpc.tar" ]]; then
if [ ! -f ../SOURCES/"${u}" ]; then
echo Creating "${u}"
SOURCEDIR="${PWD%/*}"/SOURCES
mkdir -p "${SOURCEDIR}"
tar -C ../../../.. -cf "${SOURCEDIR}/${u}" --xform="s#^#${u%.tar}/#" "${u%-ohpc.tar}"
continue
fi
fi
# Ignore everything else that's not an http/https download
if [[ "${u}" != "http"* ]]; then
continue
fi
u=$(awk '{ print $2 }' <<< "${u}")
echo "Trying to get ${u}"
echo "Trying to wget ${u}"
# Try to download only if newer
WGET=$(wget -N -nv -P ../SOURCES "${u}" 2>&1)
WGET=$(wget -N -nv -P "../SOURCES" "${u}" 2>&1)
# Handling for github URLs with #/ or #$/
if grep -E "#[$]?/" <<< "${u}"; then
MV_SOURCE=$(echo "${WGET}" | tail -1 | cut -d\ -f6 | sed -e 's/^"//' -e 's/"$//')
Expand Down
2 changes: 1 addition & 1 deletion misc/shell-functions
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build_srpm() {

DIR=$(dirname "${1}")

SRPM=$(rpmbuild -bs --nodeps --define "_sourcedir ${DIR}/../SOURCES" --define "mpi_family ${MPI_FAMILY}" "${SPEC}" 2>/dev/null)
SRPM=$(rpmbuild -bs --nodeps --define "_sourcedir ${DIR}/../SOURCES" --define "mpi_family ${MPI_FAMILY}" "${SPEC}")
RESULT=$?

echo "${SRPM}" | tail -1 | awk -F\ '{ print $2 }'
Expand Down
1 change: 0 additions & 1 deletion tests/admin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ TESTS_ENVIRONMENT = BATS_NO_SUMMARY=1

TESTS = init.sh

TESTS += clustershell
TESTS += conman
TESTS += genders
TESTS += nhc
Expand Down
134 changes: 0 additions & 134 deletions tests/admin/clush-tests/CLIClubakTest.py

This file was deleted.

Loading