Commit 3f88df00 3f88df004fd948bba5856993bd1a92981b53ea49 by Sergey Poznyakoff

Fix testsuite to avoid spawning /bin/cp.

* imap4d/testsuite/imap4d.rcin: New file.
* imap4d/testsuite/Makefile.am (EXTRA_DIST): Add imap4d.rcin
* imap4d/testsuite/.cvsignore: Add imap4d.rc
* imap4d/testsuite/lib/imap4d.exp: Use mu_makespool to prepare
mailspools and mu_create_config to create test configuration
file.  Specify the maximum amount of configuration data in the
latter, instead of using command line options.
* mail.local/testsuite/lib/mail.local.exp: Likewise.
* pop3d/testsuite/lib/pop3d.exp: Likewise.

* pop3d/testsuite/pop3d.rcin: New file.
* pop3d/testsuite/Makefile.am (EXTRA_DIST): Add pop3d.rcin
* pop3d/testsuite/.cvsignore: Add pop3d.rc.

* testsuite/etc/passwd.in: Use Tcl variable for expansion.
* testsuite/lib/mailutils.exp (mu_copy_file): New function.
(mu_makespool, mu_create_config): New function.
(mu_init): Remove unused variable MU_MAKESPOOL.
(mu_prepare_spools): Use mu_makespool.
(mu_cleanup_spools): Remove.

* libcfg/init.c (mu_parse_config_files): Minor change.
* mailbox/cfg_lexer.l (mu_get_config): Fix return value.
1 parent 734eac29
2008-08-24 Sergey Poznyakoff <gray@gnu.org.ua>
Fix testsuite to avoid spawning /bin/cp.
* imap4d/testsuite/imap4d.rcin: New file.
* imap4d/testsuite/Makefile.am (EXTRA_DIST): Add imap4d.rcin
* imap4d/testsuite/.cvsignore: Add imap4d.rc
* imap4d/testsuite/lib/imap4d.exp: Use mu_makespool to prepare
mailspools and mu_create_config to create test configuration
file. Specify the maximum amount of configuration data in the
latter, instead of using command line options.
* mail.local/testsuite/lib/mail.local.exp: Likewise.
* pop3d/testsuite/lib/pop3d.exp: Likewise.
* pop3d/testsuite/pop3d.rcin: New file.
* pop3d/testsuite/Makefile.am (EXTRA_DIST): Add pop3d.rcin
* pop3d/testsuite/.cvsignore: Add pop3d.rc.
* testsuite/etc/passwd.in: Use Tcl variable for expansion.
* testsuite/lib/mailutils.exp (mu_copy_file): New function.
(mu_makespool, mu_create_config): New function.
(mu_init): Remove unused variable MU_MAKESPOOL.
(mu_prepare_spools): Use mu_makespool.
(mu_cleanup_spools): Remove.
* libcfg/init.c (mu_parse_config_files): Minor change.
* mailbox/cfg_lexer.l (mu_get_config): Fix return value.
2008-08-21 Sergey Poznyakoff <gray@gnu.org.ua>
* include/mailutils/mutil.h, mailbox/mutil.c (mu_normalize_path):
......
......@@ -2,6 +2,7 @@ Makefile
Makefile.in
*.log
*.sum
imap4d.rc
site.exp
remote.exp
data
......
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2002, 2007 Free Software Foundation, Inc.
## Copyright (C) 2002, 2007, 2008 Free Software Foundation, Inc.
##
## GNU Mailutils is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
......@@ -20,7 +20,8 @@
AUTOMAKE_OPTIONS = dejagnu
DEJATOOL = imap4d
RUNTESTFLAGS =
CLEANFILES = *.log
CLEANFILES = *.log imap4d.rc
EXTRA_DIST = imap4d.rcin
test_dirs = lib imap4d config
dist-hook:
......
# Configuration file for Mailutils Imap4d testsuite.
# Copyright (C) 2008 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
mailbox {
mail-spool "$objdir/data/spool";
mailbox-pattern "$objdir/data/spool/INBOX";
}
auth {
authentication generic;
authorization virtdomain;
}
virtdomain {
passwd-dir "$objdir/data/etc";
}
shared-namespace "$objdir/data";
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2005, 2007 Free Software Foundation
# Copyright (C) 2002, 2005, 2007, 2008 Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -19,7 +19,7 @@
source $top_srcdir/testsuite/lib/mailutils.exp
mu_init "--authentication generic --authorization virtdomain"
mu_init "--rcfile=$objdir/imap4d.rc"
mu_version
if ![mu_check_capability ENABLE_VIRTUAL_DOMAINS] {
clone_output "WARNING: Support for virtual domains not compiled in"
......@@ -29,15 +29,8 @@ if ![mu_check_capability ENABLE_VIRTUAL_DOMAINS] {
set IMAP4D_ETC_DIR "$MU_DATA_DIR/etc"
set output [remote_exec host "$MU_MAKESPOOL \
-subst \"s,@MU_SPOOL_DIR@,$MU_SPOOL_DIR,\" \
$MU_RC_DIR $IMAP4D_ETC_DIR" ]
if [lindex $output 0] {
perror "Cannot create $IMAP4D_ETC_DIR: [lindex $output 1]"
exit 1
}
append MU_TOOL_FLAGS " --virtual-passwd-dir $IMAP4D_ETC_DIR \
--shared-namespace $MU_DATA_DIR"
mu_makespool "$MU_RC_DIR" "$IMAP4D_ETC_DIR"
mu_create_config imap4d
set IMAP4D_TAG 0
......@@ -76,12 +69,6 @@ proc default_imap4d_start {args} {
append sw $args
}
if [info exists host_board] {
if [board_info $host_board exists top_srcdir] {
append sw " --mail-spool [board_info $host_board top_srcdir]/mail/testsuite/spool"
}
}
set imap4d_cmd "$MU_TOOL $sw"
verbose "Spawning $imap4d_cmd"
......@@ -92,7 +79,7 @@ proc default_imap4d_start {args} {
}
mu_expect 360 {
-re "\\* OK IMAP4rev1 Debugging mode.*\r\n" {
-re "\\* (OK)|(PREAUTH) IMAP4rev1 Debugging mode.*\r\n" {
verbose "imap4d initialized."
}
default {
......@@ -111,6 +98,7 @@ proc default_imap4d_stop {} {
perror "LOGOUT failed"
exit 1
}
remote_close host;
return 0
}
......@@ -131,12 +119,7 @@ proc imap4d_start {args} {
if {$reuse_spool == 0} {
mu_prepare_spools
set output [remote_exec host \
"cp $MU_SPOOL_DIR/teaparty.mbox $MU_SPOOL_DIR/INBOX"]
if [lindex $output 0] {
perror "Cannot create $MU_SPOOL_DIR/INBOX: [lindex $output 1]"
exit 1
}
mu_copy_file $MU_SPOOL_DIR/teaparty.mbox $MU_SPOOL_DIR/INBOX
}
return [default_imap4d_start [concat [lrange $args $i end]]]
}
......
......@@ -132,7 +132,7 @@ mu_parse_config_files (struct mu_cfg_param *param, void *target)
flags, target);
if (rc)
{
mu_error (_("Cannot open file %s: %s"), mu_load_rcfile,
mu_error (_("Errors parsing file %s: %s"), mu_load_rcfile,
mu_strerror (rc));
return rc;
}
......
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007 Free Software Foundation
# Copyright (C) 2002, 2007, 2008 Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -31,13 +31,7 @@ mu_prepare_spools
set ETC_DIR "$MU_DATA_DIR/etc"
set output [remote_exec host "$MU_MAKESPOOL \
-subst \"s,@MU_SPOOL_DIR@,$MU_SPOOL_DIR,\" \
$MU_RC_DIR $ETC_DIR" ]
if [lindex $output 0] {
perror "Cannot create ETC_DIR: [lindex $output 1]"
exit 1
}
mu_makespool "$MU_RC_DIR" "$ETC_DIR"
append MU_TOOL_FLAGS " --virtual-passwd-dir $ETC_DIR"
set mu_filename "$MU_SPOOL_DIR/INBOX"
......
......@@ -304,14 +304,14 @@ mu_get_config (const char *file, const char *progname,
{
if (errno != ENOENT)
mu_error (_("cannot stat `%s': %s"), file, mu_strerror (errno));
return -1;
return ENOENT;
}
fp = fopen (file, "r");
if (!fp)
{
mu_error (_("cannot open config file `%s': %s"), file,
mu_strerror (errno));
return -1;
return errno;
}
if (flags & MU_PARSE_CONFIG_VERBOSE)
......@@ -334,7 +334,7 @@ mu_get_config (const char *file, const char *progname,
if (flags & MU_PARSE_CONFIG_VERBOSE)
mu_error (_("Info: finished parsing file `%s'"), file);
return rc;
return rc == 0 ? 0 : MU_ERR_FAILURE;
}
mu_opool_t
......
......@@ -2,6 +2,7 @@ Makefile
Makefile.in
*.log
*.sum
pop3d.rc
site.exp
remote.exp
data
......
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2002, 2007 Free Software Foundation, Inc.
## Copyright (C) 2002, 2007, 2008 Free Software Foundation, Inc.
##
## GNU Mailutils is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
......@@ -20,7 +20,8 @@
AUTOMAKE_OPTIONS = dejagnu
DEJATOOL = pop3d
RUNTESTFLAGS =
CLEANFILES = *.log
CLEANFILES = *.log pop3d.rc
EXTRA_DIST = pop3d.rcin
test_dirs = config lib pop3d
dist-hook:
......
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007 Free Software Foundation
# Copyright (C) 2002, 2007, 2008 Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -20,7 +20,7 @@
source $top_srcdir/testsuite/lib/mailutils.exp
mu_init "--authentication generic --authorization virtdomain"
mu_init "--rcfile=$objdir/pop3d.rc"
mu_version
if ![mu_check_capability ENABLE_VIRTUAL_DOMAINS] {
clone_output "WARNING: Support for virtual domains not compiled in"
......@@ -29,15 +29,8 @@ if ![mu_check_capability ENABLE_VIRTUAL_DOMAINS] {
}
set POP3D_ETC_DIR "$MU_DATA_DIR/etc"
set output [remote_exec host "$MU_MAKESPOOL \
-subst \"s,@MU_SPOOL_DIR@,$MU_SPOOL_DIR,\" \
$MU_RC_DIR $POP3D_ETC_DIR" ]
if [lindex $output 0] {
perror "Cannot create $POP3D_ETC_DIR: [lindex $output 1]"
exit 1
}
append MU_TOOL_FLAGS " --virtual-passwd-dir $POP3D_ETC_DIR"
mu_makespool "$MU_RC_DIR" "$POP3D_ETC_DIR"
mu_create_config pop3d
### Only procedures should come after this point.
......@@ -74,12 +67,6 @@ proc default_pop3d_start {args} {
append sw $args
}
if [info exists host_board] {
if [board_info $host_board exists top_srcdir] {
append sw " --mail-spool [board_info $host_board top_srcdir]/mail/testsuite/spool"
}
}
set pop3d_cmd "$MU_TOOL $sw"
verbose "Spawning $pop3d_cmd"
......@@ -131,12 +118,7 @@ proc pop3d_start {args} {
if {$reuse_spool == 0} {
mu_prepare_spools
set output [remote_exec host \
"cp $MU_SPOOL_DIR/teaparty.mbox $MU_SPOOL_DIR/INBOX"]
if [lindex $output 0] {
perror "Cannot create $MU_SPOOL_DIR/INBOX: [lindex $output 1]"
exit 1
}
mu_copy_file $MU_SPOOL_DIR/teaparty.mbox $MU_SPOOL_DIR/INBOX
}
return [default_pop3d_start [concat [lrange $args $i end]]]
}
......
# Configuration file for Mailutils Imap4d testsuite.
# Copyright (C) 2008 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
mailbox {
mail-spool "$objdir/data/spool";
mailbox-pattern "$objdir/data/spool/INBOX";
}
auth {
authentication generic;
authorization virtdomain;
}
virtdomain {
passwd-dir "$objdir/data/etc";
}
user:abld/G2Q2Le2w:1000:1000:Test User:@MU_SPOOL_DIR@:/bin/sh
user:abld/G2Q2Le2w:1000:1000:Test User:$MU_SPOOL_DIR:/bin/sh
......
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2005, 2007 Free Software Foundation
# Copyright (C) 2002, 2005, 2007, 2008 Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -23,6 +23,80 @@ verbose "STARTED" 1
set env(LC_ALL) "C"
set env(MU_CONFIG_FLAVOR) "none"
proc mu_copy_file {src dst} {
global tool
global top_srcdir
global srcdir
global objdir
global host_alias
global host_triplet
global target_alias
global target_triplet
global build_alias
global build_triplet
global MU_TOOL
global MU_SPOOL_SOURCE
global MU_FOLDER_SOURCE
global MU_SPOOL_DIR
global MU_FOLDER_DIR
global MU_RC_DIR
global MU_DATA_DIR
set input [open $src r]
set output [open $dst w]
for {gets $input line} {![eof $input]} {gets $input line} {
puts $output [subst -nobackslashes $line]
}
close $input
close $output
}
proc mu_makespool args {
for {set i 0} {$i < [llength $args]} {incr i} {
set src [lindex $args $i]
if {![file isdirectory $src]} {
perror "$src is not a directory"
exit 1
}
incr i
set dst [lindex $args $i]
verbose "MU_MAKESPOOL $src => $dst"
if [file exists $dst] {
if {![file isdirectory $dst]} {
perror "$dst exists but is not a directory"
exit 1
}
file delete -force "$dst"
}
file mkdir "$dst"
file attributes "$dst" -permissions "u=rwx"
set input [open $src/DISTFILES r]
for {gets $input line} {![eof $input]} {gets $input line} {
switch -regexp -- "$line" {
"^#.*" { }
"^\$" { }
".*\\.in" {
regexp "(.*)\\.in" $line dummy name
verbose "copying $src/$line => $dst/$name #(with edits)"
mu_copy_file "$src/$line" "$dst/$name"
}
default {
verbose "copying $src/$line => $dst/$line"
file copy -force -- "$src/$line" "$dst/$line"
file attributes "$dst/$line" -permissions "u=rw"
}
}
}
close $input
}
}
proc mu_create_config {name} {
global objdir
mu_copy_file $objdir/$name.rcin $objdir/$name.rc
}
proc mu_init {args} {
global TOOL_EXECUTABLE
global MU_TOOL
......@@ -31,7 +105,6 @@ proc mu_init {args} {
global MU_SPOOL_DIR
global MU_FOLDER_DIR
global MU_RC_DIR
global MU_MAKESPOOL
global tool
global MU_TOOL_FLAGS
global MU_DATA_DIR
......@@ -51,7 +124,6 @@ proc mu_init {args} {
set MU_FOLDER_SOURCE "$top_srcdir/testsuite/folder"
set MU_DATA_DIR "$objdir/data"
set MU_RC_DIR "$top_srcdir/testsuite/etc"
set MU_MAKESPOOL "$top_srcdir/testsuite/makespool"
} else {
if [info exists host_board] {
if [board_info $host_board exists top_builddir] {
......@@ -71,7 +143,6 @@ proc mu_init {args} {
set MU_SPOOL_SOURCE "[board_info $host_board top_srcdir]/spool"
set MU_FOLDER_SOURCE "[board_info $host_board top_srcdir]/folder"
set MU_DATA_DIR "[board_info $host_board objdir]/data"
set MU_MAKESPOOL "[board_info $host_board top_srcdir]/testsuite/makespool"
}
set MU_SPOOL_DIR "$MU_DATA_DIR/spool"
......@@ -283,24 +354,9 @@ proc mu_prepare_spools {} {
global MU_SPOOL_DIR
global MU_FOLDER_SOURCE
global MU_FOLDER_DIR
global MU_MAKESPOOL
set output [remote_exec host "$MU_MAKESPOOL \
$MU_SPOOL_SOURCE $MU_SPOOL_DIR\
$MU_FOLDER_SOURCE $MU_FOLDER_DIR"]
}
proc mu_cleanup_spools {} {
global MU_SPOOL_SOURCE
global MU_SPOOL_DIR
global MU_FOLDER_SOURCE
global MU_FOLDER_DIR
global MU_MAKESPOOL
if { $MU_SPOOL_SOURCE != $MU_SPOOL_DIR } {
set output [remote_exec host "$MU_MAKESPOOL -r \
$MU_SPOOL_DIR $MU_FOLDER_DIR"]
}
mu_makespool $MU_SPOOL_SOURCE $MU_SPOOL_DIR\
$MU_FOLDER_SOURCE $MU_FOLDER_DIR
}
proc mu_version {} {
......