- initial checkin, as received from Dave Tribby

This commit is contained in:
gdr 1997-09-17 05:29:33 +00:00
parent 0cd26df27a
commit c1fa42d03c
13 changed files with 424 additions and 0 deletions

149
bin/cat/tests/dotests Normal file
View File

@ -0,0 +1,149 @@
# Tests for cat command; invoked by command file "fulltests"
# Written by Dave Tribby (August 1997)
# Location of the cat command to be tested
set testcmd="../cat"
# Record starting time
echo -n "Testing command $testcmd beginning at"
date
set src="file1.mixed"
set cmp="file1.mixed"
set dest="/tmp/$cmp"
echo "Copying a single text file ($src) using filename input"
$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 "Copying a single text file ($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 cmp="file1.bopt"
set dest="/tmp/${cmp}"
echo "Display a single text file ($src) with -b option"
$testcmd -b $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="file1.nopt"
set dest="/tmp/${cmp}"
echo "Display a single text file ($src) with -n option"
$testcmd -n $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="file1.topt"
set dest="/tmp/${cmp}"
echo "Display a single text file ($src) with -t option"
$testcmd -t $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="file1.eopt"
set dest="/tmp/${cmp}"
echo "Display a single text file ($src) with -e option"
$testcmd -e $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 src2=file1.nopt
set cmp="file1.combo"
set dest="/tmp/${cmp}"
echo "Combine two files ($src, $src2) with stdin in the middle"
set msg="===== stdin in between file1.mixed and $file1.nopt ====="
echo $msg | $testcmd $src - $src2 > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set src="file2.bin1"
set cmp="file2.bin1"
set dest="/tmp/$cmp"
echo "Copying a single binary file ($src) using filename input"
$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 "Copying a single binary file ($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 cmp="file2.vopt"
set dest="/tmp/${cmp}"
echo "Display a single binary file ($src) with -v option"
$testcmd -v $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="file2.topt"
set dest="/tmp/${cmp}"
echo "Display a single binary file ($src) with -t option"
$testcmd -t $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 src="$testcmd"
set cmp="$testcmd"
set dest="/tmp/cat"
echo "Copying a single binary file ($src) through a pipe"
$testcmd $src | $testcmd > $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 ""
set src="badname"
echo "Expected error: $src: no such file or directory"
$testcmd $src > $dest
echo " Error completion status = $status (expected: 1)"

19
bin/cat/tests/file1.bopt Normal file
View File

@ -0,0 +1,19 @@
1 # Create the test environment for tr
2 # Compile and load flags passed to occ
3 # -v: verbose
4 # -I: add directory to header path
5 CFLAGS += -v -I /usr/include
6 LDFLAGS += -v
7 # Default target, "all," generates the files
8 all: file2.bin1 genbin
9 # Files depend upon program
10 file2.bin1: genbin
11 ./genbin
12 # Remove intermediate files
13 clean:
14 $(RM) -f *.o
15 $(RM) -f *.root

39
bin/cat/tests/file1.combo Normal file
View File

@ -0,0 +1,39 @@
# Create the test environment for tr
# Compile and load flags passed to occ
# -v: verbose
# -I: add directory to header path
CFLAGS += -v -I /usr/include
LDFLAGS += -v
# Default target, "all," generates the files
all: file2.bin1 genbin
# Files depend upon program
file2.bin1: genbin
./genbin
# Remove intermediate files
clean:
$(RM) -f *.o
$(RM) -f *.root
===== stdin in between file1.mixed and .nopt =====
1 # Create the test environment for tr
2
3 # Compile and load flags passed to occ
4 # -v: verbose
5 # -I: add directory to header path
6 CFLAGS += -v -I /usr/include
7 LDFLAGS += -v
8
9 # Default target, "all," generates the files
10 all: file2.bin1 genbin
11
12 # Files depend upon program
13 file2.bin1: genbin
14 ./genbin
15
16 # Remove intermediate files
17 clean:
18 $(RM) -f *.o
19 $(RM) -f *.root

19
bin/cat/tests/file1.eopt Normal file
View File

@ -0,0 +1,19 @@
# Create the test environment for tr$
$
# Compile and load flags passed to occ$
# -v: verbose$
# -I: add directory to header path$
CFLAGS += -v -I /usr/include$
LDFLAGS += -v$
$
# Default target, "all," generates the files$
all: file2.bin1 genbin$
$
# Files depend upon program$
file2.bin1: genbin$
./genbin$
$
# Remove intermediate files$
clean:$
$(RM) -f *.o$
$(RM) -f *.root$

19
bin/cat/tests/file1.mixed Normal file
View File

@ -0,0 +1,19 @@
# Create the test environment for tr
# Compile and load flags passed to occ
# -v: verbose
# -I: add directory to header path
CFLAGS += -v -I /usr/include
LDFLAGS += -v
# Default target, "all," generates the files
all: file2.bin1 genbin
# Files depend upon program
file2.bin1: genbin
./genbin
# Remove intermediate files
clean:
$(RM) -f *.o
$(RM) -f *.root

19
bin/cat/tests/file1.nopt Normal file
View File

@ -0,0 +1,19 @@
1 # Create the test environment for tr
2
3 # Compile and load flags passed to occ
4 # -v: verbose
5 # -I: add directory to header path
6 CFLAGS += -v -I /usr/include
7 LDFLAGS += -v
8
9 # Default target, "all," generates the files
10 all: file2.bin1 genbin
11
12 # Files depend upon program
13 file2.bin1: genbin
14 ./genbin
15
16 # Remove intermediate files
17 clean:
18 $(RM) -f *.o
19 $(RM) -f *.root

19
bin/cat/tests/file1.topt Normal file
View File

@ -0,0 +1,19 @@
# Create the test environment for tr
# Compile and load flags passed to occ
# -v: verbose
# -I: add directory to header path
CFLAGS^I+= -v -I /usr/include
LDFLAGS^I+= -v
# Default target, "all," generates the files
all: file2.bin1 genbin
# Files depend upon program
file2.bin1: genbin
^I./genbin
# Remove intermediate files
clean:
^I$(RM) -f *.o
^I$(RM) -f *.root

BIN
bin/cat/tests/file2.bin1 Normal file

Binary file not shown.

3
bin/cat/tests/file2.topt Normal file
View File

@ -0,0 +1,3 @@
^@^A^B^C^D^E^F^G^H^I
^K^L
^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_

3
bin/cat/tests/file2.vopt Normal file
View File

@ -0,0 +1,3 @@
^@^A^B^C^D^E^F^G^H
^K^L
^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_

18
bin/cat/tests/file4.text Normal file
View File

@ -0,0 +1,18 @@
This is a text file
that contains multiple blank lines
to check out the "cat" command's ability
to remove extra lines (using the -r command).
===== END OF FILE =====

28
bin/cat/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\""

89
bin/cat/tests/test.list Normal file
View File

@ -0,0 +1,89 @@
Script started on: Mon Sep 01 15:01:21 1997
[61] test=> dotests ; exit
Testing command ../cat beginning at Mon Sep 1 15:01:31 1997
Copying a single text file (file1.mixed) using filename input
==> 474 stack bytes used <==
Completion status = 0
Checking results against control file file1.mixed (no differences expected)
Completion status = 0
Copying a single text file (file1.mixed) using stdin
==> 474 stack bytes used <==
Completion status = 0
Checking results against control file file1.mixed (no differences expected)
Completion status = 0
Display a single text file (file1.mixed) with -b option
==> 820 stack bytes used <==
Completion status = 0
Checking results against control file file1.bopt (no differences expected)
Completion status = 0
Display a single text file (file1.mixed) with -n option
==> 820 stack bytes used <==
Completion status = 0
Checking results against control file file1.nopt (no differences expected)
Completion status = 0
Display a single text file (file1.mixed) with -t option
==> 596 stack bytes used <==
Completion status = 0
Checking results against control file file1.topt (no differences expected)
Completion status = 0
Display a single text file (file1.mixed) with -e option
==> 596 stack bytes used <==
Completion status = 0
Checking results against control file file1.eopt (no differences expected)
Completion status = 0
Combine two files (file1.mixed, file1.nopt) with stdin in the middle
==> 474 stack bytes used <==
Completion status = 0
Checking results against control file file1.combo (no differences expected)
Completion status = 0
Copying a single binary file (file2.bin1) using filename input
==> 474 stack bytes used <==
Completion status = 0
Checking results against control file file2.bin1 (no differences expected)
Completion status = 0
Copying a single binary file (file2.bin1) using stdin
==> 474 stack bytes used <==
Completion status = 0
Checking results against control file file2.bin1 (no differences expected)
Completion status = 0
Display a single binary file (file2.bin1) with -v option
==> 596 stack bytes used <==
Completion status = 0
Checking results against control file file2.vopt (no differences expected)
Completion status = 0
Display a single binary file (file2.bin1) with -t option
==> 596 stack bytes used <==
Completion status = 0
Checking results against control file file2.topt (no differences expected)
Completion status = 0
Copying a single binary file (../cat) through a pipe
==> 373 stack bytes used <==
==> 474 stack bytes used <==
Completion status = 0
Checking results against control file ../cat (no differences expected)
Completion status = 0
***** Error Messages *****
Expected error: illegal option
cat: illegal option -- x
usage: cat [-benstuv] [-] [file ...]
==> 1819 stack bytes used <==
Error completion status = 1 (expected: 1)
Expected error: badname: no such file or directory
cat: badname: no such file or directory
==> 1853 stack bytes used <==
Error completion status = 1 (expected: 1)
Script done on: Mon Sep 01 15:03:02 1997