* [PATCH] devel/try-lei: for interactive testing + debugging
@ 2024-11-25 22:27 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2024-11-25 22:27 UTC (permalink / raw)
To: meta
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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-25 22:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25 22:27 [PATCH] devel/try-lei: for interactive testing + debugging Eric Wong
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).