check_oracle_health: update to 1.9
[omd.git] / t / test_all.sh
bloba92e43183510cf63e233538eb899039c3a70a85d
1 #!/bin/bash
3 if [ ! -d t ]; then
4 echo "please run via 'make test' from the project directory"
5 exit 1
6 fi
8 if [ $(id -u) -ne 0 ]; then
9 echo "please run as root because we need to create test sites"
10 exit 1
13 # do we install a package?
14 if [ ! -z "$OMD_PACKAGE" ]; then
15 echo "###################################################################"
17 OMD_PACKAGE=`ls -1 $OMD_PACKAGE | head -n 1`
19 if [ ! -e "$OMD_PACKAGE" ]; then
20 echo "cannot install $OMD_PACKAGE: no such file"
23 echo "installing " `basename $OMD_PACKAGE`
25 # Debian / Ubuntu
26 if [ -x /usr/bin/apt-get ]; then
27 VERSION=`dpkg-deb -W --showformat='${Package}\n' $OMD_PACKAGE | sed -e 's/^omd-//'`
28 DEPENDS=`dpkg-deb -W --showformat='${Depends}\n' $OMD_PACKAGE | sed -e 's/debconf.*debconf-2.0,//' | tr -d ','`
29 apt-get -qq update && \
30 DEBIAN_FRONTEND=noninteractive apt-get -q -y --no-install-recommends install $DEPENDS && \
31 dpkg -i $OMD_PACKAGE && \
32 /usr/sbin/update-alternatives --set omd /omd/versions/$VERSION
34 # Centos
35 elif [ -x /usr/bin/yum ]; then
36 # remove version if alread installed
37 /usr/bin/yum remove -y `rpm -qp $OMD_PACKAGE`
38 /usr/bin/yum install -y --nogpgcheck $OMD_PACKAGE
40 # Suse
41 elif [ -x /usr/bin/zypper ]; then
42 # remove version if alread installed
43 /usr/bin/zypper --quiet --non-interactive remove `rpm -qp $OMD_PACKAGE`
44 /usr/bin/zypper --quiet --non-interactive install $OMD_PACKAGE
47 rc=$?
48 if [ $rc -ne 0 ]; then
49 echo "Package installation failed, cannot run tests..."
50 exit 1
54 # set perl environment
55 PERLARCH=$(perl -e 'use Config; print $Config{archname}')
56 export PERL5LIB="/omd/versions/default/lib/perl5/lib/perl5/${PERLARCH}:/omd/versions/default/lib/perl5/lib/perl5:$PERL5LIB"
58 if [ -z $OMD_BIN ]; then
59 OMD_BIN=/usr/bin/omd
62 echo "###################################################################"
63 echo "running tests..."
64 TESTS=t/*.t
65 VERBOSE="0"
66 if [ ! -z $1 ]; then
67 TESTS=$*
68 VERBOSE="1"
70 OMD_BIN=$OMD_BIN PERL_DL_NONLAZY=1 /usr/bin/env perl "-MExtUtils::Command::MM" "-e" "test_harness($VERBOSE)" $TESTS