4 echo "please run via 'make test' from the project directory"
8 if [ $
(id
-u) -ne 0 ]; then
9 echo "please run as root because we need to create test sites"
13 export PATH
="$PATH:/usr/sbin"
15 # do we install a package?
16 if [ ! -z "$OMD_PACKAGE" ]; then
17 echo "###################################################################"
19 OMD_PACKAGE
=`ls -1 $OMD_PACKAGE | head -n 1`
21 if [ ! -e "$OMD_PACKAGE" ]; then
22 echo "cannot install $OMD_PACKAGE: no such file"
25 echo "installing " `basename $OMD_PACKAGE`
28 if [ -x /usr
/bin
/apt-get
]; then
29 VERSION
=`dpkg-deb -W --showformat='${Package}\n' $OMD_PACKAGE | sed -e 's/^omd-//'`
30 DEPENDS
=`dpkg-deb -W --showformat='${Depends}\n' $OMD_PACKAGE | sed -e 's/debconf.*debconf-2.0,//' | tr -d ','`
31 apt-get
-qq update
&& \
32 DEBIAN_FRONTEND
=noninteractive apt-get
-q -y --no-install-recommends install $DEPENDS && \
33 dpkg
-i $OMD_PACKAGE && \
34 update-alternatives
--set omd
/omd
/versions
/$VERSION
37 elif [ -x /usr
/bin
/yum
]; then
38 # remove version if alread installed
39 /usr
/bin
/yum remove
-y `rpm -qp $OMD_PACKAGE`
40 /usr
/bin
/yum
install -y --nogpgcheck $OMD_PACKAGE
43 elif [ -x /usr
/bin
/zypper
]; then
44 # remove version if alread installed
45 /usr
/bin
/zypper
--quiet --non-interactive remove
`rpm -qp $OMD_PACKAGE`
46 /usr
/bin
/zypper
--quiet --non-interactive install $OMD_PACKAGE
50 if [ $rc -ne 0 ]; then
51 echo "Package installation failed, cannot run tests..."
56 # set perl environment
57 PERLARCH
=$
(perl
-e 'use Config; print $Config{archname}')
58 export PERL5LIB
="/omd/versions/default/lib/perl5/lib/perl5/${PERLARCH}:/omd/versions/default/lib/perl5/lib/perl5:$PERL5LIB"
60 if [ -z $OMD_BIN ]; then
64 echo "###################################################################"
65 echo "running tests..."
72 OMD_BIN
=$OMD_BIN PERL_DL_NONLAZY
=1 /usr
/bin
/env perl
"-MExtUtils::Command::MM" "-e" "test_harness($VERBOSE)" $TESTS