ltp-ddt lmbench

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 fmsh-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就被覆盖了


转载于:https://www.cnblogs.com/idyllcheung/p/10867550.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值