Skip to content

Commit 7a6ea72

Browse files
committed
bootstrap a plrust-tests create
The new `plrust-tests` create is a standalone pgrx crate that only contains the unit tests from `plrust`. These were copied over verbatim. To run the tests: ```shell $ cd plrust-tests $ ./run-tests.sh pgXX [test_name] ```
1 parent c92fc06 commit 7a6ea72

File tree

6 files changed

+1518
-0
lines changed

6 files changed

+1518
-0
lines changed

Cargo.lock

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ resolver = "2"
33
members = [
44
"plrust",
55
"plrust-trusted-pgrx",
6+
"plrust-tests",
67
]
78
exclude = ["plrustc"]#, "builder"]
89

plrust-tests/Cargo.toml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "plrust-tests"
3+
version = "0.0.0"
4+
edition = "2021"
5+
6+
[lib]
7+
crate-type = ["cdylib"]
8+
9+
[features]
10+
default = ["pg13"]
11+
pg13 = ["pgrx/pg13", "pgrx-tests/pg13" ]
12+
pg14 = ["pgrx/pg14", "pgrx-tests/pg14" ]
13+
pg15 = ["pgrx/pg15", "pgrx-tests/pg15" ]
14+
pg_test = []
15+
16+
[dependencies]
17+
pgrx = "=0.9.5"
18+
tempdir = "0.3.7"
19+
once_cell = "1.18.0"
20+
21+
[dev-dependencies]
22+
pgrx-tests = "=0.9.5"
23+
tempdir = "0.3.7"
24+
once_cell = "1.18.0"

plrust-tests/plrust_tests.control

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
comment = 'plrust_tests: Created by pgrx'
2+
default_version = '@CARGO_VERSION@'
3+
module_pathname = '$libdir/plrust_tests'
4+
relocatable = false
5+
superuser = true
6+
requires = 'plrust'

plrust-tests/run-tests.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#! /bin/bash
2+
3+
VERSION=$1
4+
5+
if [ -z ${VERSION} ]; then
6+
echo "usage: ./run-tests.sh pgXX [test-name]"
7+
exit 1
8+
fi
9+
10+
TEST_DIR=`pwd`
11+
12+
# install the plrust extension into the pgrx-managed postgres
13+
echo "============================"
14+
echo " installing plrust"
15+
echo
16+
cd ../plrust
17+
echo "\q" | cargo pgrx run ${VERSION}
18+
19+
# run the test suite from this crate
20+
cd ${TEST_DIR}
21+
22+
echo
23+
echo "============================"
24+
echo " running plrust-tests suite"
25+
echo
26+
27+
cargo pgrx test ${VERSION} $2
28+

0 commit comments

Comments
 (0)