Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: CI failed plpython and plpython3 #1

Merged
merged 5 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 28 additions & 25 deletions src/pl/plpython/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,30 @@ else
REGRESS_OPTS += --load-extension=plpython3u
endif

REGRESS = plpython_record plpython_returns
# REGRESS = \
# plpython_schema \
# plpython_populate \
# plpython_test \
# plpython_do \
# plpython_global \
# plpython_import \
# plpython_spi \
# plpython_newline \
# plpython_void \
# plpython_params \
# plpython_setof \
# plpython_record \
# plpython_trigger \
# plpython_types \
# plpython_error \
# plpython_unicode \
# plpython_quote \
# plpython_composite \
# plpython_subtransaction \
# plpython_returns \
# plpython_gpdb \
# plpython_drop
# REGRESS = plpython_record plpython_returns plpython_schema
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line can be removed

REGRESS = \
plpython_schema \
plpython_populate \
plpython_test \
plpython_do \
plpython_global \
plpython_import \
plpython_spi \
plpython_newline \
plpython_void \
plpython_params \
plpython_setof \
plpython_record \
plpython_trigger \
plpython_types \
plpython_error \
plpython_unicode \
plpython_quote \
plpython_composite \
plpython_subtransaction \
plpython_returns \
plpython_gpdb \
plpython_drop

REGRESS_PLPYTHON3_MANGLE := $(REGRESS)

Expand Down Expand Up @@ -160,6 +160,9 @@ REGRESS := $(foreach test,$(REGRESS),$(if $(filter $(test),$(REGRESS_PLPYTHON3_M
.PHONY: pgregress-python3-mangle
pgregress-python3-mangle:
$(MKDIR_P) sql/python3 expected/python3 results/python3
# for python and python3 types and returns test are not the same.
cp expected/plpython_types_3.out expected/python3/plpython_types.out
cp expected/plpython_returns_3.out expected/python3/plpython_returns.out
for file in $(patsubst %,$(srcdir)/sql/%.sql,$(REGRESS_PLPYTHON3_MANGLE)) $(patsubst %,$(srcdir)/expected/%*.out,$(REGRESS_PLPYTHON3_MANGLE)); do \
sed -e 's/except \([[:alpha:]][[:alpha:].]*\), *\([[:alpha:]][[:alpha:]]*\):/except \1 as \2:/g' \
-e "s/<type 'exceptions\.\([[:alpha:]]*\)'>/<class '\1'>/g" \
Expand All @@ -176,7 +179,6 @@ pgregress-python3-mangle:
-e "s/EXTENSION plpython2u/EXTENSION plpython3u/Ig" \
$$file >`echo $$file | sed 's,^.*/\([^/][^/]*/\)\([^/][^/]*\)$$,\1python3/\2,'` || exit; \
done
cp expected/plpython_types_3.out expected/python3/plpython_types.out

check installcheck: pgregress-python3-mangle

Expand All @@ -189,6 +191,7 @@ check: all submake
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)

installcheck: submake
cp expected/plpython_returns_2.out expected/plpython_returns.out
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed since python3's expected is always in expected/python3/plpython_types.out

$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)


Expand Down
36 changes: 18 additions & 18 deletions src/pl/plpython/expected/plpython_returns.out
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,15 @@ SELECT test_return_bool('{None: None}') FROM gp_single_row;

-- From Python Object with bad str() function
SELECT test_return_bool(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
);
test_return_bool
------------------
t
(1 row)

SELECT * FROM test_return_bool(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
);
test_return_bool
------------------
Expand Down Expand Up @@ -541,23 +541,23 @@ FROM gp_single_row;

-- From Python Object with str() function
SELECT test_return_text(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
);
test_return_text
------------------
test
(1 row)

SELECT * FROM test_return_text(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
);
test_return_text
------------------
test
(1 row)

SELECT test_return_text(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
) FROM gp_single_row;
test_return_text
------------------
Expand All @@ -575,11 +575,11 @@ SELECT * FROM test_return_text(E'"test\\0"');
ERROR: could not convert Python object into cstring: Python string representation appears to contain null bytes
-- [ERROR] From Python Object with bad str() function
SELECT test_return_text(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
);
ERROR: could not create string representation of Python object (plpy_elog.c:106)
SELECT * FROM test_return_text(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
);
ERROR: could not create string representation of Python object (plpy_elog.c:106)
--
Expand Down Expand Up @@ -750,23 +750,23 @@ FROM gp_single_row;

-- From Python Object with str() function
SELECT test_return_bytea(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
);
test_return_bytea
-------------------
\x74657374
(1 row)

SELECT * FROM test_return_bytea(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
);
test_return_bytea
-------------------
\x74657374
(1 row)

SELECT test_return_bytea(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
) FROM gp_single_row;
test_return_bytea
-------------------
Expand Down Expand Up @@ -796,15 +796,15 @@ FROM gp_single_row;
-- Error conditions
-- [ERROR] From Python Object with bad str() function
SELECT test_return_bytea(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
);
ERROR: could not create bytes representation of Python object (plpy_elog.c:106)
SELECT * FROM test_return_bytea(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
);
ERROR: could not create bytes representation of Python object (plpy_elog.c:106)
SELECT test_return_bytea(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
) FROM gp_single_row;
ERROR: could not create bytes representation of Python object (plpy_elog.c:106) (seg0 slice1 127.0.0.1:25432 pid=24014) (plpy_elog.c:106)
--
Expand Down Expand Up @@ -2482,23 +2482,23 @@ FROM gp_single_row;

-- From Python Object with str() function
SELECT test_return_out_text(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
);
test_return_out_text
----------------------
test
(1 row)

SELECT * FROM test_return_out_text(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
);
test_return_out_text
----------------------
test
(1 row)

SELECT test_return_out_text(
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\""); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return \\"test\\"", globals()); y = Foo()'
) FROM gp_single_row;
test_return_out_text
----------------------
Expand All @@ -2516,11 +2516,11 @@ SELECT * FROM test_return_out_text(E'"test\\0"');
ERROR: could not convert Python object into cstring: Python string representation appears to contain null bytes
-- [ERROR] From Python Object with bad str() function
SELECT test_return_out_text(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
);
ERROR: could not create string representation of Python object (plpy_elog.c:106)
SELECT * FROM test_return_out_text(
E'1; exec("class Foo:\\n def __str__(self): return None"); y = Foo()'
E'1; exec("class Foo:\\n def __str__(self): return None", globals()); y = Foo()'
);
ERROR: could not create string representation of Python object (plpy_elog.c:106)
--
Expand Down
Loading