All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@gmail.com>
To: Matt Mackall <mpm@selenic.com>
Cc: Paul Jackson <pj@sgi.com>,
	akpm@osdl.org, linux-kernel@vger.kernel.org,
	penberg@cs.helsinki.fi
Subject: Re: [PATCH 9/8] lib/sort: turn off self-test
Date: Thu, 10 Feb 2005 09:04:49 +0200	[thread overview]
Message-ID: <84144f02050209230413d87904@mail.gmail.com> (raw)
In-Reply-To: <20050131170344.GP2891@waste.org>

On Mon, 31 Jan 2005 09:03:44 -0800, Matt Mackall <mpm@selenic.com> wrote:
> It's a nice self-contained unit test. It's here because I ran into a
> strange regparm-related bug when developing the code in userspace and
> I wanted to be sure that it was easy to diagnose in the field if a
> similar bug appeared in the future. I actually think that more code
> ought to have such tests, so long as they don't obscure the code in
> question.

Unit tests are nice and your approach is wrong. The test does not
belong in the implementation for two reasons: it hurts readability of
the actual code and the _commented out_ test will not be maintained
(dead code never is).

I don't know if the maintainers are interested in unit tests but a
better solution would be to  put your test in a separate file and make
sure it is always compiled and executed when CONFIG_UNIT_TEST is
enabled.

P.S. If the test fails, it probably should do BUG().

                               Pekka

      parent reply	other threads:[~2005-02-10  7:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-31  7:44 [PATCH 9/8] lib/sort: turn off self-test Matt Mackall
2005-01-31 11:57 ` Paul Jackson
2005-01-31 12:20   ` Andreas Gruenbacher
2005-01-31 17:03   ` Matt Mackall
2005-01-31 20:49     ` Paul Jackson
2005-02-10  3:28     ` Werner Almesberger
2005-02-10  7:04     ` Pekka Enberg [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

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

  git send-email \
    --in-reply-to=84144f02050209230413d87904@mail.gmail.com \
    --to=penberg@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=pj@sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.