mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-24 00:52:40 +00:00
Test roundtrip with a binary cursor for both geometry and geography
With this commit the binary.sql testcase doesn't test the actual binary output anymore but rather uses canonical binary output to copy objects to a temporary file, then uses canonical binary input to read the objects again into a new table and then compares the original and the final tables. In order for this to work run_test was modified to pass a :tmpfile variable to testcases. Next stop: typmod for canonical binary input. See ticket #850 for more info git-svn-id: http://svn.osgeo.org/postgis/trunk@8861 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
ea3128b4ec
commit
7091a479fc
|
@ -31,7 +31,11 @@ SELECT st_force_4d(g) FROM tm.geoms WHERE id < 15 ORDER BY id;
|
|||
INSERT INTO tm.geoms(g)
|
||||
SELECT st_setsrid(g,4326) FROM tm.geoms ORDER BY id;
|
||||
|
||||
COPY ( SELECT g FROM tm.geoms ORDER BY id ) TO STDOUT WITH BINARY;
|
||||
COPY tm.geoms TO :tmpfile WITH BINARY;
|
||||
CREATE TABLE tm.geoms_in AS SELECT * FROM tm.geoms LIMIT 0;
|
||||
COPY tm.geoms_in FROM :tmpfile WITH BINARY;
|
||||
SELECT 'geometry', count(*) FROM tm.geoms_in i, tm.geoms o WHERE i.id = o.id
|
||||
AND ST_OrderingEquals(i.g, o.g);
|
||||
|
||||
CREATE TABLE tm.geogs AS SELECT id,g::geography FROM tm.geoms
|
||||
WHERE geometrytype(g) NOT LIKE '%CURVE%'
|
||||
|
@ -41,6 +45,10 @@ WHERE geometrytype(g) NOT LIKE '%CURVE%'
|
|||
AND geometrytype(g) NOT LIKE 'TIN%'
|
||||
;
|
||||
|
||||
COPY ( SELECT g FROM tm.geogs ORDER BY id ) TO STDOUT WITH BINARY;
|
||||
COPY tm.geogs TO :tmpfile WITH BINARY;
|
||||
CREATE TABLE tm.geogs_in AS SELECT * FROM tm.geogs LIMIT 0;
|
||||
COPY tm.geogs_in FROM :tmpfile WITH BINARY;
|
||||
SELECT 'geometry', count(*) FROM tm.geogs_in i, tm.geogs o WHERE i.id = o.id
|
||||
AND ST_OrderingEquals(i.g::geometry, o.g::geometry);
|
||||
|
||||
DROP SCHEMA tm CASCADE;
|
||||
--DROP SCHEMA tm CASCADE;
|
||||
|
|
Binary file not shown.
|
@ -43,7 +43,8 @@ if [ -z "$TMPDIR" ]; then
|
|||
TMPDIR=/tmp/pgis_reg_$$
|
||||
fi
|
||||
|
||||
mkdir -p ${TMPDIR}
|
||||
mkdir -p ${TMPDIR}/tmp
|
||||
chmod 777 ${TMPDIR}/tmp
|
||||
|
||||
VERBOSE=0
|
||||
OPT_CLEAN=no
|
||||
|
@ -179,12 +180,11 @@ run_simple_test ()
|
|||
show_progress
|
||||
|
||||
OUTFILE="${TMPDIR}/test_${RUN}_out"
|
||||
TMPFILE="${TMPDIR}/test_${RUN}_tmp"
|
||||
TMPFILE="${TMPDIR}/tmp/test_${RUN}_tmp"
|
||||
DIFFILE="${TMPDIR}/test_${RUN}_diff"
|
||||
|
||||
# Use intermediate file to prevent MingW buffering problems
|
||||
${PSQL} -tXA < "${_sql}" ${DB} > ${TMPFILE} 2>&1
|
||||
cat ${TMPFILE} \
|
||||
${PSQL} -v "tmpfile='${TMPFILE}'" -tXA < "${_sql}" ${DB} 2>&1 \
|
||||
| grep --binary-files=text -v "^$" \
|
||||
| grep --binary-files=text -v "^INSERT" \
|
||||
| grep --binary-files=text -v "^DELETE" \
|
||||
|
@ -203,7 +203,7 @@ run_simple_test ()
|
|||
| sed 's/Self-intersection .*/Self-intersection/' \
|
||||
| sed 's/^ROLLBACK/COMMIT/' \
|
||||
> "${OUTFILE}"
|
||||
rm ${TMPFILE}
|
||||
rm -f ${TMPFILE} # should we keep this ?
|
||||
|
||||
for expfiles in "${_expected}*"; do
|
||||
if diff -u "${_expected}" "${OUTFILE}" > ${DIFFILE}; then
|
||||
|
|
Loading…
Reference in a new issue