ltp-ddt lmbench
阅读原文时间:2023年07月15日阅读:2

ltp-ddt lmbench

args=''

# getopt fails, set help option
if [ $? -ne 0 ] ; then
        H="help";
fi

# update the refined command line argumetn list
eval set -- $args

# parse the command line argument and update the shell variables
# so that functions above can use them

for i in $@ ; do
case "$i" in

-h) shift; H="help" ;;
        --help) shift; H="help" ;;
esac
done

# update the refined command line argumetn list once more
eval set -- $args

# call appropriate functions
if [ "$H" = "help" ] ;  then
        $H
else
        lmbench_tests
        print_summary
    if [ $FAIL_COUNT > 0 ]; then
            exit $FAIL_COUNT
    else
            exit 0
    fi
fi

./runltp -P fmxx-psoc-db -f ddt/lmbench

在runtest/ddt/lmbench中将
# @name LMBENCH_TESTS
# @desc Run all LMBENCH tests
# @requires armv*

LMBENCH_L_PERF_0001 lmbench_tests_script.sh
改为
# @name LMBENCH_TESTS
# @desc Run all LMBENCH tests
# @requires armv*

LMBENCH_L_PERF_0001 lmbench_tests_script.sh -h

发现运行后并没有运行help
sh -x 单独运行 lmbench_tests_script.sh -h
发现eval set -- $args 这句有嫌疑

见一段code
test.sh
#!/bin/sh
set -- a b c
echo "\$1=$1"
echo "\$2=$2"
echo "\$3=$3"

test.sh
输出
$1=a
$2=b
$3=c

test.sh 1 2 3
输出
$1=a
$2=b
$3=c

所以set -- 就是用后面的参数覆盖原位置的参数

eval set -- $args == eval set -- '',h就被覆盖了

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章