ratpoison-devel
[Top][All Lists]
Advanced

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

[RP] testsuite ideas


From: Gergely Nagy
Subject: [RP] testsuite ideas
Date: Fri, 16 Feb 2001 18:04:33 +0100
User-agent: Mutt/1.3.12i

Hi there!

I was thinking about how to implement a testsuite for ratpoison, and
I have the following ideas:

1) Each test program should conform to a common standard. What I
was thinking about is something like this:

/* testsuite-main.c */
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

extern int test_main ( int argc, char **argv );
extern unsigned int timeout;

void
alarm_handler ( int signum )
{
        fprintf ( stderr, "%s: %d: Error: Timeout!\n", __FILE__, __LINE__ );
        exit ( EXIT_FAILURE );
}

int
main ( int argc, char **argv )
{
        signal ( SIGALRM, (sighandler_t) alarm_handler );

        alarm ( timeout );

        return test_main ( argc, argv );
}
/* EOF */

Then, every test program would have a
testwhatever_SOURCES=testwhatever.c testsuite-main,c
line in Makefile.am. They should also define the test_main function,
and a timeout.

2) To fit in the automake provided TESTS= scheme, the test_main
function should return 0 on success, 1 on error, and 77 if the
test should be ignored.

3) Hmmm... I thought I have more ideas. Well... I don't :)

I guess that this would be flexible enough, and it won't require
killing the client or something. My main problem however is that
how should we start ratpoison and the client ? And how should we
shut down ratpoison cleanly ?

One thing that would be nice is a --echo-pid option to ratpoison.
It would simply do a printf("%d\n", getpid()); and continue. This
way we could send a SIGTERM to it when the testsuite ended.

Oh! Another thing ! Should we restart ratpoison for each test,
or do the whole thing in one session ? Or perhaps we could have
some dirs below testsuite/, each one executed in one rp session...

(/me prefers the last one)

Gergely Nagy \ mhp/|8]
-- 
------------------------=]| address@hidden |[=------------------------
..................... Powered by bread 'n water .....................

Attachment: pgpL5MMFlTfO3.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]