1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/bin/sh
set -e
do_preseed() {
pkg="$1"
template="$2"
type="$3"
value="$4"
echo "Preseeding $template to $value"
echo $pkg $template $type "$value" | debconf-set-selections || \
echo "Failed to load preseed '$template'" 1>&2
}
do_reconfigure() {
package="$1"
echo "Silently running dpkg-reconfigure on package $package ... "
dpkg -l $package | grep -q -E "^ii\s+.*" 1>/dev/null 2>/dev/null && {
dpkg-reconfigure -fnoninteractive -pcritical $package && echo "DONE." || echo "FAILED!!!"
} || echo "NEEDS INSTALL."
echo
}
export GROUP_SQL_MYSQL_TEST_CONFIG='{"group":{"sql":{"mysql":{"adapter":"mysql","host":"localhost","username":"root","password":"r00t","dbname":"test","charset":"utf-8"}}}}'
export GROUP_SQL_MYSQLI_TEST_CONFIG='{"group":{"sql":{"mysqli":{"adapter":"mysqli","host":"localhost","username":"root","password":"r00t","dbname":"test","charset":"utf-8"}}}}'
export GROUP_SQL_PDO_MYSQL_TEST_CONFIG='{"group":{"sql":{"pdo_mysql":{"adapter":"pdo_mysql","host":"localhost","username":"root","password":"r00t","dbname":"test","charset":"utf-8"}}}}'
export GROUP_SQL_PDO_PGSQL_TEST_CONFIG='{"group":{"sql":{"pdo_pgsql":{"adapter":"pdo_pgsql","host":"localhost","username":"test","password":"test","dbname":"test","charset":"utf-8"}}}}'
export GROUP_LDAP_TEST_CONFIG='{"group":{"ldap":{"hostspec":"localhost","port":"389","basedn":"dc=debian,dc=test","binddn":"", "bindpw": "", "writedn": "cn=admin,dc=debian,dc=test","writepw":"H0rd3","gid":"cn","newgroup_objectclass":["posixGroup","hordeGroup"],"search":{"objectclass":"posixGroup"}}}}'
mysql -e "create database IF NOT EXISTS test; ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'r00t';" -uroot
su postgres --command "psql -c \"CREATE USER test WITH PASSWORD 'test';\""
su postgres --command "psql -c \"CREATE DATABASE test OWNER test;\""
do_preseed slapd shared/organization string "debian.test"
do_preseed slapd slapd/domain string "debian.test"
do_preseed slapd slapd/password1 password "H0rd3"
do_preseed slapd slapd/password2 password "H0rd3"
do_reconfigure slapd
DEBIAN_FRONTEND=noninteractive apt-get -y install slapd
# Piping stderr to /dev/null (output of 'SASL/EXTERNAL authentication started') to
# avoid autopkgtest failure (must not have anything appear on stderr).
ldapadd -H ldapi:/// -Y EXTERNAL -f /etc/ldap/schema/horde/rfc2739.ldif 2>/dev/null
ldapadd -H ldapi:/// -Y EXTERNAL -f /etc/ldap/schema/horde/horde.ldif 2>/dev/null
cd Horde_Group*/test/./Horde/Group
# We drop privileges to run tests
touch .phpunit.result.cache
chown www-data:www-data .phpunit.result.cache
su www-data --preserve-environment --shell /bin/sh --command 'phpunit -v .'
|