A2osX/TESTS/ARGTEST2.txt

231 lines
4.4 KiB
Plaintext
Raw Permalink Normal View History

NEW
PREFIX
AUTO 4,1
#!/BIN/SH
#
# This is a test of passing args
# This script is called by ARGTEST passing a known set
# of arguments which this script checks to verify
# arg passing works.
#
# The args passed are:
#
# A 1 B 2 C 3 Hello $$ 82 Tenth
#
# Note that $$ is passed which is this process id
# of the calling script that can be compared with this
# scripts parent process id; validating both are working.
#
# $0 should be name of script
#
2019-03-07 02:13:28 +00:00
IF [ -Z $T ]
SET T = 0
FI
SET T = $T + 1
IF [ $0 = "ARGTEST2" ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 0 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 0 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 0 Failed - $0" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 0 Failed - $0"
FI
#
# $1 should be 'A'
#
SET T = $T + 1
IF [ $1 = "A" ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 1 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 1 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 1 Failed - $1" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 1 Failed"
FI
#
# $2 should be '1'
#
SET T = $T + 1
IF [ $2 -EQ 1 ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 2 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 2 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 2 Failed - $2" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 2 Failed"
FI
#
# $3 should be 'B'
#
SET T = $T + 1
IF [ $3 = "B" ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 3 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 3 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 3 Failed - $3" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 3 Failed"
FI
#
# $4 should be '2'
#
SET T = $T + 1
IF [ $4 -EQ 2 ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 4 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 4 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 4 Failed - $4" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 4 Failed"
FI
#
# $5 should be 'C'
#
SET T = $T + 1
IF [ $5 = "C" ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 5 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 5 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 5 Failed - $5" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 5 Failed"
FI
#
# $6 should be '3'
#
SET T = $T + 1
IF [ $6 -EQ 3 ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 6 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 6 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 6 Failed - $6" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 6 Failed"
FI
#
# $7 should be 'Hello'
#
SET T = $T + 1
IF [ $7 = "Hello" ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 7 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 7 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 7 Failed - $7" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 7 Failed"
FI
#
# $8 should be the process id of the parent which is same as mine
#
SET T = $T + 1
IF [ $8 -EQ $$ ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
2019-09-11 01:20:09 +00:00
echo "ARGTEST Arg 8 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 8 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 8 Failed - $8 vs $$" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 8 Failed"
FI
#
# $9 should be '82'
#
SET T = $T + 1
2019-03-07 02:13:28 +00:00
IF [ $9 -EQ 82 ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 9 Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 9 Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 9 Failed - $9" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg 9 Failed"
FI
#
# $# should be '10'
#
SET T = $T + 1
IF [ $# -EQ 10 ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg Count Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg Count Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg Count Failed - $#" >> ${Log}
FI
echo "ARGTEST Arg Count Failed - $#"
FI
#
# $* should be 'A 1 B 2 C 3 Hello $$ 82 Tenth'
#
SET T = $T + 1
IF [ $* = "A 1 B 2 C 3 Hello $$ 82 Tenth" ]
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg ALL Passed" >> ${Log}
FI
2019-03-07 02:13:28 +00:00
echo "ARGTEST Arg ALL Passed"
ELSE
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg ALL Failed - $*" >> ${Log}
FI
echo "ARGTEST Arg ALL Failed - $*"
FI
2019-03-07 02:13:28 +00:00
ECHO "Arg Tests Done"
2019-03-01 18:19:14 +00:00
IF [ -N $Log ]
echo "Arg Tests Complete" >> ${Log}
FI
MAN
TEXT /MAKE/USR/SHARE/TESTS/ARGTEST2