Print this page
12197 sleeptest is failing
   1 #!/bin/ksh
   2 #
   3 # This file and its contents are supplied under the terms of the
   4 # Common Development and Distribution License ("CDDL"), version 1.0.
   5 # You may only use this file in accordance with the terms of version
   6 # 1.0 of the CDDL.
   7 #
   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 #
  14 # Copyright 2019 Robert Mustacchi

  15 #
  16 
  17 #
  18 # Basic tests of sleep(1). sleep is a little hard to test, especially
  19 # for longer running cases. Therefore to test it, we basically take
  20 # advantage of our knowledge of how it is implemented. We see that it
  21 # properly is sleeping for the right amount of time by looking at the
  22 # call to nanosleep in libc and make sure that the structures time is
  23 # what we expect.
  24 #
  25 
  26 unalias -a
  27 set -o pipefail
  28 
  29 #
  30 # Set the locale for the start of the test to be C.UTF-8 to make sure
  31 # that we have a good starting point and correct fractional
  32 # interpretation.
  33 #
  34 export LC_ALL=C.UTF-8


 151 sleep_bound 0.1
 152 sleep_bound 0.25
 153 sleep_bound 0.5
 154 sleep_bound 0.75
 155 
 156 #
 157 # The next set of tests are negative tests that make sure that sleep
 158 # does not correctly execute in these cases.
 159 #
 160 sleep_err \"\"
 161 sleep_err 1 2 3
 162 sleep_err 1@23
 163 sleep_err 0,56
 164 sleep_err "hello"
 165 sleep_err s
 166 sleep_err 1z
 167 sleep_err -- -0.3
 168 
 169 #
 170 # Test a locale that uses a ',' character (de_DE.UTF-8 is one) as the
 171 # decimal point to make sure that sleep correctly is using LC_NUMERIC.
 172 #
 173 export LANG=de_DE.UTF-8
 174 sleep_err 21.45
 175 sleep_one 2,5 2 500000000
 176 sleep_one 34,0051 34 5100000
 177 sleep_one 3,6d 311040 0
 178 export LANG=C.UTF-8
 179 
 180 exit $sleep_exit
   1 #!/bin/ksh
   2 #
   3 # This file and its contents are supplied under the terms of the
   4 # Common Development and Distribution License ("CDDL"), version 1.0.
   5 # You may only use this file in accordance with the terms of version
   6 # 1.0 of the CDDL.
   7 #
   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 #
  14 # Copyright 2019 Robert Mustacchi
  15 # Copyright 2020 Joyent, Inc.
  16 #
  17 
  18 #
  19 # Basic tests of sleep(1). sleep is a little hard to test, especially
  20 # for longer running cases. Therefore to test it, we basically take
  21 # advantage of our knowledge of how it is implemented. We see that it
  22 # properly is sleeping for the right amount of time by looking at the
  23 # call to nanosleep in libc and make sure that the structures time is
  24 # what we expect.
  25 #
  26 
  27 unalias -a
  28 set -o pipefail
  29 
  30 #
  31 # Set the locale for the start of the test to be C.UTF-8 to make sure
  32 # that we have a good starting point and correct fractional
  33 # interpretation.
  34 #
  35 export LC_ALL=C.UTF-8


 152 sleep_bound 0.1
 153 sleep_bound 0.25
 154 sleep_bound 0.5
 155 sleep_bound 0.75
 156 
 157 #
 158 # The next set of tests are negative tests that make sure that sleep
 159 # does not correctly execute in these cases.
 160 #
 161 sleep_err \"\"
 162 sleep_err 1 2 3
 163 sleep_err 1@23
 164 sleep_err 0,56
 165 sleep_err "hello"
 166 sleep_err s
 167 sleep_err 1z
 168 sleep_err -- -0.3
 169 
 170 #
 171 # Test a locale that uses a ',' character (de_DE.UTF-8 is one) as the
 172 # decimal point to make sure that sleep is correctly using LC_NUMERIC.
 173 export LC_ALL=de_DE.UTF-8

 174 sleep_err 21.45
 175 sleep_one 2,5 2 500000000
 176 sleep_one 34,0051 34 5100000
 177 sleep_one 3,6d 311040 0
 178 export LC_ALL=C.UTF-8
 179 
 180 exit $sleep_exit