^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #!/bin/sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) # ftracetest - Ftrace test shell scripts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # Copyright (C) Hitachi Ltd., 2014
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) # Written by Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) usage() { # errno [message]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) [ ! -z "$2" ] && echo $2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) echo "Usage: ftracetest [options] [testcase(s)] [testcase-directory(s)]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) echo " Options:"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) echo " -h|--help Show help message"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) echo " -k|--keep Keep passed test logs"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) echo " -v|--verbose Increase verbosity of test messages"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) echo " -vv Alias of -v -v (Show all results in stdout)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) echo " -vvv Alias of -v -v -v (Show all commands immediately)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) echo " --fail-unsupported Treat UNSUPPORTED as a failure"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) echo " --fail-unresolved Treat UNRESOLVED as a failure"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) echo " -d|--debug Debug mode (trace all shell commands)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) echo " -l|--logdir <dir> Save logs on the <dir>"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) echo " If <dir> is -, all logs output in console only"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) exit $1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) # default error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) err_ret=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) # kselftest skip code is 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) err_skip=4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) # cgroup RT scheduling prevents chrt commands from succeeding, which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) # induces failures in test wakeup tests. Disable for the duration of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) # the tests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) readonly sched_rt_runtime=/proc/sys/kernel/sched_rt_runtime_us
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) sched_rt_runtime_orig=$(cat $sched_rt_runtime)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) setup() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) echo -1 > $sched_rt_runtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) cleanup() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) echo $sched_rt_runtime_orig > $sched_rt_runtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) errexit() { # message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) echo "Error: $1" 1>&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) cleanup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) exit $err_ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) # Ensuring user privilege
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) if [ `id -u` -ne 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) errexit "this must be run by root user"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) # Utilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) absdir() { # file_path
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) (cd `dirname $1`; pwd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) abspath() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) echo `absdir $1`/`basename $1`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) find_testcases() { #directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) echo `find $1 -name \*.tc | sort`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) parse_opts() { # opts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) local OPT_TEST_CASES=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) local OPT_TEST_DIR=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) while [ ! -z "$1" ]; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) case "$1" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) --help|-h)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) usage 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) --keep|-k)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) KEEP_LOG=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) --verbose|-v|-vv|-vvv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) if [ $VERBOSE -eq -1 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) usage "--console can not use with --verbose"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) VERBOSE=$((VERBOSE + 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) [ $1 = '-vv' ] && VERBOSE=$((VERBOSE + 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) [ $1 = '-vvv' ] && VERBOSE=$((VERBOSE + 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) --console)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) if [ $VERBOSE -ne 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) usage "--console can not use with --verbose"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) VERBOSE=-1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) --debug|-d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) DEBUG=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) --stop-fail)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) STOP_FAILURE=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) --fail-unsupported)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) UNSUPPORTED_RESULT=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) --fail-unresolved)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) UNRESOLVED_RESULT=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) --logdir|-l)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) LOG_DIR=$2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) shift 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) *.tc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) if [ -f "$1" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) OPT_TEST_CASES="$OPT_TEST_CASES `abspath $1`"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) usage 1 "$1 is not a testcase"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) if [ -d "$1" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) OPT_TEST_DIR=`abspath $1`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) OPT_TEST_CASES="$OPT_TEST_CASES `find_testcases $OPT_TEST_DIR`"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) usage 1 "Invalid option ($1)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) if [ ! -z "$OPT_TEST_CASES" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) TEST_CASES=$OPT_TEST_CASES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) # Parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) TRACING_DIR=`grep tracefs /proc/mounts | cut -f2 -d' ' | head -1`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) if [ -z "$TRACING_DIR" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if [ -z "$DEBUGFS_DIR" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) # If tracefs exists, then so does /sys/kernel/tracing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) if [ -d "/sys/kernel/tracing" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) mount -t tracefs nodev /sys/kernel/tracing ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) errexit "Failed to mount /sys/kernel/tracing"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) TRACING_DIR="/sys/kernel/tracing"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) # If debugfs exists, then so does /sys/kernel/debug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) elif [ -d "/sys/kernel/debug" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) mount -t debugfs nodev /sys/kernel/debug ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) errexit "Failed to mount /sys/kernel/debug"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) TRACING_DIR="/sys/kernel/debug/tracing"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) err_ret=$err_skip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) errexit "debugfs and tracefs are not configured in this kernel"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) TRACING_DIR="$DEBUGFS_DIR/tracing"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) if [ ! -d "$TRACING_DIR" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) err_ret=$err_skip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) errexit "ftrace is not configured in this kernel"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) TOP_DIR=`absdir $0`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) TEST_DIR=$TOP_DIR/test.d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) TEST_CASES=`find_testcases $TEST_DIR`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) KEEP_LOG=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) DEBUG=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) VERBOSE=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) UNSUPPORTED_RESULT=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) UNRESOLVED_RESULT=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) STOP_FAILURE=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) # Parse command-line options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) parse_opts $*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) [ $DEBUG -ne 0 ] && set -x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) # Verify parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) if [ -z "$TRACING_DIR" -o ! -d "$TRACING_DIR" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) errexit "No ftrace directory found"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) # Preparing logs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) if [ "x$LOG_DIR" = "x-" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) LOG_FILE=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) date
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) LOG_FILE=$LOG_DIR/ftracetest.log
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) mkdir -p $LOG_DIR || errexit "Failed to make a log directory: $LOG_DIR"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) date > $LOG_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) # Define text colors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) # Check available colors on the terminal, if any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) ncolors=`tput colors 2>/dev/null || echo 0`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) color_reset=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) color_red=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) color_green=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) color_blue=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) # If stdout exists and number of colors is eight or more, use them
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if [ -t 1 -a "$ncolors" -ge 8 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) color_reset="\033[0m"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) color_red="\033[31m"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) color_green="\033[32m"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) color_blue="\033[34m"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) strip_esc() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) # busybox sed implementation doesn't accept "\x1B", so use [:cntrl:] instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) sed -E "s/[[:cntrl:]]\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) prlog() { # messages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) newline="\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) if [ "$1" = "-n" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) newline=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) printf "$*$newline"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) [ "$LOG_FILE" ] && printf "$*$newline" | strip_esc >> $LOG_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) catlog() { #file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) cat $1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) [ "$LOG_FILE" ] && cat $1 | strip_esc >> $LOG_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) prlog "=== Ftrace unit tests ==="
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) # Testcase management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) # Test result codes - Dejagnu extended code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) PASS=0 # The test succeeded.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) FAIL=1 # The test failed, but was expected to succeed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) UNRESOLVED=2 # The test produced indeterminate results. (e.g. interrupted)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) UNTESTED=3 # The test was not run, currently just a placeholder.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) UNSUPPORTED=4 # The test failed because of lack of feature.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) XFAIL=5 # The test failed, and was expected to fail.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) # Accumulations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) PASSED_CASES=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) FAILED_CASES=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) UNRESOLVED_CASES=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) UNTESTED_CASES=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) UNSUPPORTED_CASES=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) XFAILED_CASES=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) UNDEFINED_CASES=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) TOTAL_RESULT=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) INSTANCE=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) CASENO=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) testcase() { # testfile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) CASENO=$((CASENO+1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) desc=`grep "^#[ \t]*description:" $1 | cut -f2- -d:`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) prlog -n "[$CASENO]$INSTANCE$desc"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) checkreq() { # testfile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) requires=`grep "^#[ \t]*requires:" $1 | cut -f2- -d:`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) # Use eval to pass quoted-patterns correctly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) eval check_requires "$requires"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) test_on_instance() { # testfile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) grep -q "^#[ \t]*flags:.*instance" $1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) eval_result() { # sigval
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) case $1 in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) $PASS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) prlog " [${color_green}PASS${color_reset}]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) PASSED_CASES="$PASSED_CASES $CASENO"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) return 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) $FAIL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) prlog " [${color_red}FAIL${color_reset}]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) FAILED_CASES="$FAILED_CASES $CASENO"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) return 1 # this is a bug.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) $UNRESOLVED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) prlog " [${color_blue}UNRESOLVED${color_reset}]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) UNRESOLVED_CASES="$UNRESOLVED_CASES $CASENO"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) return $UNRESOLVED_RESULT # depends on use case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) $UNTESTED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) prlog " [${color_blue}UNTESTED${color_reset}]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) UNTESTED_CASES="$UNTESTED_CASES $CASENO"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) return 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) $UNSUPPORTED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) prlog " [${color_blue}UNSUPPORTED${color_reset}]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) UNSUPPORTED_CASES="$UNSUPPORTED_CASES $CASENO"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) return $UNSUPPORTED_RESULT # depends on use case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) $XFAIL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) prlog " [${color_green}XFAIL${color_reset}]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) XFAILED_CASES="$XFAILED_CASES $CASENO"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) return 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) prlog " [${color_blue}UNDEFINED${color_reset}]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) UNDEFINED_CASES="$UNDEFINED_CASES $CASENO"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) return 1 # this must be a test bug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) # Signal handling for result codes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) SIG_RESULT=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) SIG_BASE=36 # Use realtime signals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) SIG_PID=$$
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) exit_pass () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) SIG_FAIL=$((SIG_BASE + FAIL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) exit_fail () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) trap 'SIG_RESULT=$FAIL' $SIG_FAIL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) SIG_UNRESOLVED=$((SIG_BASE + UNRESOLVED))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) exit_unresolved () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) kill -s $SIG_UNRESOLVED $SIG_PID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) trap 'SIG_RESULT=$UNRESOLVED' $SIG_UNRESOLVED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) SIG_UNTESTED=$((SIG_BASE + UNTESTED))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) exit_untested () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) kill -s $SIG_UNTESTED $SIG_PID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) trap 'SIG_RESULT=$UNTESTED' $SIG_UNTESTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) SIG_UNSUPPORTED=$((SIG_BASE + UNSUPPORTED))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) exit_unsupported () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) kill -s $SIG_UNSUPPORTED $SIG_PID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) trap 'SIG_RESULT=$UNSUPPORTED' $SIG_UNSUPPORTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) SIG_XFAIL=$((SIG_BASE + XFAIL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) exit_xfail () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) kill -s $SIG_XFAIL $SIG_PID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) trap 'SIG_RESULT=$XFAIL' $SIG_XFAIL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) __run_test() { # testfile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) # setup PID and PPID, $$ is not updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) (cd $TRACING_DIR; read PID _ < /proc/self/stat; set -e; set -x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) checkreq $1; initialize_ftrace; . $1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) [ $? -ne 0 ] && kill -s $SIG_FAIL $SIG_PID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) # Run one test case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) run_test() { # testfile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) local testname=`basename $1`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) testcase $1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) if [ ! -z "$LOG_FILE" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) local testlog=`mktemp $LOG_DIR/${CASENO}-${testname}-log.XXXXXX`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) local testlog=/proc/self/fd/1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) export TMPDIR=`mktemp -d /tmp/ftracetest-dir.XXXXXX`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) export FTRACETEST_ROOT=$TOP_DIR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) echo "execute$INSTANCE: "$1 > $testlog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) SIG_RESULT=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) if [ $VERBOSE -eq -1 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) __run_test $1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) elif [ -z "$LOG_FILE" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) __run_test $1 2>&1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) elif [ $VERBOSE -ge 3 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) __run_test $1 | tee -a $testlog 2>&1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) elif [ $VERBOSE -eq 2 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) __run_test $1 2>> $testlog | tee -a $testlog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) __run_test $1 >> $testlog 2>&1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) eval_result $SIG_RESULT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) if [ $? -eq 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) # Remove test log if the test was done as it was expected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) [ $KEEP_LOG -eq 0 -a ! -z "$LOG_FILE" ] && rm $testlog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) [ $VERBOSE -eq 1 -o $VERBOSE -eq 2 ] && catlog $testlog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) TOTAL_RESULT=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) rm -rf $TMPDIR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) # load in the helper functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) . $TEST_DIR/functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) # Main loop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) for t in $TEST_CASES; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) run_test $t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) if [ $STOP_FAILURE -ne 0 -a $TOTAL_RESULT -ne 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) echo "A failure detected. Stop test."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) # Test on instance loop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) INSTANCE=" (instance) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) for t in $TEST_CASES; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) test_on_instance $t || continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) SAVED_TRACING_DIR=$TRACING_DIR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) export TRACING_DIR=`mktemp -d $TRACING_DIR/instances/ftracetest.XXXXXX`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) run_test $t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) rmdir $TRACING_DIR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) TRACING_DIR=$SAVED_TRACING_DIR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) if [ $STOP_FAILURE -ne 0 -a $TOTAL_RESULT -ne 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) echo "A failure detected. Stop test."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) (cd $TRACING_DIR; initialize_ftrace) # for cleanup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) prlog ""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) prlog "# of passed: " `echo $PASSED_CASES | wc -w`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) prlog "# of failed: " `echo $FAILED_CASES | wc -w`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) prlog "# of unresolved: " `echo $UNRESOLVED_CASES | wc -w`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) prlog "# of untested: " `echo $UNTESTED_CASES | wc -w`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) prlog "# of unsupported: " `echo $UNSUPPORTED_CASES | wc -w`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) prlog "# of xfailed: " `echo $XFAILED_CASES | wc -w`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) prlog "# of undefined(test bug): " `echo $UNDEFINED_CASES | wc -w`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) cleanup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) # if no error, return 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) exit $TOTAL_RESULT