| # SPDX-License-Identifier: GPL-2.0-only |
| # Test is executed by writing and reading to /sys/kernel/debug/udelay_test |
| # and exercises a variety of delays to ensure that udelay() is delaying |
| # at least as long as requested (as compared to ktime). |
| # Copyright (C) 2014 Google, Inc. |
| UDELAY_PATH=/sys/kernel/debug/udelay_test |
| /sbin/modprobe -q $MODULE_NAME |
| echo $delay > $UDELAY_PATH |
| tee -a $tmp_file < $UDELAY_PATH |
| if [ -f $tmp_file ]; then |
| /sbin/modprobe -q -r $MODULE_NAME |
| # Delay for a variety of times. |
| # 1..200, 200..500 (by 10), 500..2000 (by 100) |
| for (( delay = 1; delay < 200; delay += 1 )); do |
| for (( delay = 200; delay < 500; delay += 10 )); do |
| for (( delay = 500; delay <= 2000; delay += 100 )); do |
| count=`grep -c FAIL $tmp_file` |
| echo "ERROR: $count delays failed to delay long enough" |