about summary refs log tree commit
path: root/t
AgeCommit message (Collapse)AuthorFilesLines
2020-02-15t/msg_iter: test for X-UNKNOWN charset from AlpineEric Wong2-0/+41
A long overdue test for behavior established in 2016. Fixes: 1b28cc7f00a866cb ("view: try assuming UTF-8 for bogus charsets")
2020-02-08t/multi-mid: skip properly w/o DBD::SQLiteEric Wong1-1/+1
SearchIdx always requires DBD::SQLite, so only require it after we've passed `require_mods(qw(DBD::SQLite))'.
2020-02-07tests: switch to XML::TreePP for testing Atom feedsEric Wong3-26/+33
XML::Feed pulls in a lot of dependencies, some of which XS. That makes testing with blead or any non-OS-supplied Perl installations more time consuming and more difficult because of the need to have development headers and libraries for libexpat1 or libxml2. Performance from libexpat1 or libxml2 for our small tests cases isn't relevant, either, and the pure Perl XML::TreePP seems up to the task. It's also available in CentOS 7.x, FreeBSD 11.x, and Debian, at least.
2020-02-07syscall: support Linux x32 ABIEric Wong1-0/+20
The x32 ABI allows users to take advantage of the extra registers on x86-64 without the bloat of 64-bit pointers and longs. This ought to be significant since Perl was designed when 32-bit was prevalent; and the common structs for ops, hashes, scalars, and arrays use longs (SSize_t/Size_t) for things which should never need 64-bits when processing emails. Debian's x32 port seems to work quite nicely under a chroot on an amd64 Linux system. All tests pass under x32, now.
2020-02-06treewide: run update-copyrights from gnulib for 2019Eric Wong85-85/+85
I didn't wait until September to do it, this year!
2020-02-06t/multi-mid: don't access ~/.public-inbox/configEric Wong1-2/+2
It can cause unpredictable behavior and also slow things down. Followup-to: e4d3be19612b2082 ("t: localize the PI_CONFIG env")
2020-02-04over: simplify read-only vs read-write checkingEric Wong1-1/+6
No need to call ref() and do a string comparison. Add some extra tests using the {ReadOnly} attribute in DBI.pm.
2020-02-04www: serve $INBOX_DIR/description as $INBOX_URL/descriptionEric Wong2-0/+5
Instead of serving $INBOX_DIR/all.git/description, since $INBOX_DIR/all.git/description is not described in the default message when it's missing.
2020-02-04www: stricter regexp for 405 errorsEric Wong1-0/+5
We want to match "GET" and "HEAD" exactly, not requests which start with "GET" or end with "HEAD". This doesn't seem like a real problem for public-inboxes which are actually public data anyways.
2020-02-02convert: fix --no-index switchEric Wong1-0/+3
The (currently undocumented) "--no-index" flag did not trigger the V2Writable->done call necessary to make the import successful. Fixes: eea47b676127bcdb ("convert: preserve highwater mark from v1 msgmap")
2020-02-02v2writable: nproc_shards: subtract 1 from given valueEric Wong1-1/+1
This is to be consistent with the `nproc(1)' code path. It also quiets down a warning from Admin when "-j $JOBS" is specified, since the master process (which distributes work to shards and handles OverIdx and Msgmap) is considered a job on its own.
2020-02-02t/multi-mid.t: extra test for -convert highwater markEric Wong1-0/+61
This is derived from a real-world test case where I encounterd multiple Message-IDs in a v1 inbox causing regen problems. Fixes: eea47b676127bcdb ("convert: preserve highwater mark from v1 msgmap")
2020-01-31convert: preserve highwater mark from v1 msgmapEric Wong1-0/+8
If we're reusing the msgmap from a v1 inbox, we also need to ensure the highwater mark doesn't get doubled in the v1->v2 conversion by internally triggering the equivalent of "--reindex" on a fresh v2 inbox. This was needed to convert an indexed v1 inbox which featured messages with multiple Message-IDs in it. Fresh, unindexed clones of v1 inboxes would not have been affected by this.
2020-01-31mboxgz: ensure gzipped mboxes always have filenamesEric Wong1-0/+6
Lets always have Content-Disposition for files intended to be downloaded for consumption by non-browsers, such as pigz, zcat, "git am". This is also to be consistent with the non-gzipped mbox $MESSAGE_ID/raw endpoint.
2020-01-31t/psgi_search: test for subject-free messagesEric Wong1-2/+31
Apparently I fixed this bug a while back in commit f94c3a195a25a31d0215cd175938008fca473378 but did not write tests.
2020-01-28v2writable: newest epochs go first in alternatesEric Wong1-0/+24
New epochs are the most likely to have loose objects. git won't be able to take advantage of pack indices and needs to scan every alternate for the loose object via open/openat syscalls. Those syscalls will add up some day when we've got hundreds or thousands of epochs.
2020-01-28t/v2reindex.t: 5.10.1 glob compatibilityEric Wong1-3/+3
I'm not sure when `for (<"quoted string/glob/*">)' became supported, and maybe it was inadvertant, but it fails with Perl 5.10.1. Just use the glob() function to be explicit.
2020-01-28t/hl_mod: document IO::Handle for autoflushEric Wong1-0/+1
We don't need IO::File for this test, but IO::Handle is needed for ->autoflush with Perl <5.14. Note: I haven't tested highlight.pm under 5.10.1 since it's a weird dependency which isn't easy to install w/o distro support.
2020-01-28avoid relying on IO::Handle/IO::File autoloadEric Wong2-5/+4
Perl 5.14+ gained the ability to autoload IO::File (and IO::Handle) on missing methods, so relying on this breaks under 5.10.1. There's no reason to load IO::File or IO::Handle when built-in perlops work fine and are even a hair faster.
2020-01-28daemon: provide TCP_DEFER_ACCEPT for Perl <5.14Eric Wong4-7/+8
Socket::TCP_DEFER_ACCEPT() did not appear in the Socket module distributed with Perl until 5.14, despite it being available since Linux 2.4.
2020-01-27tests: move the majority of t/view.t into t/plack.tEric Wong3-190/+106
And some more into t/mid.t. PublicInbox::View::msg_html may change internally, so lets rely on the stable PSGI interface to test it, rather than a test which reaches deep into the internals.
2020-01-27t/plack.t: modernize and unindentEric Wong1-202/+191
This test will be expanded, and we can take advantage of run_script to simplify our internal API use.
2020-01-23hval: from_attr: move to unit testEric Wong1-1/+14
We don't call from_attr anywhere outside of tests, so don't bloat normal processes with it.
2020-01-23hval: to_attr: support wide charactersEric Wong2-1/+12
We need to escape wide characters when making attribute names from filename-looking things in diffstats.
2020-01-13ds: add_timer: rename from AddTimer, remove a parameterEric Wong1-1/+1
The class parameter is pointless, especially for an internal sub which only has one external caller in a test. Add a sub prototype while we're at it to get some compile time checking.
2020-01-13use popen_rd for bidirectional pipesEric Wong1-5/+4
popen_rd accepts arbitrary redirects, so we can reuse its code to setup the pipe end we want to read, saving each caller a few lines of code compared to calling pipe+spawn.
2020-01-13t/solver_git: avoid uninitialized warnings in hostname generationEric Wong1-1/+2
Outside of tests, this is only relevant for non-PSGI use, which may happen someday... Fixes: cb1c874520153f5c ("inbox: use PublicInbox::Git::host_prefix_url for base_url")
2020-01-11make Plack optional for non-WWW and non-httpd usersEric Wong11-24/+22
Some users just want to run -mda, -watch, and/or -nntpd. Let them run just those without forcing them to pull in a bunch of dependencies.
2020-01-11spawn (and thus popen_rd) die on failureEric Wong1-1/+0
Most spawn and popen_rd callers die on failure to spawn, anyways, and some are missing checks entirely. This saves us a bunch of verbose error-checking code in callers. This also makes popen_rd more consistent, since it already dies on pipe creation failures.
2020-01-11git: remove ->commit_title methodEric Wong1-6/+0
We haven't used it in SolverGit, yet, and I'll be reworking it to work with ->cat_async, instead.
2020-01-11inbox: use PublicInbox::Git::host_prefix_url for base_urlEric Wong1-1/+1
Better not to duplicate the same logic across different classes. Also, our git wrapper class is a strange place for host_prefix_url, but it needs to be usable for coderepos, so it's there, for now...
2020-01-06treewide: "require" + "use" cleanup and docsEric Wong2-4/+0
There's a bunch of leftover "require" and "use" statements we no longer need and can get rid of, along with some excessive imports via "use". IO::Handle usage isn't always obvious, so add comments describing why a package loads it. Along the same lines, document the tmpdir support as the reason we depend on File::Temp 0.19, even though every Perl 5.10.1+ user has it. While we're at it, favor "use" over "require", since it it gives us extra compile-time checking.
2020-01-06t/nntp.t: fix parse_time test for non-GMT local timeEric Wong1-1/+1
Yes, there's actually other timezones!
2020-01-05tests: remove some "git config" calls after "git init"Eric Wong3-29/+24
Creating a hash and iterating through it just to run "git config" is ugly and slow. Just write out the text file in a human-friendly way since the git-config file format is stable and won't break randomly.
2020-01-05search: remove lookup_articleEric Wong1-4/+8
It was no longer used outside of tests, so don't penalize regular users with the extra function. Just inline it for t/search.t.
2020-01-04tests: fix running without SQLite or XapianEric Wong1-2/+5
PublicInbox::Search always loads DBD::SQLite, so we can't blindly "use" it in t/xcpdb-reshard.t. We also need to account for that in TestCommon.
2020-01-02config: support multi-value inbox.*.*urlEric Wong4-6/+6
Since the beginning of this project, we've implicitly supported inboxes with multiple URLs by relying on the Host: header sent by the client ($env->{HTTP_HOST}). We now offer the option to explicitly configure multiple URLs for every inbox along with the ability to do a best-effort match for matching hostnames.
2020-01-01wwwstatic: add directory listing + index.html supportEric Wong1-0/+96
It's now possible to use WwwStatic as a standalone PSGI app to serve static files and recreate the award-winning web design of https://public-inbox.org/ :>
2020-01-01nntp: handle 2-digit year "70" properlyEric Wong1-7/+11
Time::Local has the concept of a "rolling century" which is defined at 50 years on either side of the current year. Since it's now 2020 and >50 years since the Unix epoch, the year "70" gets interpreted by Time::Local as 2070-01-01 instead of 1970-01-01. Since NNTP servers are unlikely to store messages from the future, we'll feed 4-digit year to Time::Local::{timegm,timelocal} and hopefully not have to worry about things until Y10K. This fixes test failures on t/v2writable.t and t/nntpd.t since 2020-01-01.
2019-12-30spawn: allow passing GLOB handles for redirectsEric Wong6-5/+10
We can save callers the trouble of {-hold} and {-dev_null} refs as well as the trouble of calling fileno().
2019-12-28solvergit: allow passing arg to user-supplied callbackEric Wong1-0/+4
This allows us to get rid of the requirement to capture on-stack variables with an anonymous sub, as illustrated with the update to viewvcs to take advantage of this. v2: fix error handling for missing OIDs
2019-12-26qspawn: psgi_return_start: hoist out from psgi_returnEric Wong1-9/+10
Instead of just passing the rpipe to the start_cb, pass the entire qspawn ref to start_cb. Update existing callers to avoid circular refs.
2019-12-26git: allow async_cat to pass arg to callbackEric Wong1-0/+21
This allows callers to avoid allocating several KB for for every call to ->async_cat.
2019-12-26t/solver_git: test with -httpd, tooEric Wong1-11/+31
Solver uses the internal -httpd async API if available for fairness when applying large patchsets. We must test those code paths in addition to the generic PSGI code paths.
2019-12-26t/www_listing: test "all" HTML listingEric Wong1-1/+6
We now have coverage for PublicInbox::WwwListing::list_all.
2019-12-26t/www_listing: quiet down stderr in -httpdEric Wong1-0/+1
We need to init all.git for the v2 repo test to ensure `git --git-dir=v2/all.git rev-parse --git-path objects/info/alternates` doesn't warn or fail and clutter stderr. This is noticeable when setting TAIL="tail -F" in env before running this test.
2019-12-25t/psgi_v2: test search results Atom feed endpointEric Wong1-0/+10
The "x=A" search results endpoint finally gets test coverage.
2019-12-24t/search.t: update permissions check for OpenBSDEric Wong1-3/+3
OpenBSD (tested 6.5 on amd64) seems to follow the same semantics as FreeBSD for S_ISGID, even if config.mak.uname in git.git doesn't say so.
2019-12-24search: support SWIG-generated Xapian.pmEric Wong5-8/+10
Xapian upstream is slowly phasing out the XS-based Search::Xapian in favor of the SWIG-generated "Xapian" package. While Debian and both FreeBSD have Search::Xapian, OpenBSD only includes the "Xapian" binding. More information about the status of the "Xapian" Perl module here: https://trac.xapian.org/ticket/523
2019-12-24testcommon: add require_mods method and use itEric Wong43-228/+60
This cuts down on lines of code in individual test cases and fixes some misnamed error messages by using "$0" consistently. This will also provide us with a method of swapping out dependencies which provide equivalent functionality (e.g "Xapian" SWIG can replace "Search::Xapian" XS bindings).