While running the script command varDump postgresqlDataDir; was executed, but it was no longer found. It is not needed for the script to work Tests for libecpg were commented, so our changes from the documentation are visible
89 lines
3.4 KiB
Bash
Executable file
89 lines
3.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
#
|
|
# runtest.sh of /CoreOS/postgresql/Sanity/libecpg
|
|
# Description: Sanity test for libecpg library
|
|
# Author: Honza Horak <hhorak@redhat.com>
|
|
#
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
#
|
|
# Copyright (c) 2015 Red Hat, Inc.
|
|
#
|
|
# This program is free software: you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation, either version 2 of
|
|
# the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be
|
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
# PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see http://www.gnu.org/licenses/.
|
|
#
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# Include Beaker environment
|
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
|
|
|
PACKAGE="postgresql"
|
|
PACKAGE_LIBECPG_DEVEL="libecpg-devel"
|
|
|
|
rlJournalStart
|
|
rlPhaseStart FAIL "Setup"
|
|
rlRun "rlImport database/postgresql"
|
|
PGDATA="$(postgresqlDataDir)";
|
|
PACKAGES="$PACKAGES ${postgresqlPackagePrefix}${PACKAGE_LIBECPG_DEVEL} \
|
|
${postgresqlPackagePrefix}${PACKAGE} \
|
|
${postgresqlPackagePrefix}${PACKAGE}-server";
|
|
for PACKAGE in $PACKAGES; do
|
|
rlAssertRpm $PACKAGE
|
|
done
|
|
rlRun "TestDir=$PWD"
|
|
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
|
rlRun "pushd $TmpDir"
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStartSetup "Database setup"
|
|
# varDump postgresqlDataDir;
|
|
[[ -d $postgresqlDataDir ]] && rlFileBackup $postgresqlDataDir;
|
|
postgresqlCleanup;
|
|
postgresqlInitDB;
|
|
rlRun "postgresqlChangeAuth trust" 0 "Allow 'trust' authentication"
|
|
#rlRun "sed -i -e 's/ident/trust/' ${postgresqlDataDir}/pg_hba.conf" 0 "Allow 'trust' authentication"
|
|
cat /var/lib/pgsql/data/pg_hba.conf
|
|
postgresqlStart;
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStartTest
|
|
postgresqlExec "createdb testdb" "postgres"
|
|
rlRun "cp $TestDir/testecpg-decimal.pgc ."
|
|
rlRun "ecpg testecpg-decimal.pgc"
|
|
rlRun "cc -o testecpg-decimal testecpg-decimal.c -lecpg -lpgtypes"
|
|
rlRun "chown postgres:postgres *"
|
|
rlRun -s "./testecpg-decimal"
|
|
rlAssertGrep "numeric = 12" $rlRun_LOG
|
|
rlAssertGrep "numeric = 12.4" $rlRun_LOG
|
|
rlAssertGrep "numeric = 12.35" $rlRun_LOG
|
|
rlAssertGrep "decimal = 23" $rlRun_LOG
|
|
rlAssertGrep "decimal = 23.5" $rlRun_LOG
|
|
rlAssertGrep "decimal = 23.46" $rlRun_LOG
|
|
|
|
rlRun "cp $TestDir/testecpg-interval.pgc ."
|
|
rlRun "ecpg testecpg-interval.pgc"
|
|
rlRun "cc -o testecpg-interval testecpg-interval.c -lecpg -lpgtypes"
|
|
rlRun -s "./testecpg-interval"
|
|
rlAssertGrep "interval = @ 1 min" $rlRun_LOG
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStart WARN "Cleanup";
|
|
rlRun "popd"
|
|
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
|
rm -f $rlRun_LOG;
|
|
rlRun "postgresqlCleanup";
|
|
rlFileRestore;
|
|
rlPhaseEnd
|
|
rlJournalPrintText
|
|
rlJournalEnd
|