- initial checkin, as submitted by Dave Tribby

This commit is contained in:
gdr 1997-09-17 06:24:29 +00:00
parent 590e077340
commit 64cc71f1af
12 changed files with 1047 additions and 0 deletions

199
bin/tail/tests/dotests Normal file
View File

@ -0,0 +1,199 @@
# Tests for tail command; invoked by command file "fulltests"
# Written by Dave Tribby (August 1997)
# Location of the tail command to be tested
set testcmd="../tail"
# Record starting time
echo -n "Testing command $testcmd beginning at"
date
set src="file500.txt"
set cmp="f500.10l"
set dest="/tmp/$cmp"
echo "Listing last ten lines (default) of $src"
$testcmd $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}A"
echo "Listing last ten lines (default) of $src using stdin"
$testcmd < $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}B"
echo "Listing last ten lines (explicit) of $src"
$testcmd -n 10 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}C"
echo "Listing last ten lines (obsolescent) of $src"
$testcmd -10 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="f500.90c"
set dest="/tmp/$cmp"
echo "Listing last 90 chars of $src"
$testcmd -c 90 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}B"
echo "Listing last 90 chars (obsolescent) of $src"
$testcmd -90c $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="f500.1b"
set dest="/tmp/$cmp"
echo "Listing last block of $src"
$testcmd -b 1 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}A"
echo "Listing last block (obsolescent) of $src"
$testcmd -1b $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="f500.p400l"
set dest="/tmp/$cmp"
echo "Listing $src beginning at line 400"
$testcmd -n +400 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}A"
echo "Listing $src beginning at line 400 (obsolescent)"
$testcmd +400 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}B"
echo "Listing $src beginning at line 400 (obsolescent/explicit)"
$testcmd +400l $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="f500.p12040c"
set dest="/tmp/$cmp"
echo "Listing $src beginning at char 12040"
$testcmd -c +12040 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}A"
echo "Listing $src beginning at char 12040 (obsolescent)"
$testcmd +12040c $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="$src"
set dest="/tmp/${cmp}N"
echo "Listing all of $src using -n option"
$testcmd -n +1 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="$src"
set dest="/tmp/${cmp}B"
echo "Listing all of $src using -b option"
$testcmd -b +1 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="$src"
set dest="/tmp/${cmp}C"
echo "Listing all of $src using -c option"
$testcmd -c +1 $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="multi.out"
set dest="/tmp/$cmp"
echo "Listing last 3 lines of f*.*"
$testcmd -n 3 f*.* > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
echo "***** Error Messages *****"
set dest="/tmp/err.cond"
echo ""
echo "Expected error: illegal option"
$testcmd -x $src > $dest
echo " Error completion status = $status (expected: 1)"
echo ""
echo "Expected error: illegal offset"
$testcmd -n 12x $src > $dest
echo " Error completion status = $status (expected: 1)"
echo ""
set src="badname"
echo "Expected error: $src: no such file or directory"
$testcmd $src > $dest
echo " Error completion status = $status (expected: 1)"

10
bin/tail/tests/f500.10l Normal file
View File

@ -0,0 +1,10 @@
This is line number 491
This is line number 492
This is line number 493
This is line number 494
This is line number 495
This is line number 496
This is line number 497
This is line number 498
This is line number 499
This is line number 500

21
bin/tail/tests/f500.1b Normal file
View File

@ -0,0 +1,21 @@
number 480
This is line number 481
This is line number 482
This is line number 483
This is line number 484
This is line number 485
This is line number 486
This is line number 487
This is line number 488
This is line number 489
This is line number 490
This is line number 491
This is line number 492
This is line number 493
This is line number 494
This is line number 495
This is line number 496
This is line number 497
This is line number 498
This is line number 499
This is line number 500

4
bin/tail/tests/f500.90c Normal file
View File

@ -0,0 +1,4 @@
ne number 497
This is line number 498
This is line number 499
This is line number 500

View File

@ -0,0 +1,19 @@
umber 482
This is line number 483
This is line number 484
This is line number 485
This is line number 486
This is line number 487
This is line number 488
This is line number 489
This is line number 490
This is line number 491
This is line number 492
This is line number 493
This is line number 494
This is line number 495
This is line number 496
This is line number 497
This is line number 498
This is line number 499
This is line number 500

101
bin/tail/tests/f500.p400l Normal file
View File

@ -0,0 +1,101 @@
This is line number 400
This is line number 401
This is line number 402
This is line number 403
This is line number 404
This is line number 405
This is line number 406
This is line number 407
This is line number 408
This is line number 409
This is line number 410
This is line number 411
This is line number 412
This is line number 413
This is line number 414
This is line number 415
This is line number 416
This is line number 417
This is line number 418
This is line number 419
This is line number 420
This is line number 421
This is line number 422
This is line number 423
This is line number 424
This is line number 425
This is line number 426
This is line number 427
This is line number 428
This is line number 429
This is line number 430
This is line number 431
This is line number 432
This is line number 433
This is line number 434
This is line number 435
This is line number 436
This is line number 437
This is line number 438
This is line number 439
This is line number 440
This is line number 441
This is line number 442
This is line number 443
This is line number 444
This is line number 445
This is line number 446
This is line number 447
This is line number 448
This is line number 449
This is line number 450
This is line number 451
This is line number 452
This is line number 453
This is line number 454
This is line number 455
This is line number 456
This is line number 457
This is line number 458
This is line number 459
This is line number 460
This is line number 461
This is line number 462
This is line number 463
This is line number 464
This is line number 465
This is line number 466
This is line number 467
This is line number 468
This is line number 469
This is line number 470
This is line number 471
This is line number 472
This is line number 473
This is line number 474
This is line number 475
This is line number 476
This is line number 477
This is line number 478
This is line number 479
This is line number 480
This is line number 481
This is line number 482
This is line number 483
This is line number 484
This is line number 485
This is line number 486
This is line number 487
This is line number 488
This is line number 489
This is line number 490
This is line number 491
This is line number 492
This is line number 493
This is line number 494
This is line number 495
This is line number 496
This is line number 497
This is line number 498
This is line number 499
This is line number 500

500
bin/tail/tests/file500.txt Normal file
View File

@ -0,0 +1,500 @@
This is line number 1
This is line number 2
This is line number 3
This is line number 4
This is line number 5
This is line number 6
This is line number 7
This is line number 8
This is line number 9
This is line number 10
This is line number 11
This is line number 12
This is line number 13
This is line number 14
This is line number 15
This is line number 16
This is line number 17
This is line number 18
This is line number 19
This is line number 20
This is line number 21
This is line number 22
This is line number 23
This is line number 24
This is line number 25
This is line number 26
This is line number 27
This is line number 28
This is line number 29
This is line number 30
This is line number 31
This is line number 32
This is line number 33
This is line number 34
This is line number 35
This is line number 36
This is line number 37
This is line number 38
This is line number 39
This is line number 40
This is line number 41
This is line number 42
This is line number 43
This is line number 44
This is line number 45
This is line number 46
This is line number 47
This is line number 48
This is line number 49
This is line number 50
This is line number 51
This is line number 52
This is line number 53
This is line number 54
This is line number 55
This is line number 56
This is line number 57
This is line number 58
This is line number 59
This is line number 60
This is line number 61
This is line number 62
This is line number 63
This is line number 64
This is line number 65
This is line number 66
This is line number 67
This is line number 68
This is line number 69
This is line number 70
This is line number 71
This is line number 72
This is line number 73
This is line number 74
This is line number 75
This is line number 76
This is line number 77
This is line number 78
This is line number 79
This is line number 80
This is line number 81
This is line number 82
This is line number 83
This is line number 84
This is line number 85
This is line number 86
This is line number 87
This is line number 88
This is line number 89
This is line number 90
This is line number 91
This is line number 92
This is line number 93
This is line number 94
This is line number 95
This is line number 96
This is line number 97
This is line number 98
This is line number 99
This is line number 100
This is line number 101
This is line number 102
This is line number 103
This is line number 104
This is line number 105
This is line number 106
This is line number 107
This is line number 108
This is line number 109
This is line number 110
This is line number 111
This is line number 112
This is line number 113
This is line number 114
This is line number 115
This is line number 116
This is line number 117
This is line number 118
This is line number 119
This is line number 120
This is line number 121
This is line number 122
This is line number 123
This is line number 124
This is line number 125
This is line number 126
This is line number 127
This is line number 128
This is line number 129
This is line number 130
This is line number 131
This is line number 132
This is line number 133
This is line number 134
This is line number 135
This is line number 136
This is line number 137
This is line number 138
This is line number 139
This is line number 140
This is line number 141
This is line number 142
This is line number 143
This is line number 144
This is line number 145
This is line number 146
This is line number 147
This is line number 148
This is line number 149
This is line number 150
This is line number 151
This is line number 152
This is line number 153
This is line number 154
This is line number 155
This is line number 156
This is line number 157
This is line number 158
This is line number 159
This is line number 160
This is line number 161
This is line number 162
This is line number 163
This is line number 164
This is line number 165
This is line number 166
This is line number 167
This is line number 168
This is line number 169
This is line number 170
This is line number 171
This is line number 172
This is line number 173
This is line number 174
This is line number 175
This is line number 176
This is line number 177
This is line number 178
This is line number 179
This is line number 180
This is line number 181
This is line number 182
This is line number 183
This is line number 184
This is line number 185
This is line number 186
This is line number 187
This is line number 188
This is line number 189
This is line number 190
This is line number 191
This is line number 192
This is line number 193
This is line number 194
This is line number 195
This is line number 196
This is line number 197
This is line number 198
This is line number 199
This is line number 200
This is line number 201
This is line number 202
This is line number 203
This is line number 204
This is line number 205
This is line number 206
This is line number 207
This is line number 208
This is line number 209
This is line number 210
This is line number 211
This is line number 212
This is line number 213
This is line number 214
This is line number 215
This is line number 216
This is line number 217
This is line number 218
This is line number 219
This is line number 220
This is line number 221
This is line number 222
This is line number 223
This is line number 224
This is line number 225
This is line number 226
This is line number 227
This is line number 228
This is line number 229
This is line number 230
This is line number 231
This is line number 232
This is line number 233
This is line number 234
This is line number 235
This is line number 236
This is line number 237
This is line number 238
This is line number 239
This is line number 240
This is line number 241
This is line number 242
This is line number 243
This is line number 244
This is line number 245
This is line number 246
This is line number 247
This is line number 248
This is line number 249
This is line number 250
This is line number 251
This is line number 252
This is line number 253
This is line number 254
This is line number 255
This is line number 256
This is line number 257
This is line number 258
This is line number 259
This is line number 260
This is line number 261
This is line number 262
This is line number 263
This is line number 264
This is line number 265
This is line number 266
This is line number 267
This is line number 268
This is line number 269
This is line number 270
This is line number 271
This is line number 272
This is line number 273
This is line number 274
This is line number 275
This is line number 276
This is line number 277
This is line number 278
This is line number 279
This is line number 280
This is line number 281
This is line number 282
This is line number 283
This is line number 284
This is line number 285
This is line number 286
This is line number 287
This is line number 288
This is line number 289
This is line number 290
This is line number 291
This is line number 292
This is line number 293
This is line number 294
This is line number 295
This is line number 296
This is line number 297
This is line number 298
This is line number 299
This is line number 300
This is line number 301
This is line number 302
This is line number 303
This is line number 304
This is line number 305
This is line number 306
This is line number 307
This is line number 308
This is line number 309
This is line number 310
This is line number 311
This is line number 312
This is line number 313
This is line number 314
This is line number 315
This is line number 316
This is line number 317
This is line number 318
This is line number 319
This is line number 320
This is line number 321
This is line number 322
This is line number 323
This is line number 324
This is line number 325
This is line number 326
This is line number 327
This is line number 328
This is line number 329
This is line number 330
This is line number 331
This is line number 332
This is line number 333
This is line number 334
This is line number 335
This is line number 336
This is line number 337
This is line number 338
This is line number 339
This is line number 340
This is line number 341
This is line number 342
This is line number 343
This is line number 344
This is line number 345
This is line number 346
This is line number 347
This is line number 348
This is line number 349
This is line number 350
This is line number 351
This is line number 352
This is line number 353
This is line number 354
This is line number 355
This is line number 356
This is line number 357
This is line number 358
This is line number 359
This is line number 360
This is line number 361
This is line number 362
This is line number 363
This is line number 364
This is line number 365
This is line number 366
This is line number 367
This is line number 368
This is line number 369
This is line number 370
This is line number 371
This is line number 372
This is line number 373
This is line number 374
This is line number 375
This is line number 376
This is line number 377
This is line number 378
This is line number 379
This is line number 380
This is line number 381
This is line number 382
This is line number 383
This is line number 384
This is line number 385
This is line number 386
This is line number 387
This is line number 388
This is line number 389
This is line number 390
This is line number 391
This is line number 392
This is line number 393
This is line number 394
This is line number 395
This is line number 396
This is line number 397
This is line number 398
This is line number 399
This is line number 400
This is line number 401
This is line number 402
This is line number 403
This is line number 404
This is line number 405
This is line number 406
This is line number 407
This is line number 408
This is line number 409
This is line number 410
This is line number 411
This is line number 412
This is line number 413
This is line number 414
This is line number 415
This is line number 416
This is line number 417
This is line number 418
This is line number 419
This is line number 420
This is line number 421
This is line number 422
This is line number 423
This is line number 424
This is line number 425
This is line number 426
This is line number 427
This is line number 428
This is line number 429
This is line number 430
This is line number 431
This is line number 432
This is line number 433
This is line number 434
This is line number 435
This is line number 436
This is line number 437
This is line number 438
This is line number 439
This is line number 440
This is line number 441
This is line number 442
This is line number 443
This is line number 444
This is line number 445
This is line number 446
This is line number 447
This is line number 448
This is line number 449
This is line number 450
This is line number 451
This is line number 452
This is line number 453
This is line number 454
This is line number 455
This is line number 456
This is line number 457
This is line number 458
This is line number 459
This is line number 460
This is line number 461
This is line number 462
This is line number 463
This is line number 464
This is line number 465
This is line number 466
This is line number 467
This is line number 468
This is line number 469
This is line number 470
This is line number 471
This is line number 472
This is line number 473
This is line number 474
This is line number 475
This is line number 476
This is line number 477
This is line number 478
This is line number 479
This is line number 480
This is line number 481
This is line number 482
This is line number 483
This is line number 484
This is line number 485
This is line number 486
This is line number 487
This is line number 488
This is line number 489
This is line number 490
This is line number 491
This is line number 492
This is line number 493
This is line number 494
This is line number 495
This is line number 496
This is line number 497
This is line number 498
This is line number 499
This is line number 500

28
bin/tail/tests/fulltests Normal file
View File

@ -0,0 +1,28 @@
# gsh script to run tests and collect results
# Written by Dave Tribby * August 1997
# Name of gsh script containing test cases
set command="dotests"
# Sometimes the file type is modified by editing; make it executable
chtyp -l exec $command
# Filenames for raw and modified results
set raw_file="/tmp/rawlist"
set result_file="test.list"
# Location of tr command that knows how to handle classes
set trcmd="/src/usr.bin/tr/tr"
# --- Begin the tests ---
echo -n "Executing test script \"$command\" from directory "
pwd
# Create a new gsh invocation and record all I/O
echo "$command ; exit" | script $raw_file
# Cleanup control chars using either of the following...
echo "Done with tests. Removing control characters from results file"
$trcmd -c -ds '[:print:]\r' '\r' < $raw_file > $result_file
echo "Tests results have been saved as \"$result_file\""

BIN
bin/tail/tests/gen500 Normal file

Binary file not shown.

12
bin/tail/tests/gen500.c Normal file
View File

@ -0,0 +1,12 @@
/* Generate file for tail test */
#include <stdio.h>
int
main(int argc, char *argv[])
{
int i;
for (i=1; i<=500; i++)
printf("This is line number%5d\n",i);
}

29
bin/tail/tests/multi.out Normal file
View File

@ -0,0 +1,29 @@
==> f500.10l <==
This is line number 498
This is line number 499
This is line number 500
==> f500.1b <==
This is line number 498
This is line number 499
This is line number 500
==> f500.90c <==
This is line number 498
This is line number 499
This is line number 500
==> f500.p12040c <==
This is line number 498
This is line number 499
This is line number 500
==> f500.p400l <==
This is line number 498
This is line number 499
This is line number 500
==> file500.txt <==
This is line number 498
This is line number 499
This is line number 500

124
bin/tail/tests/test.list Normal file
View File

@ -0,0 +1,124 @@
Script started on: Mon Sep 01 15:04:30 1997
[61] test=> dotests ; exit
Testing command ../tail beginning at Mon Sep 1 15:04:40 1997
Listing last ten lines (default) of file500.txt
==> 759 stack bytes used <==
Completion status = 0
Checking results against control file f500.10l (no differences expected)
Completion status = 0
Listing last ten lines (default) of file500.txt using stdin
==> 759 stack bytes used <==
Completion status = 0
Checking results against control file f500.10l (no differences expected)
Completion status = 0
Listing last ten lines (explicit) of file500.txt
==> 759 stack bytes used <==
Completion status = 0
Checking results against control file f500.10l (no differences expected)
Completion status = 0
Listing last ten lines (obsolescent) of file500.txt
==> 759 stack bytes used <==
Completion status = 0
Checking results against control file f500.10l (no differences expected)
Completion status = 0
Listing last 90 chars of file500.txt
==> 716 stack bytes used <==
Completion status = 0
Checking results against control file f500.90c (no differences expected)
Completion status = 0
Listing last 90 chars (obsolescent) of file500.txt
==> 716 stack bytes used <==
Completion status = 0
Checking results against control file f500.90c (no differences expected)
Completion status = 0
Listing last block of file500.txt
==> 716 stack bytes used <==
Completion status = 0
Checking results against control file f500.1b (no differences expected)
Completion status = 0
Listing last block (obsolescent) of file500.txt
==> 716 stack bytes used <==
Completion status = 0
Checking results against control file f500.1b (no differences expected)
Completion status = 0
Listing file500.txt beginning at line 400
==> 669 stack bytes used <==
Completion status = 0
Checking results against control file f500.p400l (no differences expected)
Completion status = 0
Listing file500.txt beginning at line 400 (obsolescent)
==> 665 stack bytes used <==
Completion status = 0
Checking results against control file f500.p400l (no differences expected)
Completion status = 0
Listing file500.txt beginning at line 400 (obsolescent/explicit)
==> 665 stack bytes used <==
Completion status = 0
Checking results against control file f500.p400l (no differences expected)
Completion status = 0
Listing file500.txt beginning at char 12040
==> 716 stack bytes used <==
Completion status = 0
Checking results against control file f500.p12040c (no differences expected)
Completion status = 0
Listing file500.txt beginning at char 12040 (obsolescent)
==> 716 stack bytes used <==
Completion status = 0
Checking results against control file f500.p12040c (no differences expected)
Completion status = 0
Listing all of file500.txt using -n option
==> 665 stack bytes used <==
Completion status = 0
Checking results against control file file500.txt (no differences expected)
Completion status = 0
Listing all of file500.txt using -b option
==> 665 stack bytes used <==
Completion status = 0
Checking results against control file file500.txt (no differences expected)
Completion status = 0
Listing all of file500.txt using -c option
==> 665 stack bytes used <==
Completion status = 0
Checking results against control file file500.txt (no differences expected)
Completion status = 0
Listing last 3 lines of f*.*
==> 848 stack bytes used <==
Completion status = 0
Checking results against control file multi.out (no differences expected)
Completion status = 0
***** Error Messages *****
Expected error: illegal option
tail: illegal option -- x
usage: tail [-f] [-b # | -c # | -n #] [file ...]
tail [-f] [+|-#[b|c|l]] [file ...]
==> 1895 stack bytes used <==
Error completion status = 1 (expected: 1)
Expected error: illegal offset
tail: illegal offset -- 12x
==> 1912 stack bytes used <==
Error completion status = 1 (expected: 1)
Expected error: badname: no such file or directory
tail: badname: no such file or directory
==> 1919 stack bytes used <==
Error completion status = 1 (expected: 1)
Script done on: Mon Sep 01 15:07:39 1997