Skip to content

Commit

Permalink
CI set up travis to run with and without slurm
Browse files Browse the repository at this point in the history
  • Loading branch information
arjoly committed Jan 23, 2015
1 parent 9f03d3f commit 5333078
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
15 changes: 5 additions & 10 deletions .travis.yml
Expand Up @@ -4,16 +4,11 @@ python:
- "3.3"
- "3.4"
# command to install dependencies
install:
# Install package and its dependency for full test
- "pip install coverage coveralls"
- "pip install sphinx_bootstrap_theme"
# Install slurm
- "sudo apt-get install slurm-llnl "
- "sudo /usr/sbin/create-munge-key"
- "sudo service munge start"
- "sudo python continuous_integration/configure_slurm.py"

install: source continuous_integration/install.sh
env:
matrix:
- SCHEDULER="None"
- SCHEDULER="SLURM"
# command to run tests
script: make
after_success: coveralls
Expand Down
7 changes: 5 additions & 2 deletions clusterlib/tests/test_scheduler.py
Expand Up @@ -23,8 +23,11 @@ def test_queued_or_running_jobs_slurm():

# Check that slurm is installed
with open(os.devnull, 'w') as shutup:
has_sbatch = 1 - subprocess.check_call(["which", "sbatch"],
stdout=shutup, stderr=shutup)
try:
has_sbatch = 1 - subprocess.check_call(["which", "sbatch"],
stdout=shutup, stderr=shutup)
except subprocess.CalledProcessError:
has_sbatch = 0

if not has_sbatch:
raise SkipTest("sbatch is missing")
Expand Down
22 changes: 22 additions & 0 deletions continuous_integration/install.sh
@@ -0,0 +1,22 @@
#!/bin/bash
# This script is meant to be called by the "install" step defined in
# .travis.yml. See http://docs.travis-ci.com/ for more details.
# The behavior of the script is controlled by environment variabled defined
# in the .travis.yml in the top level folder of the project.

# License: 3-clause BSD


set -e # Exit on first error

# Install dependency for full test
pip install coverage coveralls
pip install sphinx_bootstrap_theme


if [[ "$SCHEDULER" == "SLURM" ]]; then
sudo apt-get install slurm-llnl
sudo /usr/sbin/create-munge-key
sudo service munge start
sudo python continuous_integration/configure_slurm.py
fi

0 comments on commit 5333078

Please sign in to comment.