Skip to content

Commit

Permalink
check the packaging of slurm-sql for regression of #155
Browse files Browse the repository at this point in the history
remove debug statement

add LICENSE to packaging tests
  • Loading branch information
JohnWestlund committed Jan 27, 2016
1 parent 437a22e commit 27d98c0
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ endif

else # non root tests

if PACKAGING_ENABLED
TESTS += packaging/run
endif

if EASYBUILD_ENABLED
SUBDIRS += dev-tools/easybuild
endif
Expand Down
12 changes: 12 additions & 0 deletions tests/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ AC_ARG_ENABLE([prk],
[AX_OPTION_DEFAULT(type=long,enable_prk,yes)])
AM_CONDITIONAL(PRK_ENABLED,test "x$enable_prk" = "xyes" )
#------------------------------------------------------------------------------------------
# PACKAGING
AC_ARG_ENABLE([packaging],
[AS_HELP_STRING([--enable-packaging],[Enable Packaging tests (default=yes)])],[],
[AX_OPTION_DEFAULT(type=short,enable_packaging,yes)])
AM_CONDITIONAL(PACKAGING_ENABLED,test "x$enable_packaging" = "xyes" )
#------------------------------------------------------------------------------------------

AC_OUTPUT( Makefile
user-env/Makefile
Expand Down Expand Up @@ -402,6 +408,12 @@ if test "x$ROOT_ENABLED" = "x1" ; then
else

echo User Environment:
if test "x$enable_packaging" = "xyes"; then
echo ' 'Packaging tests........... : enabled
else
echo ' 'Packaging tests........... : disabled
fi

if test "x$enable_rms_harness" = "xyes"; then
echo ' 'RMS test harness.......... : enabled
else
Expand Down
24 changes: 24 additions & 0 deletions tests/packaging/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2015, Intel Corporation

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions tests/packaging/common
41 changes: 41 additions & 0 deletions tests/packaging/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

cd "$(dirname "$0")" || exit 1

export BATS_JUNIT_CLASS=$TEST_DIR
source ./common/TEST_ENV || exit 1
source ./common/functions || exit 1


for i in "$@"; do
case $i in
-c=*|--compiler=*)
COMPILER_FAMILIES="${i#*=}"
shift
;;
-m=*|--mpi=*)
MPI_FAMILIES="${i#*=}"
shift
;;
-t|--tap)
BATS_OPTS="$BATS_OPTS -t"
shift
;;
-x|--xml)
BATS_OPTS="$BATS_OPTS -x"
shift
;;
*)
echo "$0: Unknown option - $*"
# unknown option
;;
esac
done

echo " "
echo " "
echo "-------------------------------------------------------"
echo "Packages: content tests"
echo "-------------------------------------------------------"

./slurm-sql $BATS_OPTS
45 changes: 45 additions & 0 deletions tests/packaging/slurm-sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!./common/bats/bin/bats
# -*-sh-*-

load ./common/test_helper_functions || exit 1
source ./common/functions || exit 1
source ./common/TEST_ENV

# $ID will be set to sles or centos
source /etc/os-release

containsElement () {
local e
for e in "${@:2}"; do [[ "$e" =~ "$1" ]] && return 0; done
return 1
}

@test "[$TEST_DIR] verify contents of slurm-sql exist" {
if [ "x$ID" = "xcentos" ]; then
# [root@master4-centos71 tests]# repoquery --list slurm-sql-ohpc
# /usr/lib64/slurm
# /usr/lib64/slurm/accounting_storage_mysql.so
# /usr/lib64/slurm/jobcomp_mysql.so
run bash -c "/bin/repoquery --list slurm-sql-ohpc 2>&1 | /bin/tee /tmp/pack-slurm-sql.$$"
cat /tmp/pack-slurm-sql.$$
# [[ ${lines[1]} =~ "accounting_storage_mysql.so" ]]
# [[ ${lines[2]} =~ "jobcomp_mysql.so" ]]
containsElement "accounting_storage_mysql.so" "${lines[@]}"
containsElement "jobcomp_mysql.so" "${lines[@]}"
elif [ "x$ID" = "xsles" ]; then
export XDG_CACHE_HOME="/tmp/cmt.$$"
pushd /tmp && rm -rf cmt.$$ && popd
# Fetch the files without installing:
zypper download slurm-sql-ohpc
# List the files in an uninstalled package:
# /tmp/zypp/packages/ForestPeak_15.42_Factory/x86_64/slurm-sql-ohpc-15.08.7-4.1.x86_64.rpm
run bash -c "rpm -qlp $XDG_CACHE_HOME/zypp/packages/*/x86_64/slurm-sql-*.rpm 2>&1 | /usr/bin/tee /tmp/pack-slurm-sql.$$"
cat /tmp/pack-slurm-sql.$$
# [[ ${lines[1]} =~ "accounting_storage_mysql.so" ]]
# [[ ${lines[2]} =~ "jobcomp_mysql.so" ]]
containsElement "accounting_storage_mysql.so" "${lines[@]}"
containsElement "jobcomp_mysql.so" "${lines[@]}"
else
flunk "test designed for centos or sles."
fi
}

0 comments on commit 27d98c0

Please sign in to comment.