On 2017-03-07 09:36:51 -0300, Alvaro Herrera wrote:
> FWIW, +1 on improving matters here.
>
> Andres Freund wrote:
>
> > The best I can come up so far is a toplevel target that creates the temp
> > install, starts a cluster and then runs the 'installcheck-or-check'
> > target on all the subdirectories via recursion. Individual makefiles can
> > either use the pre-existing cluster (most of of contrib for example), or
> > use the temporary install and run their pre-existing check target using
> > that (the tap tests, test_decoding, ...).
>
> I think a toplevel installcheck-or-check target is a good first step
> (though definitely lets find a better name).  Just being able to run all
> tests without the need for 95% of pointless initdb's would be helpful
> enough.

Here's a hacky proof-of-concept patch that implements a contrib/
'fastcheck' target.
timing of:

make -s -j01 -Otarget check                             2m49.286s
make -s -j16 -Otarget check                             0m44.120s
make -s -j01 -Otarget fastcheck                         1m1.533s
make -s -j16 -Otarget fastcheck                         0m24.385s
make -s -j01 -Otarget USE_MODULE_DB=1 \
        installcheck check-test_decoding-recurse        0m56.016s
make -s -j16 -Otarget USE_MODULE_DB=1 \
        installcheck check-test_decoding-recurse        0m23.608s

All of these should, excepting rerunning initdb/server start, have
equivalent test coverage.

'fastcheck' is obviously, if you look at it, a POC. We'd need:
- abstract this away somehow, it's not nice to copy the logic into a
  makefile
- tie contrib/'fastcheck' into check-world by overriding that target
- use the temp install we've created previously?
- more bulletproof server stop mechanism?

- Andres
>From 77520424a7b8a45e629eada864baac49db7fceb1 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Sat, 11 Mar 2017 14:03:26 -0800
Subject: [PATCH] WIP; 'fastcheck' target in contrib

---
 contrib/Makefile | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/contrib/Makefile b/contrib/Makefile
index e84eb67008..ca08fc9b74 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -90,6 +90,23 @@ endif
 # Missing:
 #		start-scripts	\ (does not have a makefile)
 
+NONSHARED_DATADIR_TARGETS=test_decoding
+SHARED_DATADIR_TARGETS=$(filter-out $(NONSHARED_DATADIR_TARGETS), $(SUBDIRS))
+SERVOPTIONS="-c log_line_prefix='%m [%p] %q%a ' -c unix_socket_directories=$(shell pwd)/tmp_fastcheck/ -clisten_addresses= -c port=5432"
+REGRESSPORT=5432
+REGRESSHOST=$(shell pwd)/tmp_fastcheck/
+
+fastcheck:
+	@mkdir -p tmp_fastcheck
+	@rm -rf tmp_fastcheck/data
+	$(bindir)/initdb --no-clean --no-sync -D tmp_fastcheck/data > tmp_fastcheck/initdb.log
+	PGPORT=$(REGRESSPORT) PGHOST=$(REGRESSHOST) \
+		$(bindir)/pg_ctl -D tmp_fastcheck/data -o$(SERVOPTIONS) --log tmp_fastcheck/postmaster.log start
+	$(MAKE) PGPORT=$(REGRESSPORT) PGHOST=$(REGRESSHOST) USE_MODULE_DB=1 -Otarget \
+		$(foreach t,$(SHARED_DATADIR_TARGETS),installcheck-$(t)-recurse) \
+		$(foreach t,$(NONSHARED_DATADIR_TARGETS),check-$(t)-recurse) || \
+		$(bindir)/pg_ctl -D tmp_fastcheck/data stop
+	$(bindir)/pg_ctl -D tmp_fastcheck/data stop
 
 $(recurse)
 $(recurse_always)
-- 
2.11.0.22.g8d7a455.dirty

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to