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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
|
########### Startup Server #############
# Don't attempt these tests if the client/server are not available or
# we aren't doing 'make installcheck'
if {! [installtest_p]} { untested "Server Locale Tests"; return }
if {! [setup_server]} then {
untested "Server Locale Tests"
return
}
######################################################
################# General Tests ######################
######################################################
set valid_script {{probe begin{printf("Hello\n"); exit();}}}
set french_script {{probe begin{printf("Bonjour\n"); exit();}}}
set invalid_script {{probe begin{printf("Hello); exit();}}}
###### Embedded '\n' in Environment Variables ########
# Should not allow embedded '\n' in Environment Variables
set test "Embedded '\\n' in Env Vars"
set cmd [concat env \"LANG=en_US\\n.utf8\" stap -e $valid_script $use_server]
send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 150
-re {^Server: Localization key=value line [^\r\n]*\r\n} {
pass $test
}
-re {^[^\r\n]*\r\n} {
exp_continue
}
eof {
fail "$test (eof)"
}
timeout {
kill -INT -[exp_pid] 2
fail "$test (timeout)"
}
}
catch {close}; catch {wait}
###### Embedded ';' in Environment Variables ########
# Should not allow embedded ';' in Environment Variables
# There are many disallowed chars, but let's just try one
set test "Embedded ';' in Env Vars"
set cmd [concat env \"LANG=en_US\;.utf8\" stap -e $valid_script $use_server]
send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 150
-re "^Server: Localization value '\[^'\]*' contains illegal characters\r\n" {
pass $test
}
-re {^[^\r\n]*\r\n} {
exp_continue
}
eof {
fail "$test (eof)"
}
timeout {
kill -INT -[exp_pid] 2
fail "$test (timeout)"
}
}
catch {close}; catch {wait}
###### Use of "_.-@=" in Environment Variables ########
# Should allow "_.-@=" in Environment Variables
set test "Use of '_.-@=' in Env Vars"
set cmd [concat env LANG=en_US.utf-8@toronto=test stap -e $valid_script $use_server]
send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 150
-re "^Hello\r\n" {
pass $test
}
-re {^[^\r\n]*\r\n} {
exp_continue
}
eof {
fail "$test (eof)"
}
timeout {
kill -INT -[exp_pid] 2
fail "$test (timeout)"
}
}
catch {close}; catch {wait}
######################################################
################### LANG TESTS #######################
######################################################
########### LANG French Sniff Test ###########
#
# Note that on newer versions of Fedora, setting LANG to French isn't
# enough, you also need the French langpack installed. To do so,
# you'll need to do (as root):
#
# dnf install langpacks-fr
#
# In theory, we could test the system to see if has the French
# langpacks installed, but in practice the command to do that varies
# between distros.
#
# So, let's test and see if the French locale seems to work. Run stap
# locally and see if we get French output. If we don't get French
# output when run locally, we won't get it from the server on this
# system either.
set test "French LANG Sniff Test"
set french_supported -1
set cmd [concat env LANG=fr_FR.utf8 stap -V]
send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 150
-re {^options activées :[^\r\n][^\r\n]*\r\n} {
set french_supported 1
pass $test
}
-re {^enabled features:[^\r\n][^\r\n]*\r\n} {
set french_supported 0
xfail $test
}
-re {^[^\r\n]*\r\n} {
exp_continue
}
eof {
fail "$test (eof)"
}
timeout {
kill -INT -[exp_pid] 2
fail "$test (timeout)"
}
}
catch {close}; catch {wait}
if {$french_supported == -1} {
fail "$test - no expected output seen"
}
########### LANG Proper Syntax Test (French) ##############
# Run a basic execution test in French. Should return only "Bonjour".
set test "LANG Proper Syntax Test (French)"
set cmd [concat env LANG=fr_FR.utf8 stap -e $french_script $use_server]
send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 150
-re "^Bonjour\r\n" {
pass $test
}
-re {^[^\r\n]*\r\n} {
exp_continue
}
eof {
fail "$test (eof)"
}
timeout {
kill -INT -[exp_pid] 2
fail "$test (timeout)"
}
}
catch {close}; catch {wait}
########### LANG Proper Syntax Test (English) #############
# Run a basic execution test in English. Should return only "Hello".
set test "LANG Proper Syntax Test (English)"
set cmd [concat env LANG=en_US.utf8 stap -e $valid_script $use_server]
send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 150
-re "^Hello\r\n" {
pass $test
}
-re {^[^\r\n]*\r\n} {
exp_continue
}
eof {
fail "$test (eof)"
}
timeout {
kill -INT -[exp_pid] 2
fail "$test (timeout)"
}
}
catch {close}; catch {wait}
########### LANG Bad Syntax Test (French) #############
# Run an execution test with a syntax error, in French.
#
# Note that we can't test for exact output here, since we may not have
# up to date French translations. So, if we get anything in French, we
# pass.
set test "LANG Bad Syntax Test (French)"
if {$french_supported != 1} {
setup_xfail *-*-*
}
set cmd [concat env LANG=fr_FR.utf8 stap -e $invalid_script $use_server]
send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 150
-re {Ne peut trouver la guillemet} {
pass $test
}
-re {^[^\r\n]*\r\n} {
exp_continue
}
eof {
fail "$test (eof)"
}
timeout {
kill -INT -[exp_pid] 2
fail "$test (timeout)"
}
}
catch {close}; catch {wait}
########### LANG Bad Syntax Test (English) #############
# Run an execution test with a syntax error, in English.
set test "LANG Bad Syntax Test (English)"
set cmd [concat env LANG=en_US.utf8 stap -e $invalid_script $use_server]
send_log "executing: $cmd\n"
eval spawn $cmd
expect {
-timeout 150
-re {^parse error: Could not find matching closing quote\r\n} {
pass $test
}
-re {^1 parse error\.\r\n} {
pass $test
}
-re {^[^\r\n]*\r\n} {
exp_continue
}
eof {
fail "$test (eof)"
}
timeout {
kill -INT -[exp_pid] 2
fail "$test (timeout)"
}
}
catch {close}; catch {wait}
######################################################
################ LC_CTYPE Tests ######################
######################################################
# NOT YET TESTED - NO APPARENT EFFECT
######################################################
############### LC_COLLATE Tests #####################
######################################################
# NOT YET TESTED - NO APPARENT EFFECT
######################################################
############## LC_MESSAGES Tests #####################
######################################################
# NOT YET TESTED - NO APPARENT EFFECT
######################################################
################# LC_TIME Tests ######################
######################################################
# NOT YET TESTED - NO APPARENT EFFECT
######################################################
############### LC_MONETARY Tests ####################
######################################################
# NOT YET TESTED - NO APPARENT EFFECT
######################################################
################ LC_NUMERIC Tests ####################
######################################################
# NOT YET TESTED - NO APPARENT EFFECT
########### Shutdown Server #############
# Shudown the server.
shutdown_server
|