Skip to content

Commit

Permalink
Merge pull request #49 from tasleson/add_lsm_test
Browse files Browse the repository at this point in the history
Add libstoragemgmt targetd plugin test
  • Loading branch information
tasleson authored Jul 6, 2020
2 parents ed34f2f + a9efe45 commit 07b85e2
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ os: linux

dist: bionic

language: python
language: c

before_install:
- sudo apt-get install -y python-dev
- sudo apt-get install -y python3
- sudo apt-get install -y python3-dev
- sudo apt-get install -y libpython2.7-dev
- sudo apt-get install -y libpython3.6-dev
- sudo apt-get install -y libblockdev-dev
- sudo apt-get install -y libblockdev-lvm2
- sudo apt-get install -y libblockdev-lvm-dev
Expand Down
55 changes: 55 additions & 0 deletions test/lsm_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

# Not finding libStorageMgmt packages, so let download and build. We should
# try and fix that.

cd /tmp || exit 1

git clone http://github.com/libstorage/libstoragemgmt || exit 1

cd /tmp/libstoragemgmt || exit 1

export DEBIAN_FRONTEND="noninteractive"
apt-get update
apt-get install -y tzdata
ln -fs /usr/share/zoneinfo/GMT /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata

# Get all the needed files
apt-get install $(cat ./deb_dependency) -y -q || exit 1

./autogen.sh || exit 1

# Not all the libraries for py3 exist
./configure --with-python2 || exit 1

V=1 make || exit 1

# Setup some symlinks
ln -s `pwd`/plugin `pwd`/python_binding/lsm/plugin || exit 1
ln -s `pwd`/tools/lsmcli `pwd`/python_binding/lsm || exit 1
ln -s `pwd`/python_binding/lsm/.libs/*.so `pwd`/python_binding/lsm/. || exit 1
ln -s `pwd`/plugin/nfs/.libs/*.so `pwd`/plugin/nfs/. || exit 1

# Make the IPC directory
mkdir -p /var/run/lsm/ipc || exit 1

PYENV=`pwd`/python_binding
LSMDLOG=/tmp/lsmd.log

# Start up the daemon
PYTHONPATH=$PYENV daemon/lsmd -v -d --plugindir `pwd`/plugin > $LSMDLOG 2>&1 &

# Run the client test
PYTHONPATH=$PYENV test/plugin_test.py -v --uri targetd://admin@localhost --password targetd

rc=$?
if [ $rc -ne 0 ]; then
echo "Dumping lsmd output on unit test error ..."
cat $LSMDLOG
exit $rc
fi

# Exit success
exit 0

3 changes: 3 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ sleep 5 || exit 1
echo "Dumping targetd output ..."
cat /tmp/targetd.log

# get/buid/run libstoragemgmt tests
./test/lsm_test.sh || exit 1

# Run the actual tests, these need work ...
echo "Running client test ..."
python3 client
Expand Down

0 comments on commit 07b85e2

Please sign in to comment.