comsat: improve tty handling, add testsuite.
* comsat/action.c (need_crlf, _open_tty, open_tty): Moved from comsat.c (open_default_tty): New function. (run_user_action): Take device name as first argument. Reuse wordsplit memory. * comsat/comsat.c (notify_user): Update invocation of run_user_action. * comsat/comsat.h (open_tty): Remove prototype. (run_user_action): Change signature. * configure.ac: Add comsat tests. * comsat/Makefile.am (SUBDIRS): Add tests. * comsat/tests/.gitignore: New file. * comsat/tests/Makefile.am: New file. * comsat/tests/atlocal.in: New file. * comsat/tests/testsuite.at: New file.
Showing
9 changed files
with
386 additions
and
126 deletions
... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
16 | ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | 16 | ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | INCLUDES = @MU_APP_COMMON_INCLUDES@ | 18 | INCLUDES = @MU_APP_COMMON_INCLUDES@ |
19 | 19 | SUBDIRS = . tests | |
20 | sbin_PROGRAMS = comsatd | 20 | sbin_PROGRAMS = comsatd |
21 | 21 | ||
22 | comsatd_SOURCES = action.c comsat.c comsat.h | 22 | comsatd_SOURCES = action.c comsat.c comsat.h | ... | ... |
... | @@ -325,12 +325,129 @@ open_rc (const char *filename, mu_stream_t tty) | ... | @@ -325,12 +325,129 @@ open_rc (const char *filename, mu_stream_t tty) |
325 | return stream; | 325 | return stream; |
326 | } | 326 | } |
327 | 327 | ||
328 | static int | ||
329 | need_crlf (mu_stream_t str) | ||
330 | { | ||
331 | #if defined(OPOST) && defined(ONLCR) | ||
332 | mu_transport_t trans[2]; | ||
333 | struct termios tbuf; | ||
334 | |||
335 | if (mu_stream_ioctl (str, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, trans)) | ||
336 | return 1; /* suppose we do need it */ | ||
337 | if (tcgetattr ((int)trans[0], &tbuf) == 0 && | ||
338 | (tbuf.c_oflag & OPOST) && (tbuf.c_oflag & ONLCR)) | ||
339 | return 0; | ||
340 | else | ||
341 | return 1; | ||
342 | #else | ||
343 | return 1; /* Just in case */ | ||
344 | #endif | ||
345 | } | ||
346 | |||
347 | static mu_stream_t | ||
348 | _open_tty (const char *device, int argc, char **argv) | ||
349 | { | ||
350 | mu_stream_t dev, base_dev, prev_stream; | ||
351 | int status; | ||
352 | |||
353 | status = mu_file_stream_create (&dev, device, MU_STREAM_WRITE); | ||
354 | if (status) | ||
355 | { | ||
356 | mu_error (_("cannot open device %s: %s"), | ||
357 | device, mu_strerror (status)); | ||
358 | return NULL; | ||
359 | } | ||
360 | mu_stream_set_buffer (dev, mu_buffer_line, 0); | ||
361 | |||
362 | prev_stream = base_dev = dev; | ||
363 | while (argc) | ||
364 | { | ||
365 | int i; | ||
366 | int mode; | ||
367 | int qmark; | ||
368 | char *fltname; | ||
369 | |||
370 | fltname = argv[0]; | ||
371 | if (fltname[0] == '?') | ||
372 | { | ||
373 | qmark = 1; | ||
374 | fltname++; | ||
375 | } | ||
376 | else | ||
377 | qmark = 0; | ||
378 | |||
379 | if (fltname[0] == '~') | ||
380 | { | ||
381 | mode = MU_FILTER_DECODE; | ||
382 | fltname++; | ||
383 | } | ||
384 | else | ||
385 | { | ||
386 | mode = MU_FILTER_ENCODE; | ||
387 | } | ||
388 | |||
389 | for (i = 1; i < argc; i++) | ||
390 | if (strcmp (argv[i], "+") == 0) | ||
391 | break; | ||
392 | |||
393 | if (qmark == 0 || need_crlf (base_dev)) | ||
394 | { | ||
395 | status = mu_filter_create_args (&dev, prev_stream, fltname, | ||
396 | i, (const char **)argv, | ||
397 | mode, MU_STREAM_WRITE); | ||
398 | mu_stream_unref (prev_stream); | ||
399 | if (status) | ||
400 | { | ||
401 | mu_error (_("cannot open filter stream: %s"), | ||
402 | mu_strerror (status)); | ||
403 | return NULL; | ||
404 | } | ||
405 | prev_stream = dev; | ||
406 | } | ||
407 | argc -= i; | ||
408 | argv += i; | ||
409 | if (argc) | ||
410 | { | ||
411 | argc--; | ||
412 | argv++; | ||
413 | } | ||
414 | } | ||
415 | return dev; | ||
416 | } | ||
417 | |||
418 | mu_stream_t | ||
419 | open_tty (const char *device, int argc, char **argv) | ||
420 | { | ||
421 | mu_stream_t dev; | ||
422 | |||
423 | if (!device || !*device || strcmp (device, "null") == 0) | ||
424 | { | ||
425 | int rc = mu_nullstream_create (&dev, MU_STREAM_WRITE); | ||
426 | if (rc) | ||
427 | mu_error (_("cannot open null stream: %s"), mu_strerror (rc)); | ||
428 | } | ||
429 | else | ||
430 | dev = _open_tty (device, argc, argv); | ||
431 | return dev; | ||
432 | } | ||
433 | |||
434 | static mu_stream_t | ||
435 | open_default_tty (const char *device) | ||
436 | { | ||
437 | static char *default_filters[] = { "7bit", "+", "?CRLF", NULL }; | ||
438 | return open_tty (device, MU_ARRAY_SIZE (default_filters) - 1, | ||
439 | default_filters); | ||
440 | } | ||
441 | |||
328 | void | 442 | void |
329 | run_user_action (mu_stream_t tty, mu_message_t msg) | 443 | run_user_action (const char *device, mu_message_t msg) |
330 | { | 444 | { |
331 | mu_stream_t input; | 445 | mu_stream_t input; |
332 | int nact = 0; | 446 | int nact = 0; |
447 | mu_stream_t tty = open_default_tty (device); | ||
333 | 448 | ||
449 | if (!tty) | ||
450 | return; | ||
334 | input = open_rc (biffrc, tty); | 451 | input = open_rc (biffrc, tty); |
335 | if (input) | 452 | if (input) |
336 | { | 453 | { |
... | @@ -340,6 +457,8 @@ run_user_action (mu_stream_t tty, mu_message_t msg) | ... | @@ -340,6 +457,8 @@ run_user_action (mu_stream_t tty, mu_message_t msg) |
340 | char *cwd = mu_getcwd (); | 457 | char *cwd = mu_getcwd (); |
341 | char *rcname; | 458 | char *rcname; |
342 | struct mu_locus locus; | 459 | struct mu_locus locus; |
460 | struct mu_wordsplit ws; | ||
461 | int wsflags; | ||
343 | 462 | ||
344 | rcname = mu_make_file_name (cwd, BIFF_RC); | 463 | rcname = mu_make_file_name (cwd, BIFF_RC); |
345 | free (cwd); | 464 | free (cwd); |
... | @@ -350,16 +469,15 @@ run_user_action (mu_stream_t tty, mu_message_t msg) | ... | @@ -350,16 +469,15 @@ run_user_action (mu_stream_t tty, mu_message_t msg) |
350 | } | 469 | } |
351 | else | 470 | else |
352 | locus.mu_file = rcname; | 471 | locus.mu_file = rcname; |
472 | |||
353 | locus.mu_line = 1; | 473 | locus.mu_line = 1; |
354 | locus.mu_col = 0; | 474 | locus.mu_col = 0; |
355 | while (mu_stream_getline (input, &stmt, &size, &n) == 0 && n > 0) | ||
356 | { | ||
357 | struct mu_wordsplit ws; | ||
358 | 475 | ||
359 | ws.ws_comment = "#"; | 476 | ws.ws_comment = "#"; |
360 | if (mu_wordsplit (stmt, &ws, | 477 | wsflags = MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT; |
361 | MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT) == 0 | 478 | while (mu_stream_getline (input, &stmt, &size, &n) == 0 && n > 0) |
362 | && ws.ws_wordc) | 479 | { |
480 | if (mu_wordsplit (stmt, &ws, wsflags) == 0 && ws.ws_wordc) | ||
363 | { | 481 | { |
364 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, | 482 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
365 | MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus); | 483 | MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus); |
... | @@ -428,11 +546,12 @@ run_user_action (mu_stream_t tty, mu_message_t msg) | ... | @@ -428,11 +546,12 @@ run_user_action (mu_stream_t tty, mu_message_t msg) |
428 | } | 546 | } |
429 | } | 547 | } |
430 | } | 548 | } |
431 | mu_wordsplit_free (&ws); | 549 | wsflags |= MU_WRDSF_REUSE; |
432 | /* FIXME: line number is incorrect if .biffrc contains | 550 | /* FIXME: line number is incorrect if .biffrc contains |
433 | escaped newlines */ | 551 | escaped newlines */ |
434 | locus.mu_line++; | 552 | locus.mu_line++; |
435 | } | 553 | } |
554 | mu_wordsplit_free (&ws); | ||
436 | mu_stream_destroy (&input); | 555 | mu_stream_destroy (&input); |
437 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, | 556 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
438 | MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); | 557 | MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); |
... | @@ -441,4 +560,5 @@ run_user_action (mu_stream_t tty, mu_message_t msg) | ... | @@ -441,4 +560,5 @@ run_user_action (mu_stream_t tty, mu_message_t msg) |
441 | 560 | ||
442 | if (nact == 0) | 561 | if (nact == 0) |
443 | echo_string (tty, expand_line (default_action, msg)); | 562 | echo_string (tty, expand_line (default_action, msg)); |
563 | mu_stream_destroy (&tty); | ||
444 | } | 564 | } | ... | ... |
... | @@ -365,131 +365,19 @@ comsat_connection (int fd, struct sockaddr *sa, int salen, | ... | @@ -365,131 +365,19 @@ comsat_connection (int fd, struct sockaddr *sa, int salen, |
365 | return 0; | 365 | return 0; |
366 | } | 366 | } |
367 | 367 | ||
368 | static int | ||
369 | need_crlf (mu_stream_t str) | ||
370 | { | ||
371 | #if defined(OPOST) && defined(ONLCR) | ||
372 | mu_transport_t trans[2]; | ||
373 | struct termios tbuf; | ||
374 | |||
375 | if (mu_stream_ioctl (str, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, trans)) | ||
376 | return 1; /* suppose we do need it */ | ||
377 | if (tcgetattr ((int)trans[0], &tbuf) == 0 && | ||
378 | (tbuf.c_oflag & OPOST) && (tbuf.c_oflag & ONLCR)) | ||
379 | return 0; | ||
380 | else | ||
381 | return 1; | ||
382 | #else | ||
383 | return 1; /* Just in case */ | ||
384 | #endif | ||
385 | } | ||
386 | |||
387 | static mu_stream_t | ||
388 | _open_tty (const char *device, int argc, char **argv) | ||
389 | { | ||
390 | mu_stream_t dev, base_dev, prev_stream; | ||
391 | int status; | ||
392 | |||
393 | status = mu_file_stream_create (&dev, device, MU_STREAM_WRITE); | ||
394 | if (status) | ||
395 | { | ||
396 | mu_error (_("cannot open device %s: %s"), | ||
397 | device, mu_strerror (status)); | ||
398 | return NULL; | ||
399 | } | ||
400 | mu_stream_set_buffer (dev, mu_buffer_line, 0); | ||
401 | |||
402 | prev_stream = base_dev = dev; | ||
403 | while (argc) | ||
404 | { | ||
405 | int i; | ||
406 | int mode; | ||
407 | int qmark; | ||
408 | char *fltname; | ||
409 | |||
410 | fltname = argv[0]; | ||
411 | if (fltname[0] == '?') | ||
412 | { | ||
413 | qmark = 1; | ||
414 | fltname++; | ||
415 | } | ||
416 | else | ||
417 | qmark = 0; | ||
418 | |||
419 | if (fltname[0] == '~') | ||
420 | { | ||
421 | mode = MU_FILTER_DECODE; | ||
422 | fltname++; | ||
423 | } | ||
424 | else | ||
425 | { | ||
426 | mode = MU_FILTER_ENCODE; | ||
427 | } | ||
428 | |||
429 | for (i = 1; i < argc; i++) | ||
430 | if (strcmp (argv[i], "+") == 0) | ||
431 | break; | ||
432 | |||
433 | if (qmark == 0 || need_crlf (base_dev)) | ||
434 | { | ||
435 | status = mu_filter_create_args (&dev, prev_stream, fltname, | ||
436 | i, (const char **)argv, | ||
437 | mode, MU_STREAM_WRITE); | ||
438 | mu_stream_unref (prev_stream); | ||
439 | if (status) | ||
440 | { | ||
441 | mu_error (_("cannot open filter stream: %s"), | ||
442 | mu_strerror (status)); | ||
443 | return NULL; | ||
444 | } | ||
445 | prev_stream = dev; | ||
446 | } | ||
447 | argc -= i; | ||
448 | argv += i; | ||
449 | if (argc) | ||
450 | { | ||
451 | argc--; | ||
452 | argv++; | ||
453 | } | ||
454 | } | ||
455 | return dev; | ||
456 | } | ||
457 | |||
458 | mu_stream_t | ||
459 | open_tty (const char *device, int argc, char **argv) | ||
460 | { | ||
461 | mu_stream_t dev; | ||
462 | |||
463 | if (!device || !*device || strcmp (device, "null") == 0) | ||
464 | { | ||
465 | int rc = mu_nullstream_create (&dev, MU_STREAM_WRITE); | ||
466 | if (rc) | ||
467 | mu_error (_("cannot open null stream: %s"), mu_strerror (rc)); | ||
468 | } | ||
469 | else | ||
470 | dev = _open_tty (device, argc, argv); | ||
471 | return dev; | ||
472 | } | ||
473 | |||
474 | /* NOTE: Do not bother to free allocated memory, as the program exits | 368 | /* NOTE: Do not bother to free allocated memory, as the program exits |
475 | immediately after executing this */ | 369 | immediately after executing this */ |
476 | static void | 370 | static void |
477 | notify_user (const char *user, const char *device, const char *path, | 371 | notify_user (const char *user, const char *device, const char *path, |
478 | mu_message_qid_t qid) | 372 | mu_message_qid_t qid) |
479 | { | 373 | { |
480 | mu_stream_t dev; | ||
481 | mu_mailbox_t mbox = NULL; | 374 | mu_mailbox_t mbox = NULL; |
482 | mu_message_t msg; | 375 | mu_message_t msg; |
483 | static char *default_filters[] = { "7bit", "+", "?CRLF", NULL }; | ||
484 | int status; | 376 | int status; |
485 | 377 | ||
486 | if (change_user (user)) | 378 | if (change_user (user)) |
487 | return; | 379 | return; |
488 | 380 | ||
489 | dev = open_tty (device, MU_ARRAY_SIZE (default_filters) - 1, | ||
490 | default_filters); | ||
491 | if (!dev) | ||
492 | return; | ||
493 | if (!path) | 381 | if (!path) |
494 | { | 382 | { |
495 | path = mailbox_path (user); | 383 | path = mailbox_path (user); |
... | @@ -514,8 +402,7 @@ notify_user (const char *user, const char *device, const char *path, | ... | @@ -514,8 +402,7 @@ notify_user (const char *user, const char *device, const char *path, |
514 | return; /* FIXME: Notify the user, anyway */ | 402 | return; /* FIXME: Notify the user, anyway */ |
515 | } | 403 | } |
516 | 404 | ||
517 | run_user_action (dev, msg); | 405 | run_user_action (device, msg); |
518 | mu_stream_destroy (&dev); | ||
519 | } | 406 | } |
520 | 407 | ||
521 | /* Search utmp for the local user */ | 408 | /* Search utmp for the local user */ |
... | @@ -683,7 +570,7 @@ main (int argc, char **argv) | ... | @@ -683,7 +570,7 @@ main (int argc, char **argv) |
683 | } | 570 | } |
684 | } | 571 | } |
685 | 572 | ||
686 | if (biffrc[0] == '.') | 573 | if (biffrc[0] == '.' && biffrc[1] == '/') |
687 | { | 574 | { |
688 | char *cwd = mu_getcwd (); | 575 | char *cwd = mu_getcwd (); |
689 | biffrc = mu_make_file_name (cwd, biffrc); | 576 | biffrc = mu_make_file_name (cwd, biffrc); | ... | ... |
... | @@ -79,6 +79,5 @@ extern char *hostname; | ... | @@ -79,6 +79,5 @@ extern char *hostname; |
79 | extern struct daemon_param daemon_param; | 79 | extern struct daemon_param daemon_param; |
80 | extern char *biffrc; | 80 | extern char *biffrc; |
81 | 81 | ||
82 | void run_user_action (mu_stream_t str, mu_message_t msg); | 82 | void run_user_action (const char *device, mu_message_t msg); |
83 | mu_stream_t open_tty (const char *device, int argc, char **argv); | ||
84 | 83 | ... | ... |
comsat/tests/.gitignore
0 → 100644
comsat/tests/Makefile.am
0 → 100644
1 | # This file is part of GNU Mailutils. | ||
2 | # Copyright (C) 2010 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # GNU Mailutils is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 | ||
18 | DISTCLEANFILES = atconfig $(check_SCRIPTS) | ||
19 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) | ||
20 | |||
21 | ## ------------ ## | ||
22 | ## package.m4. ## | ||
23 | ## ------------ ## | ||
24 | |||
25 | $(srcdir)/package.m4: $(top_srcdir)/configure.ac | ||
26 | $(AM_V_GEN){ \ | ||
27 | echo '# Signature of the current package.'; \ | ||
28 | echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ | ||
29 | echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ | ||
30 | echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ | ||
31 | echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ | ||
32 | echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ | ||
33 | } >$(srcdir)/package.m4 | ||
34 | |||
35 | # | ||
36 | |||
37 | ## ------------ ## | ||
38 | ## Test suite. ## | ||
39 | ## ------------ ## | ||
40 | |||
41 | TESTSUITE_AT = testsuite.at | ||
42 | |||
43 | TESTSUITE = $(srcdir)/testsuite | ||
44 | M4=m4 | ||
45 | |||
46 | AUTOTEST = $(AUTOM4TE) --language=autotest | ||
47 | $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc | ||
48 | $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp | ||
49 | $(AM_V_at)mv $@.tmp $@ | ||
50 | |||
51 | atconfig: $(top_builddir)/config.status | ||
52 | cd $(top_builddir) && ./config.status tests/$@ | ||
53 | |||
54 | clean-local: | ||
55 | @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean | ||
56 | |||
57 | check-local: atconfig atlocal $(TESTSUITE) | ||
58 | @$(SHELL) $(TESTSUITE) | ||
59 | |||
60 | # Run the test suite on the *installed* tree. | ||
61 | #installcheck-local: | ||
62 | # $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin | ||
63 | |||
64 |
comsat/tests/atlocal.in
0 → 100644
comsat/tests/testsuite.at
0 → 100644
1 | # This file is part of GNU Mailutils. -*- Autotest -*- | ||
2 | # Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # GNU Mailutils is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | m4_include([testsuite.inc]) | ||
18 | |||
19 | dnl ------------------------------------------------------------ | ||
20 | dnl mailbox for comsatd | ||
21 | m4_pushdef([BIFF_MBOX],[`pwd`/mailbox]) | ||
22 | |||
23 | dnl ------------------------------------------------------------ | ||
24 | dnl comsatcmd | ||
25 | m4_pushdef([comsatcmd],[comsatd --no-site --no-user --file ./biff.rc dnl | ||
26 | --set logging.syslog=no --test]) | ||
27 | |||
28 | dnl ------------------------------------------------------------ | ||
29 | dnl BIFFTEST(DESCR, KW, DATA, CMDLINE, [STDOUT = `'], [STDERR = `']) | ||
30 | dnl | ||
31 | m4_pushdef([BIFFTEST],[ | ||
32 | AT_SETUP([comsatd: $1]) | ||
33 | AT_KEYWORDS([comsatd $2]) | ||
34 | $3 | ||
35 | AT_CHECK([$4],[0],[$5],[$6]) | ||
36 | AT_CLEANUP]) | ||
37 | |||
38 | AT_INIT | ||
39 | |||
40 | AT_TESTED([comsatd]) | ||
41 | |||
42 | MUT_VERSION(comsatd) | ||
43 | |||
44 | BIFFTEST([default commands],[comsatd00], | ||
45 | [cwd=`pwd` | ||
46 | MUT_MBCOPY($abs_top_srcdir/testsuite/spool/teaparty.mbox, mailbox) | ||
47 | cat > biff.rc <<EOT | ||
48 | tty $cwd/output | ||
49 | EOT | ||
50 | chmod 600 biff.rc | ||
51 | > $cwd/output | ||
52 | ], | ||
53 | [comsatcmd $cwd/mailbox 0 | ||
54 | sed '1s/^Mail to .*/Mail to test user/' output | ||
55 | ], | ||
56 | [Mail to test user | ||
57 | --- | ||
58 | From: March Hare <hare@wonder.land> | ||
59 | Subject: Invitation | ||
60 | --- | ||
61 | Have some wine | ||
62 | |||
63 | |||
64 | --- | ||
65 | ]) | ||
66 | |||
67 | BIFFTEST([non-zero qid],[comsatd01], | ||
68 | [cwd=`pwd` | ||
69 | MUT_MBCOPY($abs_top_srcdir/testsuite/spool/teaparty.mbox, mailbox) | ||
70 | cat > biff.rc <<EOT | ||
71 | tty $cwd/output | ||
72 | EOT | ||
73 | chmod 600 biff.rc | ||
74 | > $cwd/output | ||
75 | ], | ||
76 | [comsatcmd $cwd/mailbox 9367 | ||
77 | sed '1s/^Mail to .*/Mail to test user/' output | ||
78 | ], | ||
79 | [Mail to test user | ||
80 | --- | ||
81 | From: Alice <alice@wonder.land> | ||
82 | Subject: Funny watch (was Re: Watch) | ||
83 | --- | ||
84 | What a funny watch! It tells the day of the | ||
85 | month, and doesn't tell what o'clock it is! | ||
86 | |||
87 | |||
88 | --- | ||
89 | ]) | ||
90 | |||
91 | BIFFTEST([maildir qid],[comsatd02], | ||
92 | [cwd=`pwd` | ||
93 | MUT_MBCOPY($abs_top_srcdir/testsuite/maildir/teaparty, mailbox) | ||
94 | cat > biff.rc <<EOT | ||
95 | tty $cwd/output | ||
96 | EOT | ||
97 | chmod 600 biff.rc | ||
98 | > $cwd/output | ||
99 | ], | ||
100 | [comsatcmd maildir:$cwd/mailbox new/1284627340.M364969P3770Q81.Trurl | ||
101 | sed '1s/^Mail to .*/Mail to test user/' output | ||
102 | ], | ||
103 | [Mail to test user | ||
104 | --- | ||
105 | From: Alice <alice@wonder.land> | ||
106 | Subject: Re: Story | ||
107 | --- | ||
108 | What did they draw? | ||
109 | |||
110 | --- | ||
111 | ]) | ||
112 | |||
113 | |||
114 | BIFFTEST([MH qid],[comsatd03], | ||
115 | [cwd=`pwd` | ||
116 | MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty, mailbox) | ||
117 | cat > biff.rc <<EOT | ||
118 | tty $cwd/output | ||
119 | EOT | ||
120 | chmod 600 biff.rc | ||
121 | > $cwd/output | ||
122 | ], | ||
123 | [comsatcmd mh:$cwd/mailbox teaparty/58 | ||
124 | sed '1s/^Mail to .*/Mail to test user/' output | ||
125 | ], | ||
126 | [Mail to test user | ||
127 | --- | ||
128 | From: March Hare <hare@wonder.land> | ||
129 | Subject: Request for a story (was Re: A guess) | ||
130 | --- | ||
131 | Suppose we change the subject, I'm getting tired of this. | ||
132 | I vote the young lady tells us a story. | ||
133 | |||
134 | --- | ||
135 | ]) | ||
136 | |||
137 | BIFFTEST([beep command],[comsatd04], | ||
138 | [cwd=`pwd` | ||
139 | MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox1, mailbox) | ||
140 | cat > biff.rc <<EOT | ||
141 | tty $cwd/output | ||
142 | beep | ||
143 | EOT | ||
144 | chmod 600 biff.rc | ||
145 | > $cwd/output | ||
146 | ], | ||
147 | [comsatcmd $cwd/mailbox 0 | ||
148 | cat output | tr '\a' A | ||
149 | ], | ||
150 | [AA]) | ||
151 | |||
152 | BIFFTEST([exec command],[comsatd05], | ||
153 | [cwd=`pwd` | ||
154 | MUT_MBCOPY($abs_top_srcdir/testsuite/spool/teaparty.mbox, mailbox) | ||
155 | AT_DATA([notifier],[#! /bin/sh | ||
156 | echo "You have mail from $1, regarding $2" | ||
157 | ]) | ||
158 | chmod +x notifier | ||
159 | cat > biff.rc <<EOT | ||
160 | tty $cwd/output | ||
161 | exec $cwd/notifier '\$H{from}' '\$H{Subject}' | ||
162 | EOT | ||
163 | chmod 600 biff.rc | ||
164 | > $cwd/output | ||
165 | ], | ||
166 | [comsatcmd $cwd/mailbox 0 | ||
167 | cat output | ||
168 | ], | ||
169 | [You have mail from March Hare <hare@wonder.land>, regarding Invitation | ||
170 | ]) | ||
171 | |||
172 | m4_popdef([BIFFTEST]) | ||
173 | m4_popdef([comsatcmd]) | ||
174 | m4_popdef([BIFF_MBOX]) |
... | @@ -1212,6 +1212,7 @@ AC_CONFIG_TESTDIR(messages/tests) | ... | @@ -1212,6 +1212,7 @@ AC_CONFIG_TESTDIR(messages/tests) |
1212 | AC_CONFIG_TESTDIR(readmsg/tests) | 1212 | AC_CONFIG_TESTDIR(readmsg/tests) |
1213 | AC_CONFIG_TESTDIR(sieve/tests) | 1213 | AC_CONFIG_TESTDIR(sieve/tests) |
1214 | AC_CONFIG_TESTDIR(mh/tests) | 1214 | AC_CONFIG_TESTDIR(mh/tests) |
1215 | AC_CONFIG_TESTDIR(comsat/tests) | ||
1215 | 1216 | ||
1216 | AC_CONFIG_FILES([libmailutils/tests/Makefile | 1217 | AC_CONFIG_FILES([libmailutils/tests/Makefile |
1217 | libmailutils/tests/atlocal | 1218 | libmailutils/tests/atlocal |
... | @@ -1219,6 +1220,8 @@ AC_CONFIG_FILES([libmailutils/tests/Makefile | ... | @@ -1219,6 +1220,8 @@ AC_CONFIG_FILES([libmailutils/tests/Makefile |
1219 | libmu_compat/tests/atlocal | 1220 | libmu_compat/tests/atlocal |
1220 | testsuite/Makefile | 1221 | testsuite/Makefile |
1221 | testsuite/atlocal | 1222 | testsuite/atlocal |
1223 | comsat/tests/Makefile | ||
1224 | comsat/tests/atlocal | ||
1222 | frm/tests/Makefile | 1225 | frm/tests/Makefile |
1223 | frm/tests/atlocal | 1226 | frm/tests/atlocal |
1224 | maidag/tests/Makefile | 1227 | maidag/tests/Makefile | ... | ... |
-
Please register or sign in to post a comment