Skip to content

Commit b508727

Browse files
committed
[v1.1] add regression test (re: 23a6ba0)
src/cmd/ksh93/tests/variables.sh: - Since nrand48(3) uses a POSIX-specified pseudorandom generator on all systems, check that a known seed value (123) produces the expected reproducable pseudorandom sequence. Other files: - Related housekeeping.
1 parent 4936d62 commit b508727

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

COPYRIGHT

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ ksh 93u+m general copyright notice
2323
2424
# atheik <[email protected]> #
2525
# Vincent Mihalkovic <[email protected]> #
26+
# dnewhall <[email protected]> #
2627
# Ryan Schmidt <[email protected]> #
2728
# Harald van Dijk <[email protected]> #
2829
# Chase <[email protected]> #
2930
# rymrg <[email protected]> #
3031
# hyousatsu <[email protected]> #
31-
# dnewhall <[email protected]> #
3232
# Trey Valenta <[email protected]> #
3333
# Sterling Jensen <[email protected]> #
3434
# Marc Wilson <[email protected]> #

src/cmd/ksh93/include/variables.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* This software is part of the ast package *
44
* Copyright (c) 1982-2011 AT&T Intellectual Property *
5-
* Copyright (c) 2020-2024 Contributors to ksh 93u+m *
5+
* Copyright (c) 2020-2025 Contributors to ksh 93u+m *
66
* and is licensed under the *
77
* Eclipse Public License, Version 2.0 *
88
* *
@@ -13,6 +13,7 @@
1313
* David Korn <[email protected]> *
1414
* Martijn Dekker <[email protected]> *
1515
* Johnothan King <[email protected]> *
16+
* dnewhall <[email protected]> *
1617
* *
1718
***********************************************************************/
1819

src/cmd/ksh93/sh/init.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* hyenias <[email protected]> *
1717
* Harald van Dijk <[email protected]> *
1818
* K. Eugene Carlson <[email protected]> *
19+
* dnewhall <[email protected]> *
1920
* *
2021
***********************************************************************/
2122
/*

src/cmd/ksh93/sh/subshell.c

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Martijn Dekker <[email protected]> *
1515
* Johnothan King <[email protected]> *
1616
* hyenias <[email protected]> *
17+
* dnewhall <[email protected]> *
1718
* *
1819
***********************************************************************/
1920
/*

src/cmd/ksh93/tests/variables.sh

+15
Original file line numberDiff line numberDiff line change
@@ -1741,5 +1741,20 @@ exp='^[[:digit:]]{8}$'
17411741
[[ $got =~ $exp ]] || err_exit '$((.sh.version)) does not yield YYYYMMDD digits' \
17421742
"(expected match of ERE $exp, got '$got')"
17431743
1744+
# ======
1745+
# As of 93u+m/1.1, $RANDOM uses nrand48(3) which should use the same pseudorandom
1746+
# generator on all systems, producing a known sequence for a given seed value.
1747+
case ${.sh.version} in
1748+
*93u+m/1.0.*)
1749+
;;
1750+
*93u+m/*)
1751+
RANDOM=123
1752+
exp='24979 26943 1328 1988 6255 23944 24547 11971 6923 8339'
1753+
got="$RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM"
1754+
[[ $got == "$exp" ]] || err_exit "RANDOM does not seem to use the expected pseudorandom generator" \
1755+
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
1756+
;;
1757+
esac
1758+
17441759
# ======
17451760
exit $((Errors<125?Errors:125))

0 commit comments

Comments
 (0)