ceph/qa/run-standalone.sh
Sage Weil 3cd7d5eb22 Merge PR #22343 into master
* refs/pull/22343/head:
	qa/standalone remove ceph-disk from activate_osd helper
	cmake: remove subman.sh tests
	test remove ceph-disk directory
	debian: remove ceph_detect_init python files from base
	qa/standalone remove virtualenv paths for ceph-disk and ceph-detect-init
	debian: remove ceph-disk ceph-detect-init python files
	rpm: remove ceph-disk ceph-detect-init python files
	alpine: remove ceph-disk ceph-detect-init python files
	alpine: remove ceph-osd and parttypeuuid udev rules
	debian: remove ceph-osd and parttypeuuid udev rules
	rpm: remove ceph-osd and parttypeuuid udev rules
	ceph-helpers.sh: remove ceph-disk, set up osds directly
	CMakeLists.txt: add back CEPH_BUILD_VIRTUALENV
	alpine: remove ceph-disk, add ceph-volume in APKBUILD.in
	upstart: remove ceph-disk activation call
	doc/install add anchor for manual osd deployment in freebsd guide
	doc/dev remove ceph-disk from freebsd guide, link to manual reference
	doc/dev/config-key remove ceph-disk references
	doc/dev remove ceph-disk.rst
	doc/dev: change ceph-disk suite examples for ceph-deploy
	doc/man_index: remove ceph-disk, ceph-detect-init refs
	doc/install: remove ceph-disk from freebsd examples
	doc/rados remove ceph-disk from man references
	doc/man remove ceph-disk ref from ceph-volume-systemd
	doc/man: update reference from ceph-disk to ceph-volume
	doc/man: remove ceph-disk, ceph-detect-init from cmake
	doc/man/ceph-volume remove doc reference to ceph-disk
	doc/man: remove ceph-disk, ceph-detect-init
	qa/suites: remove ceph-disk
	qa/run-standalone.sh: remove requirement for ceph-detect-init virtualenv
	qa/workunits: remove ceph-detect-init from rbdmapfile test
	qa/workunits: remove ceph-detect-init from ceph-helpers-root.sh
	qa/workunits: remove ceph-disk
	build: remove ceph-disk from freebsd script
	cmake: remove ceph-disk, ceph-detect-init tox tests
	init-ceph: remove ceph-disk
	cmake: remove top-level entries for ceph-disk, ceph-detect-init
	debian: remove ceph-detect-init references
	debian: remove ceph-disk references
	src: remove ceph-detect-init tool
	rpm: remove ceph-disk, ceph-detect-init from spec file
	test: remove subman script
	script: remove subman script
	udev: remove parttypeuuid rules for ceph-disk
	tool remove ceph-disk from ps-ceph.pl
	upstart: remove ceph-disk conf file
	systemd: remove ceph-disk from CMakeLists
	systemd: remove ceph-disk service
	udev: remove ceph-disk rules
	src: remove ceph-disk tool
2018-06-19 07:07:55 -05:00

158 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
if [ ! -e Makefile -o ! -d bin ]; then
echo 'run this from the build dir'
exit 1
fi
function get_cmake_variable() {
local variable=$1
grep "$variable" CMakeCache.txt | cut -d "=" -f 2
}
function get_python_path() {
local ceph_lib=$1
shift
local py_ver=$(get_cmake_variable MGR_PYTHON_VERSION | cut -d '.' -f1)
if [ -z "${py_ver}" ]; then
if [ $(get_cmake_variable WITH_PYTHON2) = ON ]; then
py_ver=2
else
py_ver=3
fi
fi
echo $(realpath ../src/pybind):$ceph_lib/cython_modules/lib.$py_ver
}
if [ `uname` = FreeBSD ]; then
# otherwise module prettytable will not be found
export PYTHONPATH=$(get_python_path):/usr/local/lib/python2.7/site-packages
exec_mode=+111
KERNCORE="kern.corefile"
COREPATTERN="core.%N.%P"
else
export PYTHONPATH=$(get_python_path)
exec_mode=/111
KERNCORE="kernel.core_pattern"
COREPATTERN="core.%e.%p.%t"
fi
function cleanup() {
if [ -n "$precore" ]; then
sudo sysctl -w ${KERNCORE}=${precore}
fi
}
function finish() {
cleanup
exit 0
}
trap finish TERM HUP INT
PATH=$(pwd)/bin:$PATH
# add /sbin and /usr/sbin to PATH to find sysctl in those cases where the
# user's PATH does not get these directories by default (e.g., tumbleweed)
PATH=$PATH:/sbin:/usr/sbin
# TODO: Use getops
dryrun=false
if [[ "$1" = "--dry-run" ]]; then
dryrun=true
shift
fi
all=false
if [ "$1" = "" ]; then
all=true
fi
select=("$@")
location="../qa/standalone"
count=0
errors=0
userargs=""
precore="$(sysctl -n $KERNCORE)"
if [[ "${precore:0:1}" = "|" ]]; then
precore="${precore:1}"
fi
# If corepattern already set, avoid having to use sudo
if [ "$precore" = "$COREPATTERN" ]; then
precore=""
else
sudo sysctl -w ${KERNCORE}=${COREPATTERN}
fi
# Clean out any cores in core target directory (currently .)
if ls $(dirname $(sysctl -n $KERNCORE)) | grep -q '^core\|core$' ; then
mkdir found.cores.$$ 2> /dev/null || true
for i in $(ls $(dirname $(sysctl -n $KERNCORE)) | grep '^core\|core$'); do
mv $i found.cores.$$
done
echo "Stray cores put in $(pwd)/found.cores.$$"
fi
ulimit -c unlimited
for f in $(cd $location ; find . -perm $exec_mode -type f)
do
f=$(echo $f | sed 's/\.\///')
# This is tested with misc/test-ceph-helpers.sh
if [[ "$f" = "ceph-helpers.sh" ]]; then
continue
fi
if [[ "$all" = "false" ]]; then
found=false
for c in "${!select[@]}"
do
# Get command and any arguments of subset of tests ro tun
allargs="${select[$c]}"
arg1=$(echo "$allargs" | cut --delimiter " " --field 1)
# Get user args for this selection for use below
userargs="$(echo $allargs | cut -s --delimiter " " --field 2-)"
if [[ "$arg1" = $(basename $f) ]]; then
found=true
break
fi
if [[ "$arg1" = "$f" ]]; then
found=true
break
fi
done
if [[ "$found" = "false" ]]; then
continue
fi
fi
# Don't run test-failure.sh unless explicitly specified
if [ "$all" = "true" -a "$f" = "special/test-failure.sh" ]; then
continue
fi
cmd="$location/$f $userargs"
count=$(expr $count + 1)
echo "--- $cmd ---"
if [[ "$dryrun" != "true" ]]; then
if ! PATH=$PATH:bin \
CEPH_ROOT=.. \
CEPH_LIB=lib \
LOCALRUN=yes \
$cmd ; then
echo "$f .............. FAILED"
errors=$(expr $errors + 1)
fi
fi
done
cleanup
if [ "$errors" != "0" ]; then
echo "$errors TESTS FAILED, $count TOTAL TESTS"
exit 1
fi
echo "ALL $count TESTS PASSED"
exit 0