unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] devel/try-lei: for interactive testing + debugging
Date: Mon, 25 Nov 2024 22:27:48 +0000	[thread overview]
Message-ID: <20241125222748.773697-1-e@80x24.org> (raw)

This script allows creating a clean lei instance for interactive
testing without modifying a user's current lei $HOME||$XDG_*
directories.  I used this to debug and test fixes leading to
99fc3d76 (v2writable: done: force synchronous awaitpid, 2024-11-19) and
807abf67 (lei/store: auto-commit for long-running imports, 2024-11-15)
fixes for long-running `lei import' runs.
---
 MANIFEST      |  1 +
 devel/try-lei | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100755 devel/try-lei

diff --git a/MANIFEST b/MANIFEST
index 6b759487..1305ed8a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -123,6 +123,7 @@ contrib/selinux/el7/publicinbox.te
 devel/README
 devel/longest-tests
 devel/sysdefs-list
+devel/try-lei
 examples/README
 examples/README.unsubscribe
 examples/cgit-commit-filter.lua
diff --git a/devel/try-lei b/devel/try-lei
new file mode 100755
index 00000000..0a055d00
--- /dev/null
+++ b/devel/try-lei
@@ -0,0 +1,28 @@
+# Copyright all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <http://www.gnu.org/licenses/agpl-3.0.txt>
+# For interactive testing + debugging of lei with a clean $HOME:
+# Usage: ./devel/try-lei
+eval 'exec perl -w -S $0 ${1+"$@"}' # no shebang
+if 0; # running under some shell
+use autodie qw(mkdir symlink);
+my $cwd;
+BEGIN {
+	use Cwd qw(getcwd);
+	$cwd = getcwd;
+	die <<EOM unless -f 'lei.sh';
+must be run in top-level public-inbox worktree (cwd=$cwd)
+EOM
+	unshift @INC, "$cwd/lib";
+	$ENV{PERL5LIB} = join(':', @INC);
+}
+use PublicInbox::TestCommon;
+$ENV{TEST_RUN_MODE} = '0'; # no fork optimization
+test_lei(sub {
+	diag "spawning shell, HOME=$ENV{HOME}, will be deleted when done";
+	mkdir "$ENV{HOME}/bin";
+	diag "ln -s $cwd/lei.sh $ENV{HOME}/bin/lei";
+	symlink "$cwd/lei.sh", "$ENV{HOME}/bin/lei";
+	$ENV{PATH} = "$ENV{HOME}/bin:$ENV{PATH}";
+	is system($ENV{SHELL} // '/bin/sh'), 0, 'subshell ran successfully';
+});
+done_testing;

                 reply	other threads:[~2024-11-25 22:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241125222748.773697-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).