unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] t/index-git-times: support non-master default branch
@ 2021-10-25 22:24 Thomas Weißschuh
  2021-10-25 22:58 ` Eric Wong
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Weißschuh @ 2021-10-25 22:24 UTC (permalink / raw)
  To: meta; +Cc: Thomas Weißschuh

---
 t/index-git-times.t | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/t/index-git-times.t b/t/index-git-times.t
index 3cfb99f4..52173396 100644
--- a/t/index-git-times.t
+++ b/t/index-git-times.t
@@ -7,6 +7,7 @@ use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::Config;
 use PublicInbox::Admin;
+use PublicInbox::Import;
 use File::Path qw(remove_tree);
 
 require_mods(qw(DBD::SQLite Search::Xapian));
@@ -16,27 +17,28 @@ my ($tmpdir, $for_destroy) = tmpdir();
 local $ENV{PI_CONFIG} = "$tmpdir/cfg";
 my $v1dir = "$tmpdir/v1";
 my $addr = 'x@example.com';
+my $default_branch = PublicInbox::Import::default_branch;
 run_script(['-init', '--indexlevel=medium', 'v1', $v1dir,
 		'http://example.com/x', $addr])
 	or die "init failed";
 
 {
-	my $data = <<'EOF';
+	my $data = <<"EOF";
 blob
 mark :1
 data 133
-From: timeless <t@example.com>
-To: x <x@example.com>
+From: timeless <t\@example.com>
+To: x <x\@example.com>
 Subject: can I haz the time?
-Message-ID: <19700101000000-1234@example.com>
+Message-ID: <19700101000000-1234\@example.com>
 
 plz
 
-reset refs/heads/master
-commit refs/heads/master
+reset $default_branch
+commit $default_branch
 mark :2
-author timeless <t@example.com> 749520000 +0100
-committer x <x@example.com> 1285977600 -0100
+author timeless <t\@example.com> 749520000 +0100
+committer x <x\@example.com> 1285977600 -0100
 data 20
 can I haz the time?
 M 100644 :1 53/256f6177504c2878d3a302ef5090dacf5e752c

base-commit: 7319f5d318a960eeb32a207d226eea7fd9ce2543
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] t/index-git-times: support non-master default branch
  2021-10-25 22:24 [PATCH] t/index-git-times: support non-master default branch Thomas Weißschuh
@ 2021-10-25 22:58 ` Eric Wong
  2021-10-26  5:05   ` Thomas Weißschuh
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Wong @ 2021-10-25 22:58 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: meta

Thanks, pushed as 9f3fb207.   It looks like there's several
other tests broken with non-master being the default.  Can we
expect fixes for those, too?  Thanks again.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] t/index-git-times: support non-master default branch
  2021-10-25 22:58 ` Eric Wong
@ 2021-10-26  5:05   ` Thomas Weißschuh
  2021-10-26  5:28     ` Eric Wong
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Weißschuh @ 2021-10-26  5:05 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

Hi,

On 2021-10-25 16:58-0600, Eric Wong wrote:
> Thanks, pushed as 9f3fb207.   It looks like there's several
> other tests broken with non-master being the default.  Can we
> expect fixes for those, too?  Thanks again.

Which tests are failing for you?

The only failures I still see are in t/lei-q-remote-import.t which is unrelated
to the git branch and some more that fail only during parallel test execution.

In t/lei-q-remote-import.t it seems the search results are not memoized to the
local store. (See attachment)

If you are able to reproduce those issues I'd be happy to have them fixed by
you. If not I will try to figure them out.

Thomas

[-- Attachment #2: lei-q-remote-import.txt --]
[-- Type: text/plain, Size: 6074 bytes --]

# lei_err=# /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.config/lei/config created
# # /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (0 matches)
ok 1 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd m:qp@example.com
ok 2 - output exists but is empty
# lei_err=# /usr/bin/curl -Sf -s -d '' http://[::1]:38791/t2/?x=m&q=m%3Aqp%40example.com
# # /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # http://[::1]:38791/t2/ 1/1
# # 1 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (1 matches)
ok 3 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd m:qp@example.com -I http://[::1]:38791/t2/
ok 4 - got results after remote search
# lei_err=# /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (0 matches)
ok 5 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd m:qp@example.com
not ok 6 - output exists after import but is not empty
#   Failed test 'output exists after import but is not empty'
#   at t/lei-q-remote-import.t line 39.
# # /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (0 matches)
not ok 7 - got results w/o remote search
#   Failed test 'got results w/o remote search'
#   at t/lei-q-remote-import.t line 41.
#     Structures begin differing at:
#          $got->[0] = Does not exist
#     $expected->[0] = PublicInbox::Eml=HASH(0x55fea9904d90)
# lei_err=# /usr/bin/curl -Sf -s -d '' http://[::1]:38791/t2/?x=m&q=m%3A199707281508.AAA24167%40hoyogw.example
# # /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # http://[::1]:38791/t2/ 1/1
# # 1 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (1 matches)
ok 8 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd m:199707281508.AAA24167@hoyogw.example -I http://[::1]:38791/t2/ --no-import-remote
ok 9 - got another after remote search
# lei_err=# /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (0 matches)
ok 10 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd m:199707281508.AAA24167@hoyogw.example
ok 11 - --no-import-remote did not memoize
# lei_err=# /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (0 matches)
ok 12 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd m:qp@example.com --lock=none
not ok 13 - --lock=none respected
#   Failed test '--lock=none respected'
#   at t/lei-q-remote-import.t line 55.
# # /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (0 matches)
# lei_err=dotlock timeout /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd.lock
ok 14 - dotlock fails
ok 15 - timeout noted
ok 16 - nothing output on lock failure
# lei_err=# /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (0 matches)
ok 17 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd m:qp@example.com --lock=dotlock,timeout=0.000001 (succeeds after lock removal)
ok 18 - lei add-external -q .../public-inbox.org/t/data-gen/lei-q-remote-import.local-external
ok 19 - lei q -q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd --only http://[::1]:38791/t2/ m:testmessage@example.com
ok 20 - no warnings or errors
ok 21 - got result from remote external
ok 22 - got expected result
ok 23 - lei q --no-external -o mboxrd:/dev/stdout m:testmessage@example.com
ok 24 - message not imported when in local external
# lei_err=# /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/.local/share/lei/store 0/0
# # .../public-inbox.org/t/data-gen/lei-q-remote-import.local-external 1/1
# # 1 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd (1 matches)
ok 25 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/o.mboxrd m:testmessage@example.com
ok 26 - got expected result after clobber
ok 27 - lei q -o mboxrd:/dev/stdout m:never-before-seen@example.com
not ok 28 - --import-before imported totally unseen message
#   Failed test '--import-before imported totally unseen message'
#   at t/lei-q-remote-import.t line 94.
#                   ''
#     doesn't match '(?^ms:seen\@example\.com>\nStatus: RO\n\nwhatever)'
# lei_err=# /usr/bin/curl -Sf -s -d '' http://[::1]:38791/t2/?x=m&q=z%3A0..
# # http://[::1]:38791/t2/ 15/15
# # 15 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/md/ (15 matches)
ok 29 - lei q --save z:0.. -o /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/md --only http://[::1]:38791/t2/
# lei_err=# http://[::1]:38791/t2/ limiting to 2021-10-24  7:03 +0200 and newer
# # /usr/bin/curl -Sf -s -d '' http://[::1]:38791/t2/?x=m&q=(z%3A0..)+AND+dt%3A20211024050357..
# # http://[::1]:38791/t2/ 11/11
# # 0 written to /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/md/ (11 matches)
ok 30 - lei up /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/md
ok 31 - lei up remote dedupe works on maildir
ok 32 - lei edit-search /tmp/pi-lei-q-remote-import-286963-YR1S/lei-daemon/md
ok 33 - lastresult set
ok 34 - lei daemon-pid (daemon-pid after t/lei-q-remote-import.t:106)
ok 35 - daemon running after t/lei-q-remote-import.t:106
ok 36 - lei daemon-kill (daemon-kill after t/lei-q-remote-import.t:106)
ok 37 - t/lei-q-remote-import.t:106 daemon stopped
ok 38 - t/lei-q-remote-import.t:106 daemon XDG_RUNTIME_DIR/lei/errors.log empty
1..38
# Looks like you failed 4 tests of 38.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] t/index-git-times: support non-master default branch
  2021-10-26  5:05   ` Thomas Weißschuh
@ 2021-10-26  5:28     ` Eric Wong
  2021-10-26 18:43       ` Thomas Weißschuh
  2021-10-26 21:24       ` [PATCH] t/index-git-times: support non-master default branch Thomas Weißschuh
  0 siblings, 2 replies; 14+ messages in thread
From: Eric Wong @ 2021-10-26  5:28 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: meta

Thomas Weißschuh <thomas@t-8ch.de> wrote:
> On 2021-10-25 16:58-0600, Eric Wong wrote:
> > Thanks, pushed as 9f3fb207.   It looks like there's several
> > other tests broken with non-master being the default.  Can we
> > expect fixes for those, too?  Thanks again.
> 
> Which tests are failing for you?

	t/edit.t
	t/indexlevels-mirror.t
	t/indexlevels-mirror-v1.t
	t/convert-compact.t
	t/multi-mid.t
	t/feed.t

I was testing with --global, since that's what I expect if users
are going to change their default branch.

$ git config --global init.defaultBranch foo
$ make check-run

All the "not ok" lines:

# t/edit.log: not ok 1 - -F FILE edit OK
# t/edit.log: not ok 2 - -F FILE message edited
# t/edit.log: not ok 3 - -F FILE shows commit on success
# t/edit.log: not ok 4 - -m MESSAGE_ID edit OK
# t/edit.log: not ok 5 - -m MESSAGE_ID message edited
# t/edit.log: not ok 6 - -m MESSAGE_ID shows commit on success
# t/edit.log: not ok 7 - no-op -m MESSAGE_ID succeeds
# t/edit.log: not ok 9 - no-op -m MESSAGE_ID does not change message
# t/edit.log: not ok 10 - noop shows NONE
# t/edit.log: not ok 12 - no-op -m MESSAGE_ID w/Status: header succeeds
# t/edit.log: not ok 14 - no-op -m MESSAGE_ID w/Status: header does not change message
# t/edit.log: not ok 16 - noop shows NONE
# t/edit.log: not ok 18 - -m MESSAGE_ID can change Received: headers succeeds
# t/edit.log: not ok 19 - -m MESSAGE_ID can change Received: headers does not change Subject
# t/edit.log: not ok 20 - added Received header
# t/edit.log: not ok 24 - non-interactive editor failure shows error
# t/edit.log: not ok 26 - mailEditor set in config edited message
# t/edit.log: not ok 27 - mailEditor set in config message edited
# t/edit.log: not ok 29 - --raw and mbox escaping succeeds
# t/edit.log: not ok 30 - put "From " line into body
# t/edit.log: not ok 31 - --raw and mbox escaping succeeds with mbox escaping
# t/edit.log: not ok 32 - changed "From " line unescaped
# t/edit.log: not ok 33 - --raw and mbox escaping succeeds again
# t/edit.log: not ok 37 - edit ambiguous Message-ID with -m fails w/o --force
# t/edit.log: not ok 38 - edit ambiguous Message-ID with -m shows matches
# t/edit.log: not ok 41 - edit ambiguous Message-ID with -m and --force notes all will be edited
# t/edit.log: not ok 42 - edit ambiguous Message-ID with -m and --force edited both messages
# t/indexlevels-mirror.log: not ok 12 - 2nd message seen in mirror
# t/indexlevels-mirror.log: not ok 13 - got both messages in mirror
# t/indexlevels-mirror.log: not ok 15 - 2nd message seen in master
# t/indexlevels-mirror.log: not ok 16 - got both messages in master
# t/indexlevels-mirror.log: not ok 17 - master has expected NNTP articles
# t/indexlevels-mirror.log: not ok 18 - mirror has expected NNTP articles
# t/indexlevels-mirror.log: not ok 19 - 2nd message removed
# t/indexlevels-mirror.log: not ok 32 - v2 mirror matches master articles
# t/indexlevels-mirror.log: not ok 46 - 2nd message seen in mirror
# t/indexlevels-mirror.log: not ok 47 - got both messages in mirror
# t/indexlevels-mirror.log: not ok 49 - 2nd message seen in master
# t/indexlevels-mirror.log: not ok 50 - got both messages in master
# t/indexlevels-mirror.log: not ok 51 - master has expected NNTP articles
# t/indexlevels-mirror.log: not ok 52 - mirror has expected NNTP articles
# t/indexlevels-mirror.log: not ok 53 - 2nd message removed
# t/indexlevels-mirror.log: not ok 57 - v2 found m@2 via Xapian on medium
# t/indexlevels-mirror.log: not ok 69 - v2 mirror matches master articles
# t/indexlevels-mirror.log: not ok 83 - 2nd message seen in mirror
# t/indexlevels-mirror.log: not ok 84 - got both messages in mirror
# t/indexlevels-mirror.log: not ok 86 - 2nd message seen in master
# t/indexlevels-mirror.log: not ok 87 - got both messages in master
# t/indexlevels-mirror.log: not ok 88 - master has expected NNTP articles
# t/indexlevels-mirror.log: not ok 89 - mirror has expected NNTP articles
# t/indexlevels-mirror.log: not ok 90 - 2nd message removed
# t/indexlevels-mirror.log: not ok 94 - v2 found m@2 via Xapian on full
# t/indexlevels-mirror.log: not ok 106 - v2 mirror matches master articles
# t/indexlevels-mirror-v1.log: not ok 12 - 2nd message seen in mirror
# t/indexlevels-mirror-v1.log: not ok 13 - got both messages in mirror
# t/indexlevels-mirror-v1.log: not ok 18 - mirror has expected NNTP articles
# t/indexlevels-mirror-v1.log: not ok 31 - v1 mirror matches master articles
# t/indexlevels-mirror-v1.log: not ok 45 - 2nd message seen in mirror
# t/indexlevels-mirror-v1.log: not ok 46 - got both messages in mirror
# t/indexlevels-mirror-v1.log: not ok 51 - mirror has expected NNTP articles
# t/indexlevels-mirror-v1.log: not ok 56 - v1 found m@2 via Xapian on medium
# t/indexlevels-mirror-v1.log: not ok 68 - v1 mirror matches master articles
# t/indexlevels-mirror-v1.log: not ok 82 - 2nd message seen in mirror
# t/indexlevels-mirror-v1.log: not ok 83 - got both messages in mirror
# t/indexlevels-mirror-v1.log: not ok 88 - mirror has expected NNTP articles
# t/indexlevels-mirror-v1.log: not ok 93 - v1 found m@2 via Xapian on full
# t/indexlevels-mirror-v1.log: not ok 105 - v1 mirror matches master articles
# t/convert-compact.log: not ok 36 - message exists in history
# t/multi-mid.log: not ok 2 - no errors or warnings from -convert
# t/multi-mid.log: not ok 4 - v2 conversion times match
# t/multi-mid.log: not ok 7 - v2 clone times match
# t/multi-mid.log: not ok 9 - no errors or warnings from -convert
# t/multi-mid.log: not ok 11 - v2 conversion times match
# t/multi-mid.log: not ok 14 - v2 clone times match
# t/feed.log: not ok 9 - spam showed up :<

> The only failures I still see are in t/lei-q-remote-import.t which is unrelated
> to the git branch and some more that fail only during parallel test execution.
> 
> In t/lei-q-remote-import.t it seems the search results are not memoized to the
> local store. (See attachment)

Thanks, I'll check out lei-q-remote-import.t separately.
That could be related to SMP or slow/fast storage.
Any details you can share about CPU core count, speeds
or storage speeds, or CPU scheduler, CONFIG_HZ?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] t/index-git-times: support non-master default branch
  2021-10-26  5:28     ` Eric Wong
@ 2021-10-26 18:43       ` Thomas Weißschuh
  2021-10-27 21:15         ` lei-q-remote-import failures [was: [PATCH] t/index-git-times: support non-master default branch] Eric Wong
  2021-10-26 21:24       ` [PATCH] t/index-git-times: support non-master default branch Thomas Weißschuh
  1 sibling, 1 reply; 14+ messages in thread
From: Thomas Weißschuh @ 2021-10-26 18:43 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On 2021-10-26 05:28+0000, Eric Wong wrote:
> Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > On 2021-10-25 16:58-0600, Eric Wong wrote:
> > > Thanks, pushed as 9f3fb207.   It looks like there's several
> > > other tests broken with non-master being the default.  Can we
> > > expect fixes for those, too?  Thanks again.
> > 
> > Which tests are failing for you?
> 
> 	t/edit.t
> 	t/indexlevels-mirror.t
> 	t/indexlevels-mirror-v1.t
> 	t/convert-compact.t
> 	t/multi-mid.t
> 	t/feed.t
> 
> I was testing with --global, since that's what I expect if users
> are going to change their default branch.

This is also what I am using.

> $ git config --global init.defaultBranch foo
> $ make check-run

I only tried make check/test.
Let's see if I can reproduce those.

> > The only failures I still see are in t/lei-q-remote-import.t which is unrelated
> > to the git branch and some more that fail only during parallel test execution.
> > 
> > In t/lei-q-remote-import.t it seems the search results are not memoized to the
> > local store. (See attachment)
> 
> Thanks, I'll check out lei-q-remote-import.t separately.
> That could be related to SMP or slow/fast storage.
> Any details you can share about CPU core count, speeds
> or storage speeds, or CPU scheduler, CONFIG_HZ?

CPU:

  Model name:            11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    CPU family:          6
    Model:               140
    Thread(s) per core:  2
    Core(s) per socket:  4
    Socket(s):           1
    Stepping:            1
    CPU max MHz:         4700,0000
    CPU min MHz:         400,0000

Storage: Samsung EVO 970 (with plenty of memory cache)
CONFIG_HZ: 300

Thomas

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] t/index-git-times: support non-master default branch
  2021-10-26  5:28     ` Eric Wong
  2021-10-26 18:43       ` Thomas Weißschuh
@ 2021-10-26 21:24       ` Thomas Weißschuh
  2021-10-27  4:07         ` [PATCH] test_common: key test inboxes to init.defaultBranch Eric Wong
  1 sibling, 1 reply; 14+ messages in thread
From: Thomas Weißschuh @ 2021-10-26 21:24 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On 2021-10-26 05:28+0000, Eric Wong wrote:
> Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > On 2021-10-25 16:58-0600, Eric Wong wrote:
> > > Thanks, pushed as 9f3fb207.   It looks like there's several
> > > other tests broken with non-master being the default.  Can we
> > > expect fixes for those, too?  Thanks again.
> > 
> > Which tests are failing for you?
> 
> 	t/edit.t
> 	t/indexlevels-mirror.t
> 	t/indexlevels-mirror-v1.t
> 	t/convert-compact.t
> 	t/multi-mid.t
> 	t/feed.t

I think these are because of stale data in t/data-gen/ that was generated when
you still had the master branch configured.
Try to clean out these files and rerun the tests.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] test_common: key test inboxes to init.defaultBranch
  2021-10-26 21:24       ` [PATCH] t/index-git-times: support non-master default branch Thomas Weißschuh
@ 2021-10-27  4:07         ` Eric Wong
  2021-10-27  5:04           ` Thomas Weißschuh
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Wong @ 2021-10-27  4:07 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: meta

Thomas Weißschuh <thomas@t-8ch.de> wrote:
> On 2021-10-26 05:28+0000, Eric Wong wrote:
> > Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > > On 2021-10-25 16:58-0600, Eric Wong wrote:
> > > > Thanks, pushed as 9f3fb207.   It looks like there's several
> > > > other tests broken with non-master being the default.  Can we
> > > > expect fixes for those, too?  Thanks again.
> > > 
> > > Which tests are failing for you?
> > 
> > 	t/edit.t
> > 	t/indexlevels-mirror.t
> > 	t/indexlevels-mirror-v1.t
> > 	t/convert-compact.t
> > 	t/multi-mid.t
> > 	t/feed.t
> 
> I think these are because of stale data in t/data-gen/ that was generated when
> you still had the master branch configured.
> Try to clean out these files and rerun the tests.

Ah, thanks for spotting that.  I think it's better if the
cache-invalidation is transparent:
-----------8<----------
Subject: [PATCH] test_common: key test inboxes to init.defaultBranch

This lets users change their global init.defaultBranch config
knob in ~/.gitconfig or similar without breaking tests.

Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
---
 lib/PublicInbox/TestCommon.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index fb0d5a4e..c3820d3a 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -674,8 +674,10 @@ sub create_inbox ($$;@) {
 	my %opt = @_;
 	require PublicInbox::Lock;
 	require PublicInbox::InboxWritable;
+	require PublicInbox::Import;
 	my ($base) = ($0 =~ m!\b([^/]+)\.[^\.]+\z!);
-	my $dir = "t/data-gen/$base.$ident";
+	my ($db) = (PublicInbox::Import::default_branch() =~ m!([^/]+)\z!);
+	my $dir = "t/data-gen/$base.$ident-$db";
 	my $new = !-d $dir;
 	if ($new) {
 		mkdir $dir; # may race

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] test_common: key test inboxes to init.defaultBranch
  2021-10-27  4:07         ` [PATCH] test_common: key test inboxes to init.defaultBranch Eric Wong
@ 2021-10-27  5:04           ` Thomas Weißschuh
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Weißschuh @ 2021-10-27  5:04 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On 2021-10-27 04:07+0000, Eric Wong wrote:
> Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > On 2021-10-26 05:28+0000, Eric Wong wrote:
> > > Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > > > On 2021-10-25 16:58-0600, Eric Wong wrote:
> > > > > Thanks, pushed as 9f3fb207.   It looks like there's several
> > > > > other tests broken with non-master being the default.  Can we
> > > > > expect fixes for those, too?  Thanks again.
> > > > 
> > > > Which tests are failing for you?
> > > 
> > > 	t/edit.t
> > > 	t/indexlevels-mirror.t
> > > 	t/indexlevels-mirror-v1.t
> > > 	t/convert-compact.t
> > > 	t/multi-mid.t
> > > 	t/feed.t
> > 
> > I think these are because of stale data in t/data-gen/ that was generated when
> > you still had the master branch configured.
> > Try to clean out these files and rerun the tests.
> 
> Ah, thanks for spotting that.  I think it's better if the
> cache-invalidation is transparent:

Sounds reasonable.

> -----------8<----------
> Subject: [PATCH] test_common: key test inboxes to init.defaultBranch
> 
> This lets users change their global init.defaultBranch config
> knob in ~/.gitconfig or similar without breaking tests.
> 
> Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
> ---
>  lib/PublicInbox/TestCommon.pm | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
> index fb0d5a4e..c3820d3a 100644
> --- a/lib/PublicInbox/TestCommon.pm
> +++ b/lib/PublicInbox/TestCommon.pm
> @@ -674,8 +674,10 @@ sub create_inbox ($$;@) {
>  	my %opt = @_;
>  	require PublicInbox::Lock;
>  	require PublicInbox::InboxWritable;
> +	require PublicInbox::Import;
>  	my ($base) = ($0 =~ m!\b([^/]+)\.[^\.]+\z!);
> -	my $dir = "t/data-gen/$base.$ident";
> +	my ($db) = (PublicInbox::Import::default_branch() =~ m!([^/]+)\z!);
> +	my $dir = "t/data-gen/$base.$ident-$db";
>  	my $new = !-d $dir;
>  	if ($new) {
>  		mkdir $dir; # may race

Tested-by: Thomas Weißschuh <thomas@t-8ch.de>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* lei-q-remote-import failures [was: [PATCH] t/index-git-times: support non-master default branch]
  2021-10-26 18:43       ` Thomas Weißschuh
@ 2021-10-27 21:15         ` Eric Wong
  2021-10-27 21:24           ` Thomas Weißschuh
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Wong @ 2021-10-27 21:15 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: meta

Thomas Weißschuh <thomas@t-8ch.de> wrote:
> On 2021-10-26 05:28+0000, Eric Wong wrote:
> > Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > > The only failures I still see are in t/lei-q-remote-import.t which is unrelated
> > > to the git branch and some more that fail only during parallel test execution.
> > > 
> > > In t/lei-q-remote-import.t it seems the search results are not memoized to the
> > > local store. (See attachment)
> > 
> > Thanks, I'll check out lei-q-remote-import.t separately.
> > That could be related to SMP or slow/fast storage.
> > Any details you can share about CPU core count, speeds
> > or storage speeds, or CPU scheduler, CONFIG_HZ?
> 
> CPU:
> 
>   Model name:            11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
>     CPU family:          6
>     Model:               140
>     Thread(s) per core:  2
>     Core(s) per socket:  4
>     Socket(s):           1
>     Stepping:            1
>     CPU max MHz:         4700,0000
>     CPU min MHz:         400,0000
> 
> Storage: Samsung EVO 970 (with plenty of memory cache)
> CONFIG_HZ: 300

I'm puzzled by this failure; I'm not sure if I've
ever seen it.  Does it fail when run standalone?
(prove -bvw t/lei-q-remote-import.t)

Maybe running under TEST_LEI_ERR_LOUD=1 or checking
syslog can reveal something.

Adding a sleep shouldn't be necessary, but maybe something
else is broken I'm not seeing...:

diff --git a/t/lei-q-remote-import.t b/t/lei-q-remote-import.t
index 92d8c9b6058c..a2d643cd06c7 100644
--- a/t/lei-q-remote-import.t
+++ b/t/lei-q-remote-import.t
@@ -35,6 +35,7 @@ test_lei({ tmpdir => $tmpdir }, sub {
 	lei_ok(@cmd, '-I', $url);
 	is_deeply($slurp_emls->($o), $exp1, 'got results after remote search');
 	unlink $o or BAIL_OUT $!;
+	sleep 1;
 	lei_ok(@cmd);
 	ok(-f $o && -s _, 'output exists after import but is not empty') or
 		diag $lei_err;

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: lei-q-remote-import failures [was: [PATCH] t/index-git-times: support non-master default branch]
  2021-10-27 21:15         ` lei-q-remote-import failures [was: [PATCH] t/index-git-times: support non-master default branch] Eric Wong
@ 2021-10-27 21:24           ` Thomas Weißschuh
  2021-10-27 23:48             ` Eric Wong
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Weißschuh @ 2021-10-27 21:24 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

[-- Attachment #1: Type: text/plain, Size: 2131 bytes --]

On 2021-10-27 21:15+0000, Eric Wong wrote:
> Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > On 2021-10-26 05:28+0000, Eric Wong wrote:
> > > Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > > > The only failures I still see are in t/lei-q-remote-import.t which is unrelated
> > > > to the git branch and some more that fail only during parallel test execution.
> > > > 
> > > > In t/lei-q-remote-import.t it seems the search results are not memoized to the
> > > > local store. (See attachment)
> > > 
> > > Thanks, I'll check out lei-q-remote-import.t separately.
> > > That could be related to SMP or slow/fast storage.
> > > Any details you can share about CPU core count, speeds
> > > or storage speeds, or CPU scheduler, CONFIG_HZ?
> > 
> > CPU:
> > 
> >   Model name:            11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
> >     CPU family:          6
> >     Model:               140
> >     Thread(s) per core:  2
> >     Core(s) per socket:  4
> >     Socket(s):           1
> >     Stepping:            1
> >     CPU max MHz:         4700,0000
> >     CPU min MHz:         400,0000
> > 
> > Storage: Samsung EVO 970 (with plenty of memory cache)
> > CONFIG_HZ: 300
> 
> I'm puzzled by this failure; I'm not sure if I've
> ever seen it.  Does it fail when run standalone?
> (prove -bvw t/lei-q-remote-import.t)

It also does. The protocol is attached.

> Maybe running under TEST_LEI_ERR_LOUD=1 or checking
> syslog can reveal something.
> 
> Adding a sleep shouldn't be necessary, but maybe something
> else is broken I'm not seeing...:

It didn't help, neither did larger sleeps.

> diff --git a/t/lei-q-remote-import.t b/t/lei-q-remote-import.t
> index 92d8c9b6058c..a2d643cd06c7 100644
> --- a/t/lei-q-remote-import.t
> +++ b/t/lei-q-remote-import.t
> @@ -35,6 +35,7 @@ test_lei({ tmpdir => $tmpdir }, sub {
>  	lei_ok(@cmd, '-I', $url);
>  	is_deeply($slurp_emls->($o), $exp1, 'got results after remote search');
>  	unlink $o or BAIL_OUT $!;
> +	sleep 1;
>  	lei_ok(@cmd);
>  	ok(-f $o && -s _, 'output exists after import but is not empty') or
>  		diag $lei_err;

I'll see if I can debug it in the coming days.

[-- Attachment #2: output-lei-q-remote-import.t --]
[-- Type: text/troff, Size: 6315 bytes --]

$ git checkout origin/master
Note: switching to 'origin/master'.
HEAD is now at ded9dad2 test_common: key test inboxes to init.defaultBranch

$ git clean -fdx t/data-gen/
...

$ TEST_LEI_ERR_LOUD=1 prove -bvw t/lei-q-remote-import.t
# # /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (0 matches)

ok 1 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd m:qp@example.com
ok 2 - output exists but is empty
# lei_err=# /usr/bin/curl -Sf -s -d '' http://[::1]:46299/t2/?x=m&q=m%3Aqp%40example.com
# # /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # http://[::1]:46299/t2/ 1/1
# # 1 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (1 matches)
ok 3 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd m:qp@example.com -I http://[::1]:46299/t2/
ok 4 - got results after remote search
ok 5 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd m:qp@example.com
not ok 6 - output exists after import but is not empty
# lei_err=# /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (0 matches)

#   Failed test 'output exists after import but is not empty'
#   at t/lei-q-remote-import.t line 39.
# # /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (0 matches)
not ok 7 - got results w/o remote search

#   Failed test 'got results w/o remote search'
#   at t/lei-q-remote-import.t line 41.
#     Structures begin differing at:
#          $got->[0] = Does not exist
#     $expected->[0] = PublicInbox::Eml=HASH(0x565282aeff78)
ok 8 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd m:199707281508.AAA24167@hoyogw.example -I http://[::1]:46299/t2/ --no-import-remote
# lei_err=# /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # /usr/bin/curl -Sf -s -d '' http://[::1]:46299/t2/?x=m&q=m%3A199707281508.AAA24167%40hoyogw.example
# # http://[::1]:46299/t2/ 1/1
# # 1 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (1 matches)
ok 9 - got another after remote search
ok 10 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd m:199707281508.AAA24167@hoyogw.example
ok 11 - --no-import-remote did not memoize
# lei_err=# /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (0 matches)
ok 12 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd m:qp@example.com --lock=none
not ok 13 - --lock=none respected
# lei_err=# /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (0 matches)

#   Failed test '--lock=none respected'
#   at t/lei-q-remote-import.t line 55.
# # /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (0 matches)
# lei_err=dotlock timeout /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd.lock
ok 14 - dotlock fails
ok 15 - timeout noted
ok 16 - nothing output on lock failure
ok 17 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd m:qp@example.com --lock=dotlock,timeout=0.000001 (succeeds after lock removal)
# lei_err=# /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # 0 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (0 matches)
ok 18 - lei add-external -q /home/t-8ch/Projekte/public-inbox.org/t/data-gen/lei-q-remote-import.local-external-master
ok 19 - lei q -q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd --only http://[::1]:46299/t2/ m:testmessage@example.com
ok 20 - no warnings or errors
ok 21 - got result from remote external
ok 22 - got expected result
ok 23 - lei q --no-external -o mboxrd:/dev/stdout m:testmessage@example.com
ok 24 - message not imported when in local external
ok 25 - lei q -o mboxrd:/tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd m:testmessage@example.com
# lei_err=# /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/.local/share/lei/store 0/0
# # /home/t-8ch/Projekte/public-inbox.org/t/data-gen/lei-q-remote-import.local-external-master 1/1
# # 1 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/o.mboxrd (1 matches)
ok 26 - got expected result after clobber
ok 27 - lei q -o mboxrd:/dev/stdout m:never-before-seen@example.com
ok 28 - --import-before imported totally unseen message
ok 29 - lei q --save z:0.. -o /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/md --only http://[::1]:46299/t2/
# lei_err=# /usr/bin/curl -Sf -s -d '' http://[::1]:46299/t2/?x=m&q=z%3A0..
# # http://[::1]:46299/t2/ 15/15
# # 15 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/md/ (15 matches)
ok 30 - lei up /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/md
ok 31 - lei up remote dedupe works on maildir
# lei_err=# http://[::1]:46299/t2/ limiting to 2021-10-25 23:18 +0200 and newer
# # /usr/bin/curl -Sf -s -d '' http://[::1]:46299/t2/?x=m&q=(z%3A0..)+AND+dt%3A20211025211849..
# # http://[::1]:46299/t2/ 11/11
# # 0 written to /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/md/ (11 matches)
ok 32 - lei edit-search /tmp/pi-lei-q-remote-import-5668-gmA0/lei-daemon/md
ok 33 - lastresult set
ok 34 - lei daemon-pid (daemon-pid after t/lei-q-remote-import.t:106)
ok 35 - daemon running after t/lei-q-remote-import.t:106
ok 36 - lei daemon-kill (daemon-kill after t/lei-q-remote-import.t:106)
ok 37 - t/lei-q-remote-import.t:106 daemon stopped
ok 38 - t/lei-q-remote-import.t:106 daemon XDG_RUNTIME_DIR/lei/errors.log empty
1..38
# Looks like you failed 3 tests of 38.
Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/38 subtests

Test Summary Report
-------------------
t/lei-q-remote-import.t (Wstat: 768 Tests: 38 Failed: 3)
  Failed tests:  6-7, 13
  Non-zero exit status: 3
Files=1, Tests=38,  1 wallclock secs ( 0.01 usr  0.01 sys +  0.32 cusr  0.08 csys =  0.42 CPU)
Result: FAIL

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lei-q-remote-import failures [was: [PATCH] t/index-git-times: support non-master default branch]
  2021-10-27 21:24           ` Thomas Weißschuh
@ 2021-10-27 23:48             ` Eric Wong
  2021-10-28 14:03               ` Thomas Weißschuh
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Wong @ 2021-10-27 23:48 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: meta

Thomas Weißschuh <thomas@t-8ch.de> wrote:
> It didn't help, neither did larger sleeps.

Thanks for testing.

> I'll see if I can debug it in the coming days.

OK, maybe the patch below can get you started...

I've also been wondering if something like GIT_TRACE is
necessary, but it's also more work to support + document.
And Perl code is easily modified compared to AOT languages.

diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 2a037f2bd79b..a0982138966e 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -281,13 +281,19 @@ sub each_remote_eml { # callback for MboxReader->mboxrd
 	my ($eml, $self, $lei, $each_smsg) = @_;
 	my $xoids = $lei->{ale}->xoids_for($eml, 1);
 	my $smsg = bless {}, 'PublicInbox::Smsg';
+	use Data::Dumper;
 	if ($self->{import_sto} && !$xoids) {
 		my ($res, $kw) = $self->{import_sto}->wq_do('add_eml', $eml);
 		if (ref($res) eq ref($smsg)) { # totally new message
 			$smsg = $res;
+			$lei->qerr("# imported <$smsg->{mid}>") if $ENV{DBG};
 			$self->{-imported} = 1;
+		} elsif ($ENV{DBG}) {
+			$lei->qerr("# res, kw = ".Dumper([$res, $kw]));
 		}
 		$smsg->{kw} = $kw; # short-circuit xsmsg_vmd
+	} elsif ($ENV{DBG}) {
+		$lei->qerr("# no import $self->{import_sto}".Dumper($xoids));
 	}
 	$smsg->{blob} //= $xoids ? (keys(%$xoids))[0]
 				: $lei->git_oid($eml)->hexdigest;
@@ -378,6 +384,9 @@ sub query_remote_mboxrd {
 						$lei, $each_smsg);
 		if ($self->{import_sto} && delete($self->{-imported})) {
 			my $wait = $self->{import_sto}->wq_do('done');
+			$lei->qerr("# flushed imported messages") if $ENV{DBG};
+		} elsif ($ENV{DBG}) {
+			$lei->qerr("# nothing flushed $self->{import_sto}");
 		}
 		$reap_curl->join;
 		if ($? == 0) {
diff --git a/t/lei-q-remote-import.t b/t/lei-q-remote-import.t
index 92d8c9b6058c..e10af2eb7849 100644
--- a/t/lei-q-remote-import.t
+++ b/t/lei-q-remote-import.t
@@ -32,7 +32,11 @@ test_lei({ tmpdir => $tmpdir }, sub {
 	lei_ok(@cmd);
 	ok(-f $o && !-s _, 'output exists but is empty');
 	unlink $o or BAIL_OUT $!;
-	lei_ok(@cmd, '-I', $url);
+	lei_ok([@cmd, '-I', $url], { DBG => 1 });
+
+# should say 'imported <qp@example.com>' + 'flushed imported messages'
+	diag $lei_err;
+return; # drop this if the above diag looks right
 	is_deeply($slurp_emls->($o), $exp1, 'got results after remote search');
 	unlink $o or BAIL_OUT $!;
 	lei_ok(@cmd);


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: lei-q-remote-import failures [was: [PATCH] t/index-git-times: support non-master default branch]
  2021-10-27 23:48             ` Eric Wong
@ 2021-10-28 14:03               ` Thomas Weißschuh
  2021-10-28 19:16                 ` [PATCH] test_common: clear XDG_CACHE_HOME before lei tests Eric Wong
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Weißschuh @ 2021-10-28 14:03 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On 2021-10-27 23:48+0000, Eric Wong wrote:
> Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > It didn't help, neither did larger sleeps.
> 
> Thanks for testing.
> 
> > I'll see if I can debug it in the coming days.
> 
> OK, maybe the patch below can get you started...
> 
> I've also been wondering if something like GIT_TRACE is
> necessary, but it's also more work to support + document.
> And Perl code is easily modified compared to AOT languages.

It turned out that in my $XDG_CONFIG_HOME/lei/all_locals_ever.git/lei_ale.state
there were entries for the repositories in
$PUBLIC_INBOX_SRC/t/home2/{t1,t2}.

I'm not sure how those entries came to be but probably because of some
debugging things I did before.

IMO it would make sense to prevent p-i to read this global state during
unittests.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] test_common: clear XDG_CACHE_HOME before lei tests
  2021-10-28 14:03               ` Thomas Weißschuh
@ 2021-10-28 19:16                 ` Eric Wong
  2021-10-28 19:22                   ` Thomas Weißschuh
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Wong @ 2021-10-28 19:16 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: meta

Thomas Weißschuh <thomas@t-8ch.de> wrote:
> It turned out that in my $XDG_CONFIG_HOME/lei/all_locals_ever.git/lei_ale.state
> there were entries for the repositories in
> $PUBLIC_INBOX_SRC/t/home2/{t1,t2}.
> 
> I'm not sure how those entries came to be but probably because of some
> debugging things I did before.

The presence of t1 & t2 entries is harmless for normal lei
operation; but they shouldn't be there...

I wonder, do you have XDG_CACHE_HOME explicitly set in your env?
If so, that would've caused problems (fixed below).

> IMO it would make sense to prevent p-i to read this global state during
> unittests.

Yes, I think this was from our failure to clobber XDG_CACHE_HOME:

------------8<------------
Subject: [PATCH] test_common: clear XDG_CACHE_HOME before lei tests

We don't want to read a users'
$XDG_CACHE_HOME/lei/all_locals_ever.git during tests.

Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
Link: https://public-inbox.org/meta/f239abac-4aee-4573-a0d6-e533c7a32662@t-8ch.de/
---
 lib/PublicInbox/TestCommon.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index c3820d3a..052d6e45 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -556,16 +556,20 @@ SKIP: {
 	require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2);
 	my $mods = $test_opt->{mods} // [ 'lei' ];
 	require_mods(@$mods, 2);
+
+	# set PERL_INLINE_DIRECTORY before clobbering XDG_CACHE_HOME
+	require PublicInbox::Spawn;
 	require PublicInbox::Config;
 	require File::Path;
+
 	local %ENV = %ENV;
 	delete $ENV{XDG_DATA_HOME};
 	delete $ENV{XDG_CONFIG_HOME};
+	delete $ENV{XDG_CACHE_HOME};
 	$ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com';
 	$ENV{GIT_COMMITTER_NAME} = 'lei user';
 	my (undef, $fn, $lineno) = caller(0);
 	my $t = "$fn:$lineno";
-	require PublicInbox::Spawn;
 	state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') ||
 				eval { require Socket::MsgHdr; 1 };
 	unless ($lei_daemon) {

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] test_common: clear XDG_CACHE_HOME before lei tests
  2021-10-28 19:16                 ` [PATCH] test_common: clear XDG_CACHE_HOME before lei tests Eric Wong
@ 2021-10-28 19:22                   ` Thomas Weißschuh
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Weißschuh @ 2021-10-28 19:22 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On 2021-10-28 19:16+0000, Eric Wong wrote:
> Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > It turned out that in my $XDG_CONFIG_HOME/lei/all_locals_ever.git/lei_ale.state
> > there were entries for the repositories in
> > $PUBLIC_INBOX_SRC/t/home2/{t1,t2}.
> > 
> > I'm not sure how those entries came to be but probably because of some
> > debugging things I did before.
> 
> The presence of t1 & t2 entries is harmless for normal lei
> operation; but they shouldn't be there...
> 
> I wonder, do you have XDG_CACHE_HOME explicitly set in your env?
> If so, that would've caused problems (fixed below).

Yes I have it set explicitly

> > IMO it would make sense to prevent p-i to read this global state during
> > unittests.
> 
> Yes, I think this was from our failure to clobber XDG_CACHE_HOME:

That works, thanks!

Tested-by: Thomas Weißschuh <thomas@t-8ch.de>

> ------------8<------------
> Subject: [PATCH] test_common: clear XDG_CACHE_HOME before lei tests
> 
> We don't want to read a users'
> $XDG_CACHE_HOME/lei/all_locals_ever.git during tests.
> 
> Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
> Link: https://public-inbox.org/meta/f239abac-4aee-4573-a0d6-e533c7a32662@t-8ch.de/
> ---
>  lib/PublicInbox/TestCommon.pm | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
> index c3820d3a..052d6e45 100644
> --- a/lib/PublicInbox/TestCommon.pm
> +++ b/lib/PublicInbox/TestCommon.pm
> @@ -556,16 +556,20 @@ SKIP: {
>  	require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2);
>  	my $mods = $test_opt->{mods} // [ 'lei' ];
>  	require_mods(@$mods, 2);
> +
> +	# set PERL_INLINE_DIRECTORY before clobbering XDG_CACHE_HOME
> +	require PublicInbox::Spawn;
>  	require PublicInbox::Config;
>  	require File::Path;
> +
>  	local %ENV = %ENV;
>  	delete $ENV{XDG_DATA_HOME};
>  	delete $ENV{XDG_CONFIG_HOME};
> +	delete $ENV{XDG_CACHE_HOME};
>  	$ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com';
>  	$ENV{GIT_COMMITTER_NAME} = 'lei user';
>  	my (undef, $fn, $lineno) = caller(0);
>  	my $t = "$fn:$lineno";
> -	require PublicInbox::Spawn;
>  	state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') ||
>  				eval { require Socket::MsgHdr; 1 };
>  	unless ($lei_daemon) {

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-10-28 19:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 22:24 [PATCH] t/index-git-times: support non-master default branch Thomas Weißschuh
2021-10-25 22:58 ` Eric Wong
2021-10-26  5:05   ` Thomas Weißschuh
2021-10-26  5:28     ` Eric Wong
2021-10-26 18:43       ` Thomas Weißschuh
2021-10-27 21:15         ` lei-q-remote-import failures [was: [PATCH] t/index-git-times: support non-master default branch] Eric Wong
2021-10-27 21:24           ` Thomas Weißschuh
2021-10-27 23:48             ` Eric Wong
2021-10-28 14:03               ` Thomas Weißschuh
2021-10-28 19:16                 ` [PATCH] test_common: clear XDG_CACHE_HOME before lei tests Eric Wong
2021-10-28 19:22                   ` Thomas Weißschuh
2021-10-26 21:24       ` [PATCH] t/index-git-times: support non-master default branch Thomas Weißschuh
2021-10-27  4:07         ` [PATCH] test_common: key test inboxes to init.defaultBranch Eric Wong
2021-10-27  5:04           ` Thomas Weißschuh

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).