unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Tomas Volf <~@wolfsden.cz>
To: Taylan Kammer <taylan.kammer@gmail.com>
Cc: 72365@debbugs.gnu.org
Subject: bug#72365: srfi-64: test-on-bad-end-name-simple is not allowed to raise an exception
Date: Thu, 03 Oct 2024 00:17:47 +0200	[thread overview]
Message-ID: <87bk0240ac.fsf@wolfsden.cz> (raw)
In-Reply-To: <8320ebef-80f6-46ee-b01e-620282926f9c@gmail.com> (Taylan Kammer's message of "Wed, 2 Oct 2024 23:07:01 +0200")

Taylan Kammer <taylan.kammer@gmail.com> writes:

> Do I understand correctly that this is an additional test suite for
> testing SRFI-64 itself? Like the "meta test suite" shipped with
> SRFI-64?

Yes, exactly.  Vast majority of the tests are just derived from the
specification, with few non-portable written just for my implementation,
but those can be turned off.

>
> Is there a brief description somewhere on how to run it with Guile?
> Would be really neat if I can use it to further test my
> implementation.

It is not hard, but at the same time the test suite is not really
stand-alone, so the instructions will be bit hackish.

1. Download https://files.wolfsden.cz/releases/guile-wolfsden/guile-wolfsden-0.0.1.tar.gz
2. Unpack it.
3. Open `build-aux/srfi64test-driver.scm'.
4. On line 35 replace 'wolfsden with 'guile.
5. Open `Makefile.am'.
6. Delete lines 17-19 (assignment to `TESTS' variable).
7. Open `tests/srfi-64/local.mk'.
8. On line 4 change `TESTS +=' to `TESTS ='.
9. Build the project and run the tests:

    $ autoreconf -fvi
    $ ./configure --disable-doc-snarf
    $ make
    $ make check

Due to step 4. only portable (== written based on specification) tests
will run, and they will run against (srfi srfi-64).  Since you library
is available as that module, just make sure it is on the load path.
When I follow the steps, I get:

    # TOTAL: 340
    # PASS:  265
    # SKIP:  36
    # XFAIL: 0
    # FAIL:  39
    # XPASS: 0
    # ERROR: 0

You should get less FAILs I guess (since you have fixed many problems
already, and some you did not even have).

I am sure you will dispute some of those tests.  ^_^

>> You can find my version here[0].  If you do not use Guix, building from
>> tarball[1] might be easier.  Contrary to your version, mine is available
>> as (wolfsden srfi srfi-64).
>>
>> 0: https://git.wolfsden.cz/guile-wolfsden/
>> 1: https://wolfsden.cz/project/guile-wolfsden.html
>
> Your implementation seems written specifically with Guile in mind,
> which is a big plus I guess.

Yes, I decided to write my version in as-readable manner as possible
(well, at least I hope the code is readable), at the cost of
portability.  Since I have seen what portability did to (srfi srfi-64).

> If the quality of the implementations is the same or higher, in terms of
> observable behavior, then it should be preferred for Guile, I think. If I find
> the time, I'll see if I can use your implementation to run some of my test
> suites, like the bytestructures test suite, and report if I notice any
> issues.

Oh, that would be much appreciated.  I did test my version against
Guix's test suite (and it revealed 4 bugs in Guix's tests) and none in
my library, so I hope results for your project would be similar.

>>> In one case, the reference implementation clearly violates the specification:
>>> The simple test runner uses the `aux` field which the spec claims it doesn't
>>> use. (My implementation fixes this.) However, in this case it's not that
>>> clear-cut.
>>>
>>> In this case, I think raising an error is good default behavior, since the
>>> mismatched end name indicates a problem with the test suite itself rather than
>>> the code being tested. If it poses a problem to the user, one can override that
>>> callback with the `test-runner-on-bad-end-name!` setter.
>>>
>>> What do you think?
>> I agree that raising an error is good behavior.  However I do not think
>> that on-bad-end-name-function is a place where to do it.  In my opinion
>> the name mismatch is a hard error, in my implementation subclass of
>> &programming-error[4].  If I am writing new test runner, the
>> specification does not mention that raising the error is *my*
>> responsibility, just that test-end will signal an error.
>>
>> To rephrase that: test-end is mandated to signal error, but custom test
>> runner has no provision requiring it to do it in
>> on-bad-end-name-function.  Hence I believe test-end needs to be the one
>> to signal the error.
>
> Makes sense I guess. I've generally tried to imitate the reference
> implementation's behavior as closely as possible in such matters, worrying that
> there might be code out there that relies on its various quirks, but maybe I'm
> being too paranoid.

I tried to not use reference implementation that much, and instead
relied on the specification.  It was slow and painful process.

> I don't have a strong opinion either way. The number of people, who want to
> write a test runner that does something special on bad-end-name (something other
> than raise an error), is probably very small.

I definitely agree on this one.

>
> - Making `test-end` itself raise an error would probably be most convenient, so test runner authors don't have to take care of it.
>
> - But if `test-end` doesn't do it, it's not a big deal either IMO, because all
> they would need to do is to call `(test-runner-on-bad-end-name! my-runner
> test-on-bad-end-name-simple)` to make their custom runner raise an error as
> well. (And, if they want to do something before, they can use a procedure that
> ends with the call `(test-on-bad-end-name-simple ...)`.)
>
> The latter is my preference, because enabling the behavior via a single line of
> code is easy, whereas disabling it would be difficult / impossible if `test-end`
> were to be hardcoded to raise an error. But if a SRFI-64 implementation made its
> `test-end` always raise an error, it probably wouldn't anyone in practice, so I
> wouldn't see it as a real problem.

I still think test-end itself raising is what specification mandates
(whether it *should* mandate it is a different question :) ), however I
agree, I also am skeptical anyone's code actually cares either way.

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.





      reply	other threads:[~2024-10-02 22:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30 19:51 bug#72365: srfi-64: test-on-bad-end-name-simple is not allowed to raise an exception Tomas Volf
2024-09-30 13:24 ` Taylan Kammer
2024-10-02 12:28   ` Tomas Volf
2024-10-02 21:07     ` Taylan Kammer
2024-10-02 22:17       ` Tomas Volf [this message]

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://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=87bk0240ac.fsf@wolfsden.cz \
    --to=~@wolfsden.cz \
    --cc=72365@debbugs.gnu.org \
    --cc=taylan.kammer@gmail.com \
    /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).