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
  • Loading branch information
JohnWestlund committed Jan 25, 2016
1 parent 37e0c33 commit ba1c09d
Show file tree
Hide file tree
Showing 5 changed files with 104 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
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
46 changes: 46 additions & 0 deletions tests/packaging/slurm-sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!./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
touch /tmp/drffasdd
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 ba1c09d

Please sign in to comment.