Server IP : 127.0.0.2 / Your IP : 3.144.70.25 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/postgresql-common/ |
Upload File : |
#!/bin/sh # Run integration tests (on the installed packages). # # (C) 2005-2012 Martin Pitt <mpitt@debian.org> # (C) 2012-2015 Christoph Berg <myon@debian.org> # # 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. set -eu # default config TESTSDIR="$(dirname $0)/t" : ${PG_UMASKS="022 077"} help () { echo "postgresql-common testsuite" echo "Syntax: $0 [options] [test ...]" echo " -D drop all existing clusters (USE WITH CARE)" echo " -f number run tests starting at this number" echo " -i install packages for versions specified by -v" echo " -M don't mount tmpfses, run in the host system" echo " -s start a shell in the testbed on failure" echo " -u 'umask ...' umasks to run testsuite with [default: 022 077]" echo " -v 'version ...' PostgreSQL versions to test [default: client versions installed]" echo " -V debug output" exit ${1:-0} } # option parsing while getopts "Dhf:iMsu:v:V" opt ; do case $opt in D) DROP_ALL_CLUSTERS=1 ;; f) FROM="$OPTARG" ;; i) INSTALL=1 ;; h) help ;; M) NO_TMPFS=1 ;; s) export FAILURE="shell" ;; u) PG_UMASKS="$OPTARG" ;; v) export PG_VERSIONS="$OPTARG" ;; # used in t/TestLib.pm V) VERBOSE=1 ;; *) help 1 ;; esac done if [ "$(id -u)" != 0 ]; then echo "Error: this test suite needs to be run as root" >&2 exit 1 fi # install packages for versions specified by -v # needs network for apt, so run before unshare if [ "${INSTALL:-}" ] && [ -z "${UNSHARED:-}" ]; then for v in $PG_VERSIONS; do apt-get install -y postgresql-contrib-$v \ postgresql-plperl-$v \ postgresql-plpython-$v \ postgresql-plpython3-$v \ postgresql-pltcl-$v \ postgresql-server-dev-$v done apt-get install -y libecpg-dev \ locales \ logrotate \ procps \ netcat-openbsd \ hunspell-en-us fi # requirements on RedHat: # perl-Test-Simple perl-Time-HiRes # shift away args shift $(($OPTIND - 1)) # use the local pgcommon.sh (either in the build tree or /usr/share/postgresql-common) . ./pgcommon.sh # install locales locale_gen \ en_US.UTF-8 UTF-8 \ ru_RU ISO-8859-5 \ ru_RU.UTF-8 UTF-8 # stop currently running clusters if [ -x "/etc/init.d/postgresql" ]; then /etc/init.d/postgresql stop fi # drop all existing clusters if the user requested it if [ "${DROP_ALL_CLUSTERS:-}" ]; then pg_lsclusters -h | while read ver cluster rest; do pg_dropcluster $ver $cluster done fi # set up test directories dirs="/etc/postgresql /var/lib/postgresql /var/log/postgresql /var/run/postgresql" if [ -z "${NO_TMPFS:-}" ]; then # clean up after us cleanup () { set +e umount -l $dirs sed -i -e '/# by pg-testsuite/d' /etc/postgresql-common/createcluster.conf systemctl daemon-reload 2> /dev/null || : # poke generator to handle the system's clusters again } trap "cleanup" 0 HUP INT QUIT ILL ABRT PIPE TERM for d in $dirs; do mkdir -p $d mount -t tmpfs tmpfs $d done chown root:root /etc/postgresql ; chmod 755 /etc/postgresql chown postgres:postgres /var/lib/postgresql ; chmod 755 /var/lib/postgresql chown root:postgres /var/log/postgresql ; chmod 1775 /var/log/postgresql chown postgres:postgres /var/run/postgresql ; chmod 2775 /var/run/postgresql fi if [ -d /run/systemd/system ]; then systemctl daemon-reload # poke generator to forget the system's clusters fi # the RPM packages enable the logging_collector by default, which the testsuite # doesn't like. We disable it unconditionally here. if ! grep -q logging_collector /etc/postgresql-common/createcluster.conf; then echo "logging_collector = off # by pg-testsuite" >> /etc/postgresql-common/createcluster.conf fi # reset core limit for pg_ctl tests ulimit -S -c 0 # set environment unset TMPDIR unset LC_ALL export LANG=en_US.utf8 # set variables which cause taint check errors export IFS export CDPATH=/usr export ENV=/nonexisting export BASH_ENV=/nonexisting if [ $# -eq 0 ]; then set -- $TESTSDIR/*.t fi # dump environment for debugging if [ "${VERBOSE:-}" ]; then echo "Environment:" env | sort echo "Mounts:" cat /proc/mounts echo "Namespaces:" ls -l /proc/self/ns echo fi for U in $PG_UMASKS; do case $U in 022) TYPE="default" ;; 077) TYPE="tight" ;; *) TYPE="custom" ;; esac echo "====== Running all tests with $TYPE umask $U =======" umask $U for T; do TBASE=${T##*/} [ "${FROM:-}" ] && [ "${TBASE%%_*}" -lt "${FROM:-}" ] && continue echo "=== Running test $TBASE ... ===" perl $T || { EXIT=$? if [ "${FAILURE:-}" ]; then echo "*** $TBASE failed with status $EXIT, dropping you into a shell in the testbed ***" ${SHELL:-/bin/sh} fi exit $EXIT } done done