1: a515435d3b4 < -: ----------- oauth: Remove stale events from the kqueue multiplexer 2: a34be19f17f < -: ----------- oauth: Ensure unused socket registrations are removed 3: 7408778d579 < -: ----------- oauth: Remove expired timers from the multiplexer 4: 8241255e84c < -: ----------- oauth: Track total call count during a client flow -: ----------- > 1: c9962268ef0 oauth: Always link with -lm for floor() 5: 337124064f3 ! 2: 2e36b329c76 oauth: Add unit tests for multiplexer handling @@ Commit message suite for the socket and timer handling code. This is all based on TAP and driven by our existing Test::More infrastructure. + This commit is a replay of 1443b6c0e, which was reverted due to + buildfarm failures. Compared with that, this version protects the build + targets in the Makefile with a with_libcurl conditional, and it tweaks + the code style in 001_oauth.pl. + Reviewed-by: Dagfinn Ilmari Mannsåker Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com ## src/interfaces/libpq-oauth/Makefile ## -@@ src/interfaces/libpq-oauth/Makefile: uninstall: - rm -f '$(DESTDIR)$(libdir)/$(stlib)' - rm -f '$(DESTDIR)$(libdir)/$(shlib)' +@@ src/interfaces/libpq-oauth/Makefile: SHLIB_EXPORTS = exports.txt + # Disable -bundle_loader on macOS. + BE_DLLLIBS = + +-# By default, a library without an SONAME doesn't get a static library, so we +-# add it to the build explicitly. +-all: all-lib all-static-lib +- + # Shared library stuff + include $(top_srcdir)/src/Makefile.shlib + +@@ src/interfaces/libpq-oauth/Makefile: include $(top_srcdir)/src/Makefile.shlib + %_shlib.o: %.c %.o + $(CC) $(CFLAGS) $(CFLAGS_SL) $(CPPFLAGS) $(CPPFLAGS_SHLIB) -c $< -o $@ +.PHONY: all-tests +all-tests: oauth_tests$(X) @@ src/interfaces/libpq-oauth/Makefile: uninstall: +oauth_tests$(X): test-oauth-curl.o oauth-utils.o $(WIN32RES) | submake-libpgport submake-libpq + $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(SHLIB_LINK) -o $@ + ++# ++# Top-Level Targets ++# ++# The existence of a t/ folder induces the buildfarm to run Make directly on ++# this subdirectory, bypassing the recursion skip in src/interfaces/Makefile. ++# Wrap the standard build targets in a with_libcurl conditional to avoid ++# building OAuth code on platforms that haven't requested it. (The "clean"-style ++# targets remain available.) ++# ++ ++ifeq ($(with_libcurl), yes) ++ ++# By default, a library without an SONAME doesn't get a static library, so we ++# add it to the build explicitly. ++all: all-lib all-static-lib ++ + # Ignore the standard rules for SONAME-less installation; we want both the + # static and shared libraries to go into libdir. + install: all installdirs $(stlib) $(shlib) +@@ src/interfaces/libpq-oauth/Makefile: install: all installdirs $(stlib) $(shlib) + installdirs: + $(MKDIR_P) '$(DESTDIR)$(libdir)' + +check: all-tests + $(prove_check) + +installcheck: all-tests + $(prove_installcheck) + ++endif # with_libcurl ++ + uninstall: + rm -f '$(DESTDIR)$(libdir)/$(stlib)' + rm -f '$(DESTDIR)$(libdir)/$(shlib)' + clean distclean: clean-lib rm -f $(OBJS) $(OBJS_STATIC) $(OBJS_SHLIB) + rm -f test-oauth-curl.o oauth_tests$(X) @@ src/interfaces/libpq-oauth/t/001_oauth.pl (new) +my $err = $builder->failure_output; + +IPC::Run::run ['oauth_tests'], -+ '>', IPC::Run::new_chunker, sub { $out->print($_[0]) }, -+ '2>', IPC::Run::new_chunker, sub { $err->print($_[0]) } ++ '>' => (IPC::Run::new_chunker, sub { $out->print($_[0]) }), ++ '2>' => (IPC::Run::new_chunker, sub { $err->print($_[0]) }) + or die "oauth_tests returned $?"; ## src/interfaces/libpq-oauth/test-oauth-curl.c (new) ##