mirror of
https://github.com/postgres/postgres.git
synced 2025-10-15 05:46:52 +03:00
To better record the internal behaviors of oauth-curl.c, add a unit test suite for the socket and timer handling code. This is all based on TAP and driven by our existing Test::More infrastructure. Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com
25 lines
954 B
Perl
25 lines
954 B
Perl
# Copyright (c) 2025, PostgreSQL Global Development Group
|
|
use strict;
|
|
use warnings FATAL => 'all';
|
|
|
|
use PostgreSQL::Test::Utils;
|
|
use Test::More;
|
|
|
|
# Defer entirely to the oauth_tests executable. stdout/err is routed through
|
|
# Test::More so that our logging infrastructure can handle it correctly. Using
|
|
# IPC::Run::new_chunker seems to help interleave the two streams a little better
|
|
# than without.
|
|
#
|
|
# TODO: prove can also deal with native executables itself, which we could
|
|
# probably make use of via PROVE_TESTS on the Makefile side. But the Meson setup
|
|
# calls Perl directly, which would require more code to work around... and
|
|
# there's still the matter of logging.
|
|
my $builder = Test::More->builder;
|
|
my $out = $builder->output;
|
|
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]) }
|
|
or die "oauth_tests returned $?";
|