t_ssp.sh (272458) | t_ssp.sh (274066) |
---|---|
1# $NetBSD: t_ssp.sh,v 1.7 2014/04/06 19:28:59 christos Exp $ 2# 3# Copyright (c) 2008 The NetBSD Foundation, Inc. 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 20 unchanged lines hidden (view full) --- 29{ 30 echo "Executing command [ $2$1 ]" 31 eval $2 atf_check -s exit:0 -o ignore -e ignore $1 32} 33 34h_fail() 35{ 36 echo "Executing command [ $2$1 ]" | 1# $NetBSD: t_ssp.sh,v 1.7 2014/04/06 19:28:59 christos Exp $ 2# 3# Copyright (c) 2008 The NetBSD Foundation, Inc. 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 20 unchanged lines hidden (view full) --- 29{ 30 echo "Executing command [ $2$1 ]" 31 eval $2 atf_check -s exit:0 -o ignore -e ignore $1 32} 33 34h_fail() 35{ 36 echo "Executing command [ $2$1 ]" |
37 # Begin FreeBSD 38 if true; then 39 eval $2 atf_check -s signal -o ignore -e ignore $1 40 else 41 # End FreeBSD |
|
37 eval $2 atf_check -s signal:6 -o ignore -e ignore $1 | 42 eval $2 atf_check -s signal:6 -o ignore -e ignore $1 |
43 # Begin FreeBSD 44 fi 45 # End FreeBSD |
|
38} 39 40atf_test_case sprintf 41sprintf_head() 42{ 43 atf_set "descr" "Checks sprintf(3)" 44} 45sprintf_body() 46{ 47 prog="$(atf_get_srcdir)/h_sprintf" 48 49 h_pass "$prog ok" | 46} 47 48atf_test_case sprintf 49sprintf_head() 50{ 51 atf_set "descr" "Checks sprintf(3)" 52} 53sprintf_body() 54{ 55 prog="$(atf_get_srcdir)/h_sprintf" 56 57 h_pass "$prog ok" |
58 # Begin FreeBSD 59 if true; then 60 h_fail "$prog 0123456789ab" 61 else 62 # End FreeBSD |
|
50 h_fail "$prog 0123456789" | 63 h_fail "$prog 0123456789" |
64 # Begin FreeBSD 65 fi 66 # End FreeBSD |
|
51} 52 53atf_test_case vsprintf 54vsprintf_head() 55{ 56 atf_set "descr" "Checks vsprintf(3)" 57} 58vsprintf_body() 59{ 60 prog="$(atf_get_srcdir)/h_vsprintf" 61 62 h_pass "$prog ok" | 67} 68 69atf_test_case vsprintf 70vsprintf_head() 71{ 72 atf_set "descr" "Checks vsprintf(3)" 73} 74vsprintf_body() 75{ 76 prog="$(atf_get_srcdir)/h_vsprintf" 77 78 h_pass "$prog ok" |
79 # Begin FreeBSD 80 if true; then 81 h_fail "$prog 0123456789ab" 82 else 83 # End FreeBSD |
|
63 h_fail "$prog 0123456789" | 84 h_fail "$prog 0123456789" |
85 # Begin FreeBSD 86 fi 87 # End FreeBSD |
|
64} 65 66atf_test_case snprintf 67snprintf_head() 68{ 69 atf_set "descr" "Checks snprintf(3)" 70} 71snprintf_body() 72{ 73 prog="$(atf_get_srcdir)/h_snprintf" 74 75 h_pass "$prog 10" | 88} 89 90atf_test_case snprintf 91snprintf_head() 92{ 93 atf_set "descr" "Checks snprintf(3)" 94} 95snprintf_body() 96{ 97 prog="$(atf_get_srcdir)/h_snprintf" 98 99 h_pass "$prog 10" |
100 # Begin FreeBSD 101 if true; then 102 h_fail "$prog 13" 103 else 104 # End FreeBSD |
|
76 h_fail "$prog 11" | 105 h_fail "$prog 11" |
106 # Begin FreeBSD 107 fi 108 # End FreeBSD |
|
77} 78 79atf_test_case vsnprintf 80vsnprintf_head() 81{ 82 atf_set "descr" "Checks vsnprintf(3)" 83} 84vsnprintf_body() 85{ 86 prog="$(atf_get_srcdir)/h_vsnprintf" 87 88 h_pass "$prog 10" | 109} 110 111atf_test_case vsnprintf 112vsnprintf_head() 113{ 114 atf_set "descr" "Checks vsnprintf(3)" 115} 116vsnprintf_body() 117{ 118 prog="$(atf_get_srcdir)/h_vsnprintf" 119 120 h_pass "$prog 10" |
121 # Begin FreeBSD 122 if true; then 123 h_fail "$prog 13" 124 else 125 # End FreeBSD |
|
89 h_fail "$prog 11" | 126 h_fail "$prog 11" |
127 # Begin FreeBSD 128 fi 129 # End FreeBSD |
|
90} 91 92atf_test_case gets 93gets_head() 94{ 95 atf_set "descr" "Checks gets(3)" 96} 97gets_body() 98{ 99 prog="$(atf_get_srcdir)/h_gets" 100 101 h_pass "$prog" "echo ok |" | 130} 131 132atf_test_case gets 133gets_head() 134{ 135 atf_set "descr" "Checks gets(3)" 136} 137gets_body() 138{ 139 prog="$(atf_get_srcdir)/h_gets" 140 141 h_pass "$prog" "echo ok |" |
142 # Begin FreeBSD 143 if true; then 144 h_fail "$prog" "echo 0123456789ab |" 145 else 146 # End FreeBSD |
|
102 h_fail "$prog" "echo 0123456789 |" | 147 h_fail "$prog" "echo 0123456789 |" |
148 # Begin FreeBSD 149 fi 150 # End FreeBSD |
|
103} 104 105atf_test_case fgets 106fgets_head() 107{ 108 atf_set "descr" "Checks fgets(3)" 109} 110fgets_body() 111{ 112 prog="$(atf_get_srcdir)/h_fgets" 113 114 h_pass "$prog 10" "echo ok |" | 151} 152 153atf_test_case fgets 154fgets_head() 155{ 156 atf_set "descr" "Checks fgets(3)" 157} 158fgets_body() 159{ 160 prog="$(atf_get_srcdir)/h_fgets" 161 162 h_pass "$prog 10" "echo ok |" |
163 # Begin FreeBSD 164 if true; then 165 h_fail "$prog 13" "echo 0123456789abc |" 166 else 167 # End FreeBSD |
|
115 h_fail "$prog 11" "echo busted |" | 168 h_fail "$prog 11" "echo busted |" |
169 # Begin FreeBSD 170 fi 171 # End FreeBSD |
|
116} 117 118atf_test_case memcpy 119memcpy_head() 120{ 121 atf_set "descr" "Checks memcpy(3)" 122} 123memcpy_body() 124{ 125 prog="$(atf_get_srcdir)/h_memcpy" 126 127 h_pass "$prog 10" | 172} 173 174atf_test_case memcpy 175memcpy_head() 176{ 177 atf_set "descr" "Checks memcpy(3)" 178} 179memcpy_body() 180{ 181 prog="$(atf_get_srcdir)/h_memcpy" 182 183 h_pass "$prog 10" |
184 # Begin FreeBSD 185 if true; then 186 h_fail "$prog 13" 187 else 188 # End FreeBSD |
|
128 h_fail "$prog 11" | 189 h_fail "$prog 11" |
190 # Begin FreeBSD 191 fi 192 # End FreeBSD |
|
129} 130 131atf_test_case memmove 132memmove_head() 133{ 134 atf_set "descr" "Checks memmove(3)" 135} 136memmove_body() 137{ 138 prog="$(atf_get_srcdir)/h_memmove" 139 140 h_pass "$prog 10" | 193} 194 195atf_test_case memmove 196memmove_head() 197{ 198 atf_set "descr" "Checks memmove(3)" 199} 200memmove_body() 201{ 202 prog="$(atf_get_srcdir)/h_memmove" 203 204 h_pass "$prog 10" |
205 # Begin FreeBSD 206 if true; then 207 h_fail "$prog 13" 208 else 209 # End FreeBSD |
|
141 h_fail "$prog 11" | 210 h_fail "$prog 11" |
211 # Begin FreeBSD 212 fi 213 # End FreeBSD |
|
142} 143 144atf_test_case memset 145memset_head() 146{ 147 atf_set "descr" "Checks memset(3)" 148} 149memset_body() 150{ 151 prog="$(atf_get_srcdir)/h_memset" 152 153 h_pass "$prog 10" | 214} 215 216atf_test_case memset 217memset_head() 218{ 219 atf_set "descr" "Checks memset(3)" 220} 221memset_body() 222{ 223 prog="$(atf_get_srcdir)/h_memset" 224 225 h_pass "$prog 10" |
226 # Begin FreeBSD 227 if true; then 228 h_fail "$prog 13" 229 else 230 # End FreeBSD |
|
154 h_fail "$prog 11" | 231 h_fail "$prog 11" |
232 # Begin FreeBSD 233 fi 234 # End FreeBSD |
|
155} 156 157atf_test_case strcpy 158strcpy_head() 159{ 160 atf_set "descr" "Checks strcpy(3)" 161} 162strcpy_body() 163{ 164 prog="$(atf_get_srcdir)/h_strcpy" 165 166 h_pass "$prog 0123456" | 235} 236 237atf_test_case strcpy 238strcpy_head() 239{ 240 atf_set "descr" "Checks strcpy(3)" 241} 242strcpy_body() 243{ 244 prog="$(atf_get_srcdir)/h_strcpy" 245 246 h_pass "$prog 0123456" |
247 # Begin FreeBSD 248 if true; then 249 h_fail "$prog 0123456789ab" 250 else 251 # End FreeBSD |
|
167 h_fail "$prog 0123456789" | 252 h_fail "$prog 0123456789" |
253 # Begin FreeBSD 254 fi 255 # End FreeBSD |
|
168} 169 170atf_test_case stpcpy 171stpcpy_head() 172{ 173 atf_set "descr" "Checks stpcpy(3)" 174} 175stpcpy_body() 176{ 177 prog="$(atf_get_srcdir)/h_stpcpy" 178 179 h_pass "$prog 0123456" | 256} 257 258atf_test_case stpcpy 259stpcpy_head() 260{ 261 atf_set "descr" "Checks stpcpy(3)" 262} 263stpcpy_body() 264{ 265 prog="$(atf_get_srcdir)/h_stpcpy" 266 267 h_pass "$prog 0123456" |
268 # Begin FreeBSD 269 if true; then 270 h_fail "$prog 0123456789ab" 271 else 272 # End FreeBSD |
|
180 h_fail "$prog 0123456789" | 273 h_fail "$prog 0123456789" |
274 # Begin FreeBSD 275 fi 276 # End FreeBSD |
|
181} 182 183atf_test_case strcat 184strcat_head() 185{ 186 atf_set "descr" "Checks strcat(3)" 187} 188strcat_body() --- 9 unchanged lines hidden (view full) --- 198{ 199 atf_set "descr" "Checks strncpy(3)" 200} 201strncpy_body() 202{ 203 prog="$(atf_get_srcdir)/h_strncpy" 204 205 h_pass "$prog 10" | 277} 278 279atf_test_case strcat 280strcat_head() 281{ 282 atf_set "descr" "Checks strcat(3)" 283} 284strcat_body() --- 9 unchanged lines hidden (view full) --- 294{ 295 atf_set "descr" "Checks strncpy(3)" 296} 297strncpy_body() 298{ 299 prog="$(atf_get_srcdir)/h_strncpy" 300 301 h_pass "$prog 10" |
302 # Begin FreeBSD 303 if true; then 304 h_fail "$prog 13" 305 else 306 # End FreeBSD |
|
206 h_fail "$prog 11" | 307 h_fail "$prog 11" |
308 # Begin FreeBSD 309 fi 310 # End FreeBSD |
|
207} 208 209atf_test_case stpncpy 210stpncpy_head() 211{ 212 atf_set "descr" "Checks stpncpy(3)" 213} 214stpncpy_body() 215{ 216 prog="$(atf_get_srcdir)/h_stpncpy" 217 218 h_pass "$prog 10" | 311} 312 313atf_test_case stpncpy 314stpncpy_head() 315{ 316 atf_set "descr" "Checks stpncpy(3)" 317} 318stpncpy_body() 319{ 320 prog="$(atf_get_srcdir)/h_stpncpy" 321 322 h_pass "$prog 10" |
323 # Begin FreeBSD 324 if true; then 325 h_fail "$prog 13" 326 else 327 # End FreeBSD |
|
219 h_fail "$prog 11" | 328 h_fail "$prog 11" |
329 # Begin FreeBSD 330 fi 331 # End FreeBSD |
|
220} 221 222atf_test_case strncat 223strncat_head() 224{ 225 atf_set "descr" "Checks strncat(3)" 226} 227strncat_body() 228{ 229 prog="$(atf_get_srcdir)/h_strncat" 230 | 332} 333 334atf_test_case strncat 335strncat_head() 336{ 337 atf_set "descr" "Checks strncat(3)" 338} 339strncat_body() 340{ 341 prog="$(atf_get_srcdir)/h_strncat" 342 |
343 # Begin FreeBSD |
|
231 h_pass "$prog 8" | 344 h_pass "$prog 8" |
345 if true; then 346 h_fail "$prog 11" 347 else 348 # End FreeBSD |
|
232 h_fail "$prog 9" | 349 h_fail "$prog 9" |
350 # Begin FreeBSD 351 fi 352 # End FreeBSD |
|
233} 234 235atf_test_case raw 236raw_head() 237{ 238 atf_set "descr" "Checks raw array overflow" 239} 240raw_body() 241{ 242 prog="$(atf_get_srcdir)/h_raw" 243 244 h_pass "$prog 9" | 353} 354 355atf_test_case raw 356raw_head() 357{ 358 atf_set "descr" "Checks raw array overflow" 359} 360raw_body() 361{ 362 prog="$(atf_get_srcdir)/h_raw" 363 364 h_pass "$prog 9" |
365 # Begin FreeBSD 366 if true; then 367 h_fail "$prog 12" 368 else 369 # End FreeBSD |
|
245 h_fail "$prog 10" | 370 h_fail "$prog 10" |
371 # Begin FreeBSD 372 fi 373 # End FreeBSD |
|
246} 247 248atf_test_case read 249read_head() 250{ 251 atf_set "descr" "Checks read(2)" 252} 253read_body() 254{ 255 prog="$(atf_get_srcdir)/h_read" 256 257 h_pass "$prog 1024" "echo foo |" | 374} 375 376atf_test_case read 377read_head() 378{ 379 atf_set "descr" "Checks read(2)" 380} 381read_body() 382{ 383 prog="$(atf_get_srcdir)/h_read" 384 385 h_pass "$prog 1024" "echo foo |" |
386 # Begin FreeBSD 387 if true; then 388 h_fail "$prog 1027" "echo bar |" 389 else 390 # End FreeBSD |
|
258 h_fail "$prog 1025" "echo bar |" | 391 h_fail "$prog 1025" "echo bar |" |
392 # Begin FreeBSD 393 fi 394 # End FreeBSD |
|
259} 260 261atf_test_case readlink 262readlink_head() 263{ 264 atf_set "descr" "Checks readlink(2)" 265} 266readlink_body() 267{ 268 prog="$(atf_get_srcdir)/h_readlink" 269 | 395} 396 397atf_test_case readlink 398readlink_head() 399{ 400 atf_set "descr" "Checks readlink(2)" 401} 402readlink_body() 403{ 404 prog="$(atf_get_srcdir)/h_readlink" 405 |
406 # Begin FreeBSD 407 if true; then 408 h_pass "$prog 512" 409 h_fail "$prog 523" 410 else 411 # End FreeBSD |
|
270 h_pass "$prog 1024" 271 h_fail "$prog 1025" | 412 h_pass "$prog 1024" 413 h_fail "$prog 1025" |
414 # Begin FreeBSD 415 fi 416 # End FreeBSD |
|
272} 273 274atf_test_case getcwd 275getcwd_head() 276{ 277 atf_set "descr" "Checks getcwd(3)" 278} 279getcwd_body() 280{ 281 prog="$(atf_get_srcdir)/h_getcwd" 282 283 h_pass "$prog 1024" | 417} 418 419atf_test_case getcwd 420getcwd_head() 421{ 422 atf_set "descr" "Checks getcwd(3)" 423} 424getcwd_body() 425{ 426 prog="$(atf_get_srcdir)/h_getcwd" 427 428 h_pass "$prog 1024" |
429 # Begin FreeBSD 430 if false; then 431 # End FreeBSD |
|
284 h_fail "$prog 1025" | 432 h_fail "$prog 1025" |
433 # Begin FreeBSD 434 fi 435 # End FreeBSD |
|
285} 286 287atf_init_test_cases() 288{ 289 atf_add_test_case sprintf 290 atf_add_test_case vsprintf 291 atf_add_test_case snprintf 292 atf_add_test_case vsnprintf --- 16 unchanged lines hidden --- | 436} 437 438atf_init_test_cases() 439{ 440 atf_add_test_case sprintf 441 atf_add_test_case vsprintf 442 atf_add_test_case snprintf 443 atf_add_test_case vsnprintf --- 16 unchanged lines hidden --- |