All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Pekka Enberg <penberg@kernel.org>
Cc: Christopher Li <sparse@chrisli.org>,
	linux-sparse@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] sparse: Reduce 'test-suite' run output
Date: Sat, 27 Aug 2011 13:39:59 +0200	[thread overview]
Message-ID: <20110827113959.GA15022@debian.debian> (raw)
In-Reply-To: <alpine.DEB.2.00.1108271112110.2570@localhost6.localdomain6>

On Sat, Aug 27, 2011 at 11:13:17AM +0300, Pekka Enberg wrote:
> On Fri, 26 Aug 2011, Christopher Li wrote:
> 
> >On Fri, Aug 26, 2011 at 6:50 AM, Pekka Enberg <penberg@kernel.org> wrote:
> >>There's more than 100 tests in the validation test suite. That makes it
> >>cumbersome to notice test breakage in because the results don't fit on single
> >>page.
> >
> >Looks good in a terminal. But if the output is piped to a file, it will be hard
> >to read that file. We shouldn't do it for a non-terminal output.
> 
> Right. How can I check if we're outputting to non-terminal?

You probably need a C helper, like this:

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>

int main(int argc, char **argv)
{
	int fd, tmp;

	if (argc < 2) {
		printf("usage: %s fd\n", argv[0]);
		return EXIT_FAILURE;
	}

	errno = 0;
	fd = (int) strtol(argv[1], NULL, 10);
	if (errno == ERANGE) {
		perror("bad fd");
		return EXIT_FAILURE;
	}

	tmp = isatty(fd);
	if (!tmp && errno == EBADF)
		perror("");

	return tmp ? EXIT_SUCCESS : EXIT_FAILURE;
}

HTH,
	Jonathan Neuschäfer
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-08-27 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 13:50 [PATCH] sparse: Reduce 'test-suite' run output Pekka Enberg
2011-08-27  2:11 ` Christopher Li
2011-08-27  8:13   ` Pekka Enberg
2011-08-27 11:39     ` Jonathan Neuschäfer [this message]
2011-08-27 15:15     ` Ben Pfaff
2011-08-27 18:17       ` Jonathan Neuschäfer

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=20110827113959.GA15022@debian.debian \
    --to=j.neuschaefer@gmx.net \
    --cc=linux-sparse@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.org \
    /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.