Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7618b10

Browse files
committed
Merge branch 'PGPROEE9_6' into CORE-470-test_64_xid
2 parents a19f64e + 84f14d9 commit 7618b10

File tree

584 files changed

+85560
-29132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

584 files changed

+85560
-29132
lines changed

.ci/build_and_test_world

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
3+
#
4+
# script which exececutes all the build stages. If script executed with
5+
# no arguments and something fails, every bit of logs, stack traces and
6+
# regression.diffs found would be printed, unless DESKTOP_SESSION
7+
# environment varible is defined
8+
# Use -i option to
9+
#
10+
# Following environment variables affect behavoir of this script.
11+
# TCLCONFIG - point to directory where tclConfig.sh resides.
12+
# required on debian-based system, where configure cannot
13+
# find it automatically
14+
# PYTHON - points to python binary to use. Allows to build with python3
15+
# on systems where default python in PATH is python2 or
16+
# vice versa
17+
# CC - C compiler to use
18+
# CFLAGS, LDFLAGS - on some systems requried to find 3rd party software
19+
#
20+
stage() {
21+
echo ====================================================================
22+
printf "== %-60s ==\\n" "$*"
23+
echo ====================================================================
24+
}
25+
26+
# Dump logs on exit unless interactive
27+
[ "$1" = "-i" -o -n "$DESKTOP_SESSION" ]|| trap .ci/collect_logs EXIT
28+
set -e
29+
stage configure
30+
./configure --enable-tap-tests --enable-debug --enable-cassert --enable-nls \
31+
--with-openssl --with-perl --with-tcl --with-python \
32+
--with-gssapi --with-libxml --with-libxslt --with-ldap \
33+
--with-icu --with-zstd ${TCLCONFIG:+--with-tclconfig=${TCLCONFIG}}
34+
stage make
35+
make
36+
stage "make contrib"
37+
make -C contrib
38+
stage "make check"
39+
make check-world
40+
stage "make installcheck"
41+
.ci/run_install_check
42+
trap true EXIT
43+
44+

.ci/collect_logs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python
2+
"""
3+
Prints out all the files with .log extension
4+
"""
5+
import os,re,subprocess
6+
cores=[]
7+
for root,dirs,files in os.walk("."):
8+
for name in files:
9+
path= root+"/"+name
10+
if name.endswith(".log") or name=="regression.diffs":
11+
print "*" * 76
12+
print "* %-72s *"%path
13+
print "*" * 76
14+
with open(path,"r") as f:
15+
print f.read()
16+
if name == "core" or re.match("core\\.[0-9]+",name) or re.match(".*\\.core",name):
17+
cores.append(path)
18+
print ", ".join(cores)
19+
for f in cores:
20+
print "*" * 76
21+
print "* %-72s *"%f
22+
print "*" * 76
23+
gdb=subprocess.Popen(["gdb","src/backend/postgres",f],
24+
stderr=subprocess.PIPE,stdout=subprocess.PIPE,stdin=subprocess.PIPE)
25+
out,err=gdb.communicate("bt\nq\n")
26+
if err.find("core file may not match specified")>=0:
27+
m=re.search("Core was generated by `(.*)'",out)
28+
if m:
29+
gdb=subprocess.Popen(["gdb",m.group(1),f],
30+
stdout=subprocess.PIPE,stdin=subprocess.PIPE)
31+
out,err=gdb.communicate("bt\nq\n")
32+
33+
34+
print out
35+
36+
37+
38+

.ci/find_free_port

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/python
2+
import sys,socket,errno
3+
if len(sys.argv)>1:
4+
port=int(sys.argv[1])
5+
else:
6+
port=5900
7+
8+
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
9+
while True:
10+
try:
11+
s.bind(("",port))
12+
except socket.error as e:
13+
if e.errno== errno.EADDRINUSE:
14+
port+=1
15+
continue
16+
else:
17+
raise e
18+
break
19+
20+
s.close()
21+
print port
22+

.ci/make_test_base

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env python
2+
"""
3+
Receives one parameter - PGDATA directory
4+
Creates test base using first initdb found in the PATH
5+
Searches contrib directory for additional directives to
6+
put into postgresql conf.
7+
8+
On success, starts database
9+
"""
10+
import os,sys,subprocess,glob,re,os.path,time
11+
12+
if len(sys.argv)!=2:
13+
print >>sys.stderr,"Usage %s data-directory" % sys.argv[0]
14+
sys.exit(1)
15+
16+
datadir=sys.argv[1]
17+
18+
if os.access(datadir,os.R_OK):
19+
import shutil
20+
shutil.rmtree(datadir)
21+
os.mkdir(datadir)
22+
env=os.environ.copy()
23+
env["LANG"]="C"
24+
with open("initdb.log","w") as f:
25+
exitcode=subprocess.call(["initdb","-E","UTF8",datadir],env=env,stdout=f,stderr=subprocess.STDOUT)
26+
if exitcode:
27+
sys.exit(exitcode)
28+
# Collect extra config option
29+
addopts={}
30+
for module in glob.glob("contrib/*"):
31+
if not os.path.isdir(module):
32+
continue
33+
if not os.access(module+"/Makefile",os.R_OK):
34+
continue
35+
with open(module+"/Makefile","r") as makefile:
36+
var={"top_srcdir":os.getcwd()}
37+
for line in makefile:
38+
m=re.match("\s*(\w+)\s*=\s*(.*)",line)
39+
if m:
40+
var[m.group(1)]=m.group(2)
41+
if "EXTRA_REGRESS_OPTS" in var:
42+
m=re.search("--temp-config=(\S+)",var["EXTRA_REGRESS_OPTS"])
43+
if m:
44+
filename=re.sub("\\$[{(](\w+)[})]",lambda m: var[m.group(1)],m.group(1))
45+
with open(filename,"r") as config:
46+
for line in config:
47+
m=re.match("(\w\S*\w)\s*=\s*(\S.*)\s*",line)
48+
if m:
49+
opt=m.group(1)
50+
value=m.group(2)
51+
if opt in addopts:
52+
if value[0]=="'":
53+
addopts[opt]=addopts[opt][:-1]+", "+value[1:]
54+
else:
55+
addopts[opt]+=", ".value
56+
else:
57+
addopts[opt]=value
58+
59+
if addopts:
60+
with open(datadir+"/postgresql.conf","a") as f:
61+
for opt,value in addopts.items():
62+
print >> f,"%s=%s"%(opt,value)
63+
with open("initdb.log","a") as f:
64+
exitcode=subprocess.call(["pg_ctl","start","-D",datadir,"-l",datadir+"/postmaster.log"],env=env,stdout=f,stderr=subprocess.STDOUT)
65+
if exitcode:
66+
sys.exit(exitcode)
67+
68+
failtime=time.time()+60
69+
print "Waiting for database to start"
70+
while time.time() < failtime:
71+
exitcode=subprocess.call(["psql","postgres","-c","select version()"],stderr=subprocess.STDOUT)
72+
if exitcode == 0:
73+
sys.exit(0)
74+
print >>sys.stderr,"Database havent't started in 60 seconds"
75+
sys.exit(1)
76+
77+

.ci/run_install_check

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
# Makes temporary installation and runs installcheck-world on it
3+
# Should be run as non-privileged user.
4+
# Exit on all errors
5+
# If run without arguments, makes installcheck-world
6+
# Otherwise first argument is interpreted as subdirectory
7+
# to change before runnning make installchedk
8+
# i.e
9+
# run_install_check .
10+
# test core only
11+
# run_install_check contrib
12+
# tests contrib only
13+
# etc.
14+
# All other arguments are passed to Makefile intact
15+
# To make possible pass arguments to installcheck-world
16+
# run_install_check world
17+
# does the same as no args
18+
set -e
19+
# Install
20+
make install prefix=`pwd`/tmp_install
21+
make install prefix=`pwd`/tmp_install -C contrib
22+
23+
# Setup an environment
24+
LD_LIBRARY_PATH=$(pwd)/tmp_install/lib
25+
PATH=$(pwd)/tmp_install/bin:${PATH}
26+
PGDATA=$(pwd)/tmp_base
27+
export LD_LIBRARY_PATH PATH PG_DATA
28+
29+
# create installation
30+
PGPORT=`./.ci/find_free_port 5432`
31+
export PGPORT
32+
./.ci/make_test_base $PGDATA
33+
#run checks
34+
set +e
35+
if [ -z "$1" -o "$1" = "world" ]; then
36+
make installcheck-world prefix=`pwd`/tmp_install NO_LOCALE=1
37+
else
38+
dir=$1
39+
shift
40+
make -C "$dir" installcheck prefix=`pwd`/tmp_install NO_LOCALE=1 ${@:+"$@"}
41+
fi
42+
code=$?
43+
pg_ctl stop -D $PGDATA
44+
exit $code

.gitlab-ci.yml

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,58 @@
1-
image: debian
2-
31
stages:
2+
- prepare
3+
- build
44
- test
55

6-
before_script:
6+
.prepare-deb:
7+
stage: prepare
8+
image: ubuntu:16.04
9+
tags:
10+
- deb
11+
- docker
12+
only:
13+
- /^PGPRO.*9_[56]$/
14+
before_script:
715
- export DEBIAN_FRONTEND=noninteractive
816
- export CORES=$(grep -c ^processor /proc/cpuinfo)
917
- uname -a
1018
- df -h
11-
12-
test:ubuntu-16.04:
13-
stage: test
14-
image: ubuntu:16.04
15-
only:
16-
- PGPROEE9_6
17-
before_script:
18-
- apt-get update && apt-get install -y sudo gcc make flex bison libreadline-dev zlib1g-dev openjade libzstd-dev opensp docbook docbook-xml docbook-xsl libxml2-utils xsltproc python-dev libicu-dev
1919
script:
20-
- ./configure --prefix=/opt/pgproee --with-zstd --with-icu --with-python
21-
- make -j $CORES world
22-
- make check-world
20+
- echo "Current user id is `id`"
21+
- apt-get update && apt-get install -y sudo gcc make flex bison libreadline-dev zlib1g-dev openjade libzstd-dev opensp docbook docbook-xml docbook-xsl libxml2-utils xsltproc python-dev libicu-dev
22+
- id -u postgres || adduser --disabled-login --gecos "Postgres" postgres
23+
# Template build
24+
.build_unix: &build_unix_def
25+
stage: build
26+
tags:
27+
- unix
28+
only:
29+
- /^PGPRO.*9_[56]$/
30+
script:
31+
- .ci/build_and_test_world
32+
when: always
33+
34+
build_docs_job:
35+
stage: build
2336
when: always
37+
only:
38+
- /^PGPRO.*9_[56]$/
39+
tags:
40+
- docs
41+
script:
42+
- ./configure
43+
- make -C doc
44+
45+
# Here definitions of particular build enviroments start
46+
47+
build_debian_8:
48+
<<: *build_unix_def
49+
tags:
50+
- jessie
51+
- 64bit
52+
53+
build_debian_7_32:
54+
<<: *build_unix_def
55+
tags:
56+
- wheezy
57+
- 32bit
58+

COPYRIGHT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PostgreSQL Database Management System
22
(formerly known as Postgres, then as Postgres95)
33

4-
Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
4+
Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
55

66
Portions Copyright (c) 1994, The Regents of the University of California
77

0 commit comments

Comments
 (0)