diff --git a/META.json b/META.json index 1f7518b..e6fe505 100644 --- a/META.json +++ b/META.json @@ -18,7 +18,7 @@ }, "provides": { "vector": { - "file": "vector--0.1.1.sql", + "file": "sql/vector--0.1.1.sql", "docfile": "README.md", "version": "0.1.2", "abstract": "Open-source vector similarity search for Postgres" diff --git a/Makefile b/Makefile index aae1737..4abaab4 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ EXTENSION = vector -DATA = vector--0.1.1.sql vector--0.1.0--0.1.1.sql +DATA = sql/vector--0.1.1.sql sql/vector--0.1.0--0.1.1.sql MODULE_big = vector OBJS = src/ivfbuild.o src/ivfflat.o src/ivfinsert.o src/ivfkmeans.o src/ivfscan.o src/ivfutils.o src/ivfvacuum.o src/vector.o -TESTS = $(wildcard sql/*.sql) +TESTS = $(wildcard test/sql/*.sql) -REGRESS = btree cast copy functions ivfflat_cosine ivfflat_ip ivfflat_l2 ivfflat_unlogged vector +REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS)) +REGRESS_OPTS = --inputdir=test OPTFLAGS = -march=native @@ -26,7 +27,7 @@ include $(PGXS) prove_installcheck: rm -rf $(CURDIR)/tmp_check - cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) + cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),test/t/*.pl) .PHONY: dist diff --git a/README.md b/README.md index 2353243..c33be84 100644 --- a/README.md +++ b/README.md @@ -214,16 +214,10 @@ make prove_installcheck # TAP tests To run single tests: ```sh -make installcheck REGRESS=vector # regression test -make prove_installcheck PROVE_TESTS=t/001_wal.pl # TAP test +make installcheck REGRESS=vector # regression test +make prove_installcheck PROVE_TESTS=test/t/001_wal.pl # TAP test ``` -Directories - -- `expected` - expected output for regression tests -- `sql` - regression tests -- `t` - TAP tests - Resources for contributors - [Extension Building Infrastructure](https://www.postgresql.org/docs/current/extend-pgxs.html) diff --git a/vector--0.1.0--0.1.1.sql b/sql/vector--0.1.0--0.1.1.sql similarity index 100% rename from vector--0.1.0--0.1.1.sql rename to sql/vector--0.1.0--0.1.1.sql diff --git a/vector--0.1.1.sql b/sql/vector--0.1.1.sql similarity index 100% rename from vector--0.1.1.sql rename to sql/vector--0.1.1.sql diff --git a/expected/btree.out b/test/expected/btree.out similarity index 100% rename from expected/btree.out rename to test/expected/btree.out diff --git a/expected/cast.out b/test/expected/cast.out similarity index 100% rename from expected/cast.out rename to test/expected/cast.out diff --git a/expected/copy.out b/test/expected/copy.out similarity index 100% rename from expected/copy.out rename to test/expected/copy.out diff --git a/expected/functions.out b/test/expected/functions.out similarity index 100% rename from expected/functions.out rename to test/expected/functions.out diff --git a/expected/ivfflat_cosine.out b/test/expected/ivfflat_cosine.out similarity index 100% rename from expected/ivfflat_cosine.out rename to test/expected/ivfflat_cosine.out diff --git a/expected/ivfflat_ip.out b/test/expected/ivfflat_ip.out similarity index 100% rename from expected/ivfflat_ip.out rename to test/expected/ivfflat_ip.out diff --git a/expected/ivfflat_l2.out b/test/expected/ivfflat_l2.out similarity index 100% rename from expected/ivfflat_l2.out rename to test/expected/ivfflat_l2.out diff --git a/test/expected/ivfflat_options.out b/test/expected/ivfflat_options.out new file mode 100644 index 0000000..b7675a1 --- /dev/null +++ b/test/expected/ivfflat_options.out @@ -0,0 +1,17 @@ +SET client_min_messages = warning; +CREATE EXTENSION IF NOT EXISTS vector; +SET enable_seqscan = off; +CREATE TABLE t (val vector(3)); +CREATE INDEX ON t USING ivfflat (val) WITH (lists = 0); +ERROR: value 0 out of bounds for option "lists" +DETAIL: Valid values are between "1" and "32768". +CREATE INDEX ON t USING ivfflat (val) WITH (lists = 32769); +ERROR: value 32769 out of bounds for option "lists" +DETAIL: Valid values are between "1" and "32768". +SHOW ivfflat.probes; + ivfflat.probes +---------------- + 1 +(1 row) + +DROP TABLE t; diff --git a/expected/ivfflat_unlogged.out b/test/expected/ivfflat_unlogged.out similarity index 100% rename from expected/ivfflat_unlogged.out rename to test/expected/ivfflat_unlogged.out diff --git a/expected/vector.out b/test/expected/vector.out similarity index 100% rename from expected/vector.out rename to test/expected/vector.out diff --git a/sql/btree.sql b/test/sql/btree.sql similarity index 100% rename from sql/btree.sql rename to test/sql/btree.sql diff --git a/sql/cast.sql b/test/sql/cast.sql similarity index 100% rename from sql/cast.sql rename to test/sql/cast.sql diff --git a/sql/copy.sql b/test/sql/copy.sql similarity index 100% rename from sql/copy.sql rename to test/sql/copy.sql diff --git a/sql/functions.sql b/test/sql/functions.sql similarity index 100% rename from sql/functions.sql rename to test/sql/functions.sql diff --git a/sql/ivfflat_cosine.sql b/test/sql/ivfflat_cosine.sql similarity index 100% rename from sql/ivfflat_cosine.sql rename to test/sql/ivfflat_cosine.sql diff --git a/sql/ivfflat_ip.sql b/test/sql/ivfflat_ip.sql similarity index 100% rename from sql/ivfflat_ip.sql rename to test/sql/ivfflat_ip.sql diff --git a/sql/ivfflat_l2.sql b/test/sql/ivfflat_l2.sql similarity index 100% rename from sql/ivfflat_l2.sql rename to test/sql/ivfflat_l2.sql diff --git a/sql/ivfflat_options.sql b/test/sql/ivfflat_options.sql similarity index 100% rename from sql/ivfflat_options.sql rename to test/sql/ivfflat_options.sql diff --git a/sql/ivfflat_unlogged.sql b/test/sql/ivfflat_unlogged.sql similarity index 100% rename from sql/ivfflat_unlogged.sql rename to test/sql/ivfflat_unlogged.sql diff --git a/sql/vector.sql b/test/sql/vector.sql similarity index 100% rename from sql/vector.sql rename to test/sql/vector.sql diff --git a/t/001_wal.pl b/test/t/001_wal.pl similarity index 100% rename from t/001_wal.pl rename to test/t/001_wal.pl