1# The ONCE command and autocleaning feature
2
3# $Id: once.t,v 3.0 1993/11/29 13:49:37 ram Exp ram $
4#
5#  Copyright (c) 1990-2006, Raphael Manfredi
6#
7#  You may redistribute only under the terms of the Artistic License,
8#  as specified in the README file that comes with the distribution.
9#  You may reuse parts of this distribution only within the terms of
10#  that same Artistic License; a copy of which may be found at the root
11#  of the source tree for mailagent 3.0.
12#
13# $Log: once.t,v $
14# Revision 3.0  1993/11/29  13:49:37  ram
15# Baseline for mailagent 3.0 netwide release.
16#
17
18do '../pl/cmd.pl';
19unlink 'one', 'two', 'three', 'four', "$user";
20
21&add_header('X-Tag: once');
22`rm -rf dbr` if -d 'dbr';
23`$cmd`;
24$? == 0 || print "1\n";
25-f "$user" && print "2\n";
26-f 'one' || print "3\n";
27-f 'two' && print "4\n";
28-f 'three' || print "5\n";
29-f 'four' || print "6\n";
30-d 'dbr' || print "7\n";
31@files = <dbr/*/*>;
32@files == 3 || print "8\n";
33
34# Make sure ONCE dbr database not disturbed by autocleaning, and, along
35# the way, check that auto cleaning is correctly run.
36
37$level = $ENV{'LEVEL'};
38`$mailagent -L $level -q -o 'autoclean: ON' 2>/dev/null`;
39$? == 0 || print "9\n";
40@new_files = <dbr/*/*>;
41@new_files == @files || print "10\n";
42unlink 'one', 'two', 'three', 'four', "$user";
43-f 'context' || print "11\n";
44
45`$cmd`;
46$? == 0 || print "12\n";
47-f "$user" && print "13\n";
48-f 'one' && print "14\n";
49-f 'two' && print "15\n";
50-f 'three' && print "16\n";
51-f 'four' || print "17\n";
52-d 'dbr' || print "18\n";
53
54# Make sure autocleaning leaves things in a coherent state
55
56`$mailagent -q -L $level -o 'autoclean: ON' -o 'agemax: 0m' 2>/dev/null`;
57-d 'dbr' && print "19\n";
58-f 'context' || print "20\n";
59
60`$mailagent -q -L $level 2>/dev/null`;
61-f 'context' && print "21\n";
62
63unlink 'one', 'two', 'three', 'four', "$user", 'mail';
64print "0\n";
65