diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-06-25 19:45:53 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-06-27 21:38:15 +0300 |
commit | 316dfdd917bec6a218f431211d28bf8df6b6fb0f (patch) | |
tree | 5541073f9851f44c2bd67b4959dc776ee3c3810f /import-layers/meta-openembedded/meta-oe/recipes-dbs/psqlodbc/files/run-ptest | |
parent | 36acd3e888044dea2ac0b2946f15616f968388c9 (diff) | |
download | openbmc-316dfdd917bec6a218f431211d28bf8df6b6fb0f.tar.xz |
Yocto 2.5
Move OpenBMC to Yocto 2.5(sumo)
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I5c5ad6904a16e14c1c397f0baf10c9d465594a78
Diffstat (limited to 'import-layers/meta-openembedded/meta-oe/recipes-dbs/psqlodbc/files/run-ptest')
-rw-r--r-- | import-layers/meta-openembedded/meta-oe/recipes-dbs/psqlodbc/files/run-ptest | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-dbs/psqlodbc/files/run-ptest b/import-layers/meta-openembedded/meta-oe/recipes-dbs/psqlodbc/files/run-ptest new file mode 100644 index 000000000..6b41c6369 --- /dev/null +++ b/import-layers/meta-openembedded/meta-oe/recipes-dbs/psqlodbc/files/run-ptest @@ -0,0 +1,46 @@ +#!/bin/sh + +BASEDIR="$(dirname $(readlink -f $0))" + +# init and start postgresql server for testing +PGDATA="/var/lib/postgresql/data" +if [ -f "${PGDATA}/PG_VERSION" ]; then + echo "Data directory is not empty! Skip initdb." +else + echo "Initializing database: " + chown -R postgres:postgres ${PGDATA} + su -l postgres -c "/usr/bin/initdb --pgdata='$PGDATA'" +fi + +SYSV_INIT="/etc/init.d/postgresql-server" +if [ -e ${SYSV_INIT} ]; then + RESTART_POSTGRESQL="${SYSV_INIT} restart" + STOP_POSTGRESQL="${SYSV_INIT} stop" +else + RESTART_POSTGRESQL="systemctl restart postgresql" + STOP_POSTGRESQL="systemctl stop postgresql" +fi + +${RESTART_POSTGRESQL} || echo "Failed to restart postgresql, skip the tests." + +if [ ! -d ${BASEDIR}/results ]; then + mkdir ${BASEDIR}/results +fi + +# Generate odbc config files and reset db +${BASEDIR}/odbcini-gen.sh || echo "FAIL: Generate odbc config files" +ODBCSYSINI=. ODBCINSTINI=./odbcinst.ini ODBCINI=./odbc.ini \ + ${BASEDIR}/reset-db < ${BASEDIR}/sampletables.sql \ + || echo "FAIL: reset db with sample tables" + +# Run the actual tests +TESTS= +for i in `ls ${BASEDIR}/exe/*-test`; do + TESTS="$TESTS $(basename ${i%-test})" +done + +${BASEDIR}/runsuite ${TESTS} --inputdir=${BASEDIR} + +# Cleanup +${STOP_POSTGRESQL} +rm -f regression.diffs odbcinst.ini odbc.ini |