Re: [PATCH] sparse: Reduce 'test-suite' run output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux