From 5fc28ec9cf44b494b8f22d1d76688313921dd266 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Thu, 1 Dec 2016 08:17:18 +0100 Subject: [PATCH] Add bindep.txt/test-setup.sh to prepare the system Change-Id: I9ac3132c082a31020dc2bf2a778fb5c4c0836c4c --- bindep.txt | 35 +++++++++++++++++++++++++++++++++++ tools/test-setup.sh | 36 ++++++++++++++++++++++++++++++++++++ tox.ini | 4 ++++ 3 files changed, 75 insertions(+) create mode 100644 bindep.txt create mode 100755 tools/test-setup.sh diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 000000000..b704cd6a3 --- /dev/null +++ b/bindep.txt @@ -0,0 +1,35 @@ +# common dpkg +gettext [platform:dpkg] # For releasenotes job +build-essential [platform:dpkg] +libffi-dev [platform:dpkg] + +# common rpm +gcc [platform:rpm] +gcc-c++ [platform:rpm] +make [platform:rpm] +pkg-config [platform:rpm] +libffi-devel [platform:rpm] + +# kombu/pika +rabbitmq-server [platform:dpkg rabbit pika] + +# zeromq +redis-sentinel [platform:ubuntu !platform:ubuntu-trusty zeromq] +redis-server [platform:dpkg zeromq] +python-redis [platform:dpkg zeromq] +zookeeperd [platform:dpkg zeromq] + +# AMQP1 dpkg +qpidd [platform:dpkg amqp1] +sasl2-bin [platform:dpkg amqp1] +uuid-dev [platform:dpkg amqp1] +swig [platform:dpkg amqp1] + +# AMQP1 rpm +qpid-cpp-server [platform:rpm amqp1] +qpid-proton-c-devel [platform:rpm amqp1] +python-qpid-proton [platform:rpm amqp1] +cyrus-sasl-lib [platform:rpm amqp1] +cyrus-sasl-plain [platform:rpm amqp1] +libuuid-devel [platform:rpm amqp1] +swig [platform:rpm amqp1] diff --git a/tools/test-setup.sh b/tools/test-setup.sh new file mode 100755 index 000000000..e08a2d085 --- /dev/null +++ b/tools/test-setup.sh @@ -0,0 +1,36 @@ +#!/bin/bash -xe + +# This script will be run by OpenStack CI before unit tests are run, +# it sets up the test system as needed. +# Developer should setup their test systems in a similar way. + +# This setup needs to be run by a user that can run sudo. + +function is_fedora { + [ -f /usr/bin/yum ] && cat /etc/*release | grep -q -e "Fedora" +} + +# Looks like /home/jenkins/worspace/gate-oslo.messaging-tox-py27-func-rabbit-ubuntu-xenial +JOB_NAME=${WORKSPACE##*/} + +if [ "${JOB_NAME//gate-oslo.messaging-tox-py*-func-/}" == "${JOB_NAME}" ]; then + # not a functional test + exit 0 +fi + +BINDEP_PROFILE=$(echo $JOB_NAME | cut -d- -f6) +PACKAGES=$(tox -e bindep -- -b -f bindep.txt $BINDEP_PROFILE) + +# inspired from project-config install-distro-packages.sh +if apt-get -v >/dev/null 2>&1 ; then + sudo apt-get -qq update + sudo PATH=/usr/sbin:/sbin:$PATH DEBIAN_FRONTEND=noninteractive \ + apt-get -q --option "Dpkg::Options::=--force-confold" \ + --assume-yes install $PACKAGES +elif emerge --version >/dev/null 2>&1 ; then + sudo emerge -uDNq --jobs=4 @world + sudo PATH=/usr/sbin:/sbin:$PATH emerge -q --jobs=4 $PACKAGES +else + is_fedora && YUM=dnf || YUM=yum + sudo PATH=/usr/sbin:/sbin:$PATH $YUM install -y $PACKAGES +fi diff --git a/tox.ini b/tox.ini index 78a92a7c1..06d98af00 100644 --- a/tox.ini +++ b/tox.ini @@ -125,3 +125,7 @@ commands = pip-missing-reqs -d --ignore-module=oslo_messaging* --ignore-file=osl [testenv:releasenotes] commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + +[testenv:bindep] +deps = bindep +commands = bindep {posargs}