Skip to content

Commit

Permalink
the pgx-tests crate doesn't have a default cshim feature. This is…
Browse files Browse the repository at this point in the history
… due to rust-lang/cargo#7160 and how if it were default we wouldn't be able to turn it off from a top-level `cargo test --all --no-default-features --features pg14`.
  • Loading branch information
eeeebbbbrrrr committed Dec 18, 2022
1 parent b944f79 commit 9646bdf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/docker/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ docker build \
-f ".github/docker/Dockerfile.$DOCKERFILE_ID" \
.

echo "Running PGX test suite using Postgres version $PG_MAJOR_VER in container $DOCKERFILE_ID"
echo "Running PGX test suite using Postgres version $PG_MAJOR_VER in container $DOCKERFILE_ID with 'cshim'"

docker run pgx \
cargo test \
--no-default-features \
--features "pg$PG_MAJOR_VER" \
--features "pg$PG_MAJOR_VER cshim" \
"$CARGO_LOCKED_OPTION"
15 changes: 13 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,25 @@ jobs:
- name: Run base-level tests
run: |
cargo test \
--features "pg$PG_VER" --no-default-features \
--features "pg$PG_VER" \
--package cargo-pgx \
--package pgx \
--package pgx-macros \
--package pgx-pg-sys \
--package pgx-tests \
--package pgx-sql-entity-graph
- name: Run pgx-tests with cshim enabled
run: |
cargo test \
--features "pg$PG_VER cshim" \
--package pgx-tests
- name: Run pgx-tests with cshim disabled
run: |
cargo test \
--features "pg$PG_VER" \
--package pgx-tests
- name: Run aggregate example tests
run: cargo test --package aggregate --features "pg$PG_VER" --no-default-features

Expand Down
2 changes: 1 addition & 1 deletion pgx-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ edition = "2021"
crate-type = [ "cdylib", "lib" ]

[features]
default = [ "cshim" ]
default = [ ]
pg11 = [ "pgx/pg11" ]
pg12 = [ "pgx/pg12" ]
pg13 = [ "pgx/pg13" ]
Expand Down
7 changes: 7 additions & 0 deletions pgx-tests/src/tests/pg_try_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ fn crash() {
}
}

#[cfg(not(feature = "cshim"))]
fn walker() -> bool {
panic!("panic in walker");
}

#[cfg(feature = "cshim")]
#[pg_guard]
extern "C" fn walker() -> bool {
panic!("panic in walker");
Expand Down Expand Up @@ -101,6 +107,7 @@ mod tests {
fn test_pg_try_execute_with_crash_ignore() {
PgTryBuilder::new(|| super::crash())
.catch_when(PgSqlErrorCode::ERRCODE_INTERNAL_ERROR, |_| ())
.catch_others(|e| panic!("{:?}", e))
.execute();
}

Expand Down

0 comments on commit 9646bdf

Please sign in to comment.