50.exp 3.09 KB
Newer Older
Per Cederqvist's avatar
Per Cederqvist committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Test suite for lyskomd.
# Copyright (C) 2003  Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
# 
# LysKOM 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 1, or (at your option) 
# any later version.
# 
# LysKOM 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 LysKOM; see the file COPYING.  If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
# MA 02139, USA.
#
# Please report bugs at http://bugzilla.lysator.liu.se/. 

# Test checkkomspace.

# Start lyskomd.
lyskomd_start

set cspid [spawn ../checkkomspace -d config/lyskomd-config]

set test "backup missing"
expect {
    -re "checkkomspace: stat: $any*/db/lyskomd-backup: No such file or directory$nl" {
	pass "$test"
    }
    timeout {
	fail "$test (timeout)"
    }
    eof {
	fail "$test (eof)"
    }
}
set test "first line"
expect {
    -re "If this is a new installation this error will go away after$nl" {
	pass "$test"
    }
    timeout {
	fail "$test (timeout)"
    }
    eof {
	fail "$test (eof)"
    }
}
set test "second line"
expect {
    -re "roughly 1440 minutes\\.$nl" {
	pass "$test"
    }
    timeout {
	fail "$test (timeout)"
    }
    eof {
	fail "$test (eof)"
    }
}

set test "checkkomspace died"
expect {
    eof { pass "$test"; wait }
}
unset test

# Save the database to get rid of the above error.

client_start 0
send "A[holl "foo"]\n"
simple_expect "LysKOM" "connected"
send "1000 80 0 { }\n"
simple_expect "=1000"
send "1001 0 5 [holl "gazonk"]\n"
simple_expect "=1001"
send "1002 42 255\n"
simple_expect "=1002"
send "1003 43\n"
simple_expect "=1003"
send "1004 43\n"
simple_expect "=1004"

# Rerun checkkomspace.

set cspid [spawn ../checkkomspace -d config/lyskomd-config]

set test "diskspace report"
expect {
    -re "Diskspace OK: $any_float MB \\($any_float%\\) and $any_num inodes \\($any_float%\\) free$nl" {
	pass "$test (diskspace OK)$nl"
    }
    -re "Diskspace error: $any_float MB \\($any_float%\\) and $any_num inodes \\($any_float%\\) free$nl" {
	pass "$test (diskspace error reported)"
    }
    -re "Diskspace warning: $any_float MB \\($any_float%\\) and $any_num inodes \\($any_float%\\) free$nl" {
	pass "$test (diskspace warning reported)"
    }
    timeout {
	fail "$test (timeout)"
    }
    eof {
	fail "$test (eof)"
    }
}

set test "checkkomspace sent final line"
expect {
    -re "^Press enter to terminate checkkomspace$nl" {
	pass "$test"
    }
    -re "^($any*)$nl" {
	fail "$test (unexpected line: $expect_out(1,string))"
	exp_continue
    }
}
send "\n"
set test "checkkomspace died"
expect {
    eof { pass "$test"; wait }
}
unset test

talk_to client 0
send "1005 44 0\n"
simple_expect "=1005"
client_death 0
lyskomd_death