Skip to content

Commit

Permalink
Is509 correct errors in z390 implementation of HLASM built-in functio…
Browse files Browse the repository at this point in the history
…ns (z390development#541)

* is509 fixes for HLASM built-in functions

* update readme

* correct typo in comment

* change TOPR2 report file name to TOPR2.TST

* change comment HLASM LR to HLASM LangRef

* add additional regression tests

* remove unused statement and correct typo
  • Loading branch information
jyganci authored Aug 9, 2024
1 parent a73a4f4 commit 4596fbd
Show file tree
Hide file tree
Showing 26 changed files with 4,659 additions and 178 deletions.
40 changes: 40 additions & 0 deletions rt/bash/errora2btests
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# errora2btests: regression test A2B error

# global variable containing name of script; used by error function
scriptName="errora2btests"

########################################
# print error message and exit
#
# input:
# $1 name of program for the error
# $2 program expected return code
# $3 program actual return code
########################################

function error {
echo "$scriptName ERROR: $1 expected RC=$2 but actual RC=$3; exiting"
exit 8
}

#set -e # exit on all errors; not for this script
cd $(dirname $0) # set to directory of script - rt/bash
cd .. # up to rt
cd .. # up to z390

prog="A2BE1"
bash/asm rt/mlc/$prog
rc=$?
if [ $rc -ne 12 ]; then error "$prog" 12 $rc; fi

prog="A2BE2"
bash/asm rt/mlc/$prog
rc=$?
if [ $rc -ne 12 ]; then error "$prog" 12 $rc; fi

# if we get here, there were no errors
rc=0
echo "$scriptName exiting with RC=$rc"
exit $rc
36 changes: 36 additions & 0 deletions rt/bash/errorisbintests
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# errorisbintests: regression test ISBIN error

# global variable containing name of script; used by error function
scriptName="errorisbintests"

########################################
# print error message and exit
#
# input:
# $1 name of program for the error
# $2 program expected return code
# $3 program actual return code
########################################

function error {
echo "$scriptName ERROR: $1 expected RC=$2 but actual RC=$3; exiting"
exit 8
}


#set -e # exit on all errors; not for this script
cd $(dirname $0) # set to directory of script - rt/bash
cd .. # up to rt
cd .. # up to z390

prog="ISBINE1"
bash/asm rt/mlc/$prog
rc=$?
if [ $rc -ne 8 ]; then error "$prog" 8 $rc; fi

# if we get here, there were no errors
rc=0
echo "$scriptName exiting with RC=$rc"
exit $rc
35 changes: 35 additions & 0 deletions rt/bash/errorisdectests
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# errorisdectests: regression test ISDEC error

# global variable containing name of script; used by error function
scriptName="errorisdectests"

########################################
# print error message and exit
#
# input:
# $1 name of program for the error
# $2 program expected return code
# $3 program actual return code
########################################

function error {
echo "$scriptName ERROR: $1 expected RC=$2 but actual RC=$3; exiting"
exit 8
}

#set -e # exit on all errors; not for this script
cd $(dirname $0) # set to directory of script - rt/bash
cd .. # up to rt
cd .. # up to z390

prog="ISDECE1"
bash/asm rt/mlc/$prog
rc=$?
if [ $rc -ne 8 ]; then error "$prog" 8 $rc; fi

# if we get here, there were no errors
rc=0
echo "$scriptName exiting with RC=$rc"
exit $rc
35 changes: 35 additions & 0 deletions rt/bash/errorishextests
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# errorishextests: regression test ISHEX error

# global variable containing name of script; used by error function
scriptName="errorishextests"

########################################
# print error message and exit
#
# input:
# $1 name of program for the error
# $2 program expected return code
# $3 program actual return code
########################################

function error {
echo "$scriptName ERROR: $1 expected RC=$2 but actual RC=$3; exiting"
exit 8
}

#set -e # exit on all errors; not for this script
cd $(dirname $0) # set to directory of script - rt/bash
cd .. # up to rt
cd .. # up to z390

prog="ISHEXE1"
bash/asm rt/mlc/$prog
rc=$?
if [ $rc -ne 8 ]; then error "$prog" 8 $rc; fi

# if we get here, there were no errors
rc=0
echo "$scriptName exiting with RC=$rc"
exit $rc
35 changes: 35 additions & 0 deletions rt/bash/errorissymtests
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# errorissymtests: regression test ISSYM error

# global variable containing name of script; used by error function
scriptName="errorissymtests"

########################################
# print error message and exit
#
# input:
# $1 name of program for the error
# $2 program expected return code
# $3 program actual return code
########################################

function error {
echo "$scriptName ERROR: $1 expected RC=$2 but actual RC=$3; exiting"
exit 8
}

#set -e # exit on all errors; not for this script
cd $(dirname $0) # set to directory of script - rt/bash
cd .. # up to rt
cd .. # up to z390

prog="ISSYME1"
bash/asm rt/mlc/$prog
rc=$?
if [ $rc -ne 8 ]; then error "$prog" 8 $rc; fi

# if we get here, there were no errors
rc=0
echo "$scriptName exiting with RC=$rc"
exit $rc
35 changes: 35 additions & 0 deletions rt/bash/errorslatests
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# errorslatests: regression test SLA errors

# global variable containing name of script; used by error function
scriptName="errorslatests"

########################################
# print error message and exit
#
# input:
# $1 name of program for the error
# $2 program expected return code
# $3 program actual return code
########################################

function error {
echo "$scriptName ERROR: $1 expected RC=$2 but actual RC=$3; exiting"
exit 8
}

#set -e # exit on all errors; not for this script
cd $(dirname $0) # set to directory of script - rt/bash
cd .. # up to rt
cd .. # up to z390

prog="SLAE1"
bash/asm rt/mlc/$prog
rc=$?
if [ $rc -ne 8 ]; then error "$prog" 8 $rc; fi

# if we get here, there were no errors
rc=0
echo "$scriptName exiting with RC=$rc"
exit $rc
8 changes: 8 additions & 0 deletions rt/bash/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ runtbrctx - verify closed issue #238
runtestopt - verify indirection usage in options files
runbr14owe - verifies test IEFBR14 asm[l[g]] with Okay, Warning, Error variants
runcodepagetests - verifies usage of CODEPAGE issue #451
runhlasmbiftests - run HLASM built-in function tests issue 509
errora2btests - verify A2B error tests
errorisbintests - verify ISBIN error tests
errorisdectests - verify ISDEC error tests
errorishextests - verify ISHEX error tests
errorissymtests - verify ISSYM error tests
errorslatests - verify SLA error tests
x00c2bdxtests - verify C2B, C2D, C2X tests that have X'00' in argument

End regression test commands
25 changes: 25 additions & 0 deletions rt/bash/runhlasmbiftests
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# runhlasmbiftests: regression test HLASM built-in functions

set -e # exit on all errors
cd $(dirname $0) # set to directory of script - rt/bash
cd .. # up to rt
cd .. # up to z390

sysmac='sysmac(mac)'
optable='optable(z390)'

dir1="rt/test"
dir2="rt/mlc"

bash/asmlg ${dir1}/TESTOPR2 trace noloadhigh noinit $sysmac

export REPORT=${dir2}/TOPR2.TST
bash/asmlg ${dir2}/TOPR2 trace noloadhigh noinit $sysmac

# if we get here, there were no errors
echo "Verify tests ran without errors"
echo " View ${dir1}/TESTOPR2.PRN to see tests checked with MNOTE,AIF"
echo " View ${dir2}/TOPR2.TXT to see tests checked with code"
exit 0
22 changes: 22 additions & 0 deletions rt/bash/x00c2bdxtests
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# x00c2bdxtests: regression test HLASM built-in functions

set -e # exit on all errors
cd $(dirname $0) # set to directory of script
cd ../.. # up two directories; the z390 directory

sysmac='sysmac(mac)'

# assemble test program
bash/asm rt/mlc/C2BDX00 trace noloadhigh $sysmac
rc=$?
if [ $rc -ne 0 ]; then
echo "Error assembling test program; rc=$rc"
exit $rc
fi

# if we get here, there were no errors
echo "Verify tests ran without errors"
echo " View rt/mlc/C2BDX00.PRN to see tests"
exit 0
20 changes: 20 additions & 0 deletions rt/mlc/A2BE1.MLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
* Test A2B built-in function error
A2BE1 CSECT
SR 15,15
BR 14
*
LCLC &C
*
* HLASM LangRef example
*
*&C SETC 'abc' Preset result field
&C SETC 'abc'
*
*&C SETC A2B(2345678901) Error; too large
&C SETC A2B(2345678901)
MNOTE 'A2B(2345678901)=&C'
AIF ('&C' EQ 'abc').OK
MNOTE 12.'Error; expected value is abc'
.OK ANOP
*
END
20 changes: 20 additions & 0 deletions rt/mlc/A2BE2.MLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
* Test A2B built-in function error
A2BE2 CSECT
SR 15,15
BR 14
*
LCLC &C
*
* z390 example
*
*&C SETC 'abc' Preset result field
&C SETC 'abc'
*
*&C SETC A2B(--2147483648) Error; overflow
&C SETC A2B(--2147483648)
MNOTE 'A2B(--2147483648)=&C'
AIF ('&C' EQ 'abc').OK
MNOTE 12.'Error; expected value is abc'
.OK ANOP
*
END
34 changes: 34 additions & 0 deletions rt/mlc/C2BDX00.MLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
* Test HLASM built-in functions that have X'00' in argument string
C2BDX00 CSECT
LCLC &C2B,&C2D,&C2X
*
LCLC &NULL,&NULLj
*
* &NULL,&NULLj values taken from HLASM LangRef B2C examples
&NULL SETC B2C('0') value 'n' = null char = X'00'
&NULLj SETC '&NULL'.'j' value 'nj'
*
* HLASM LangRef examples
*
*&C2B SETC C2B('n') n = null char = X'00'
&C2B SETC C2B('&NULL')
MNOTE 'C2B(''&NULL'')=&C2B'
AIF ('&C2B' EQ '00000000').OKC2B
MNOTE 8,'C2B: Generated value not equal to expected value'
.OKC2B ANOP
*
*&C2D SETC C2D('nj') n = null char = X'00'
&C2D SETC C2D('&NULLj')
MNOTE 'C2D(''&NULLj'')=&C2D'
AIF ('&C2D' EQ '+145').OKC2D
MNOTE 8,'C2D: Generated value not equal to expected value'
.OKC2D ANOP
*
*&C2X SETC C2X('n') n = null char = X'00'
&C2X SETC C2X('&NULL')
MNOTE 'C2X(''&NULL'')=&C2X'
AIF ('&C2X' EQ '00').OKC2X
MNOTE 8,'C2X: Generated value not equal to expected value'
.OKC2X ANOP
*
END
20 changes: 20 additions & 0 deletions rt/mlc/ISBINE1.MLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
* Test ISBIN built-in function error
ISBINE1 CSECT
SR 15,15
BR 14
*
LCLA &A
*
* HLASM LangRef example
*
*&A SETA 123 Preset return value
&A SETA 123
*&A ISBIN('') Error
&A SETA ISBIN('') 0
MNOTE 'ISBIN('''')=&A'
DC F'&A'
AIF (&A EQ 0).OK
MNOTE 12,'Error; expected value is 0'
.OK ANOP
*
END
Loading

0 comments on commit 4596fbd

Please sign in to comment.