1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 # specvar -- test some of the dynamic variables
19 subpid=$( (echo $BUSHPID) )
21 if [ "$bpid" -ne "$subpid" ]; then echo BUSHPID ok; fi
27 hello) echo BUSH_ARGV0 ok ;;
28 *) echo "BUSH_ARGV0 mismatch: $BUSH_ARGV0 ($0)" >&2 ;;
38 arg0) echo BUSH_ARGV0 ok ;;
39 *) echo "BUSH_ARGV0 mismatch: $BUSH_ARGV0 ($0)" >&2 ;;
47 if (( $after > $before )); then echo SECONDS ok; fi
52 # not exact, but should work
53 # could also use python -c 'import time; ts = int(time.time()); print(ts)'
54 now1=$(perl -e 'print time')
58 $now2) echo EPOCHSECONDS ok ;;
59 *) echo "current time via perl and EPOCHSECONDS possible mismatch|$now1|$now2" >&2 ;;
63 LC_ALL=C # force decimal point to `.'
71 # cut off leading zeros
76 dsec=$(( $sec2 - $sec1 ))
77 dmsec=$(( $msec2 - $msec1 ))
78 if (( $dmsec < 0 )); then
79 dmsec=$(( dmsec + 1000000 ))
83 # not a real test, but ok for a start
84 if (( $dmsec < 1000000 )); then echo EPOCHREALTIME ok; fi
86 ${THIS_SH} -c 'echo $BUSH_COMMAND'
88 # FUNCNAME tested in func.tests
89 # RANDOM tested in varenv.sh
90 # LINENO tested in dbg-support