From 5dbb060037ce3e3a3ba0812baa90c80eeee762af Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 30 Jan 2023 22:50:07 +0000 Subject: tests: make require_git and require_cmd easier-to-use We'll rely on defined(wantarray) to implicitly skip subtests, and memoize these to reduce syscalls, since tests should be short-lived enough to not be affected by new installations or removals of git/xapian-compact/curl/etc... --- xt/pop3d-mpop.t | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'xt/pop3d-mpop.t') diff --git a/xt/pop3d-mpop.t b/xt/pop3d-mpop.t index 8648b953..fc82bc6b 100644 --- a/xt/pop3d-mpop.t +++ b/xt/pop3d-mpop.t @@ -5,12 +5,13 @@ use v5.12; use File::Path qw(make_path); use PublicInbox::TestCommon; -use PublicInbox::Spawn qw(which spawn); +use PublicInbox::Spawn qw(spawn); my $inboxdir = $ENV{GIANT_INBOX_DIR}; (defined($inboxdir) && -d $inboxdir) or plan skip_all => "GIANT_INBOX_DIR not defined for $0"; plan skip_all => "bad characters in $inboxdir" if $inboxdir =~ m![^\w\.\-/]!; -my $uuidgen = which('uuidgen') or plan skip_all => 'uuidgen(1) missing'; +my $uuidgen = require_cmd('uuidgen'); +my $mpop = require_cmd('mpop'); require_mods(qw(DBD::SQLite)); require_git('2.6'); # for v2 require_mods(qw(File::FcntlLock)) if $^O !~ /\A(?:linux|freebsd)\z/; @@ -41,8 +42,7 @@ chomp(my $uuid = xqx([$uuidgen])); make_path("$tmpdir/home/.config/mpop", map { "$tmpdir/md/$_" } qw(new cur tmp)); -SKIP: { - my $mpop = which('mpop') or skip('mpop(1) missing', 1); +{ open my $fh, '>', "$tmpdir/home/.config/mpop/config" or xbail "open $!"; chmod 0600, $fh; -- cgit v1.2.3-24-ge0c7