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

Add newer version of BATS testing framework #60

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
31 changes: 28 additions & 3 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,42 @@ jobs:

- name: Install BATS
run: |
source /etc/profile
./build.sh configure || true
module --version
if [ $LMOD_VERSION+x ]; then
echo "assuming LUA modules…"
else
echo "assuming TCL modules…"
fi
./build.sh -s bats

- name: Run BATS
env:
LATEST_BATS_VER: 1.8.2
run: |
source /etc/profile
module --version
module use /home/runner/modules
cp -v /home/runner/modules/bats/1.2.1/default /home/runner/modules/bats/1.2.2
echo "MODULEPATH=$MODULEPATH"
find /home/runner/modules -type f
module avail
module load bats/1.2.2
set
if [ ${LMOD_VERSION+x} ]; then
export LMOD_IGNORE_CACHE=yes
echo "assuming LUA modules…"
echo "module --config"
module --config
echo "module avail:"
module --ignore_cache avail
echo "module spider:"
module spider bats
echo "module load:"
module load default/bats/${LATEST_BATS_VER}
else
echo "assuming TCL modules…"
echo "module avail:"
module avail
echo "module load:"
module load bats/${LATEST_BATS_VER}/default
fi
bats tests/
6 changes: 5 additions & 1 deletion build_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ module_install () {

PREREQ_DEPENDS="$(module_capture_prereq)"
if [ -r "${PLAN}.module" ]; then
module_path="${MODULE_INSTALL_PATH}/${PACKAGE}/${VERSION}/${VARIANT}"
if [ ${LMOD_VERSION+x} ]; then # if we are using a LUA module system
module_path="${MODULE_INSTALL_PATH}/${VARIANT}/${PACKAGE}/${VERSION}"
else # else we assume TCL
module_path="${MODULE_INSTALL_PATH}/${PACKAGE}/${VERSION}/${VARIANT}"
fi
#PYTHON_SCRIPTS="$(python -c "import sysconfig; print(sysconfig.get_path('scripts'))")"
#PYTHON_PLATLIB="$(python -c "import sysconfig; print(sysconfig.get_path('platlib'))")"
#PYTHON_PURELIB="$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))")"
Expand Down
36 changes: 36 additions & 0 deletions plans/bats/1.8.2/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
#
# Builder – Compile scripts for local installs of software packages.
# Copyright (C) 2020 Forschungszentrum Jülich GmbH, INM-6
#
# Builder is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Builder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Builder. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
URL="https://github.com/bats-core/bats-core/archive/v${VERSION}.tar.gz"
MD5SUM="0df6b310c243503d8c28bc996b0a6002"
SHA256SUM="0f2df311a536e625a72bff64c838e67c7b5032e6ea9edcdf32758303062b2f3b"

build_prepare() {
log_status ">>> nothing to prepare"
}
build_package() {
log_status ">>> nothing to build"
}
build_install () {
log_status ">>> installing..."
cd "${SOURCE}"
mkdir -pv "${LOG}"
./install.sh "${TARGET}" 2>&1 | tee "${LOG}/make-install.log"
}
25 changes: 25 additions & 0 deletions plans/bats/1.8.2/default.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#%Module1.0#####################################################################
#
# ${AUTOMATIC_BUILD_WARNING}
#
set INSTALLDIR "${TARGET}"

proc ModulesHelp { } {
puts stderr "
Bats is a TAP-compliant testing framework for Bash. It provides a simple way
to verify that the UNIX programs you write behave as expected.

A Bats test file is a Bash script with special syntax for defining test
cases. Under the hood, each test case is just a function with a description.

See https://github.com/bats-core/bats-core#bats-core-bash-automated-testing-system-2018
"
}

module-whatis "Bash testing framework (${VERSION})"

conflict ${PACKAGE}
${PREREQ_DEPENDS}

prepend-path PATH \$INSTALLDIR/bin
prepend-path MANPATH \$INSTALLDIR/share/man