diff --git a/conf/functional/unixbench-v5.1.3-in-vm.conf b/conf/functional/unixbench-v5.1.3-in-vm.conf new file mode 100644 index 0000000000000000000000000000000000000000..ba081fd9a11ff481de000f00ae3217408fb05a3b --- /dev/null +++ b/conf/functional/unixbench-v5.1.3-in-vm.conf @@ -0,0 +1,2 @@ +vm_cfg +4c16g diff --git a/lib/vm.sh b/lib/vm.sh new file mode 100644 index 0000000000000000000000000000000000000000..1e87213650178fa62df9906c5a29797edb1708a4 --- /dev/null +++ b/lib/vm.sh @@ -0,0 +1,63 @@ +# install qemu and libvirt +setup_qemu_env() +{ + logger "yum -y install qemu-kvm qemu-img libvirt" + logger "systemctl start libvirtd" + logger "systemctl status libvirtd" +} + +# download vm image +fetch_vm_image() +{ + vm_image_dir="/tmp/vm" + [ -d "$vm_image_dir" ] || mkdir -p $vm_image_dir + + echo "VM_IMAGE: $VM_IMAGE" + [ -f "$VM_IMAGE" ] && return 0 + [ -n "$VM_IMAGE" ] || die "VM_IMAGE is not defined!" + vm_image="$vm_image_dir/$(basename $VM_IMAGE)" + [ -f "$vm_image" ] && return 0 + if [[ "$VM_IMAGE" =~ ^http ]]; then + cd $vm_image_dir + logger "wget $VM_IMAGE" + else + echo "Can't download vm image" + fi +} + +# creeate qemu vm +create_qemu_vm() +{ + [ -n "$VM_IMAGE" ] || die "VM_IMAGE is not defined!" + if [ -f "$VM_IMAGE" ]; then + vm_image_base="$VM_IMAGE" + else + vm_image_base="/tmp/vm/$(basename $VM_IMAGE)" + fi + + vm_name=${1:-"vm-test"} + vm_image_type=${VM_IMAGE_TYPE:-"qcow2"} + vm_image_size=${VM_IMAGE_SIZE:-"40G"} + vm_image="$vm_image_dir/${vm_name}.${vm_image_type}" + [ -f "$vm_image" ] && rm -f $vm_image + logger "qemu-img create -f $vm_image_type -b $vm_image_base -F $vm_image_type $vm_image $vm_image_size" + + [ -n "$vm_cfg" ] || vm_cfg="4c16g" + vm_cfg_template="$TONE_ROOT/lib/vm/vm-$(uname -m)-${vm_cfg}.xml" + [ -f "$vm_cfg_template" ] || die "No such file: $vm_cfg_template" + vm_cfg="$TONE_BM_RUN_DIR/${vm_name}.xml" + cp -f $vm_cfg_template $vm_cfg + sed -i "s|VM_IMAGE|$vm_image|" $vm_cfg + qemu_bin=$(which qemu-kvm 2>/dev/null) + [ -n "$qemu_bin" ] || { + [ -f /usr/libexec/qemu-kvm ] && qemu_bin="/usr/libexec/qemu-kvm" + } + sed -i "s|QEMU_KVM_BIN|$qemu_bin|" $vm_cfg + logger "virsh create $vm_cfg" +} + +destroy_qemu_vm() +{ + vm_name=${1:-"vm-test"} + logger "virsh destroy $vm_name" +} diff --git a/lib/vm/vm-x86_64-4c16g.xml b/lib/vm/vm-x86_64-4c16g.xml new file mode 100644 index 0000000000000000000000000000000000000000..9cc21b13561e716bada516fcf2c95d7dcc3e5aad --- /dev/null +++ b/lib/vm/vm-x86_64-4c16g.xml @@ -0,0 +1,51 @@ + + vm-test + 16777216 + 4 + + + + + hvm + + + + + + + + + + + + destroy + restart + restart + + + QEMU_KVM_BIN + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/iozone-ceprei/install.sh b/tests/iozone-ceprei/install.sh index bf41613f0641c794033f2906f25c5477f431cf44..dd9d1812b879ab39e3f9512425cdeef6bf5ccf63 100644 --- a/tests/iozone-ceprei/install.sh +++ b/tests/iozone-ceprei/install.sh @@ -18,11 +18,7 @@ build() tar -xvf iozone3_430.tar cd ./iozone3_430/src/current pwd - if [[ $(/bin/arch) == 'x86_64' ]];then - make linux-AMD64 - else - make linux - fi + make CFLAGS=-fcommon linux } install() diff --git a/tests/redis/install.sh b/tests/redis/install.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf5de1b52cc0feb90d25855308a66e6f09b9021e --- /dev/null +++ b/tests/redis/install.sh @@ -0,0 +1,19 @@ +#!/bin/bash +WEB_URL="https://ostester.oss-cn-hangzhou.aliyuncs.com/benchmarks/redis-7.2.zip" + + +build() +{ + cp -r $TONE_BM_CACHE_DIR/redis-7.2.zip $TONE_BM_RUN_DIR + cd $TONE_BM_RUN_DIR + unzip redis-7.2.zip + cd $TONE_BM_RUN_DIR/redis-7.2 + make +} + + +install() +{ + make PREFIX=$TONE_BM_RUN_DIR/redis-7.2 install + cd $TONE_BM_RUN_DIR/redis-7.2/bin && ./redis-server +} diff --git a/tests/redis/run.sh b/tests/redis/run.sh new file mode 100644 index 0000000000000000000000000000000000000000..863b518525dc0af94913215e99897740eab0cabc --- /dev/null +++ b/tests/redis/run.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +server_cmd="redis-benchmark -n 1000000 -q" + + +setup() +{ + export PATH="$TONE_BM_RUN_DIR"/redis-7.2/bin:$PATH + firewalld_status_flag=0 + firewalld_status=`systemctl status firewalld` + if [[ $firewalld_status =~ "active" ]];then + systemctl stop firewalld + firewalld_status_flag=1 + fi +} + +run() +{ + echo "start test redis" + ${server_cmd} | tee 2>&1 "$TONE_CURRENT_RESULT_DIR"/${testsuite}.json + echo "redis has finished" +} + + +parse() +{ + grep "PING_INLINE" |awk -F " " '{print $2}' + grep "PING_BULK" |awk -F " " '{print $2}' + grep "^SET" |awk -F " " '{print $2}' + grep "GET" |awk -F " " '{print $2}' + grep "INCR" |awk -F " " '{print $2}' + grep "^LPUSH:" |awk -F " " '{print $2}' + grep "LPOP" |awk -F " " '{print $2}' + grep "SADD" |awk -F " " '{print $2}' + grep "SPOP" |awk -F " " '{print $2}' + grep "LPUSH " |awk -F " " '{print $6}' + grep "LRANGE_100" |awk -F " " '{print $5}' + grep "LRANGE_300" |awk -F " " '{print $5}' + grep "LRANGE_500" |awk -F " " '{print $5}' + grep "LRANGE_600" |awk -F " " '{print $5}' + grep "MSET" |awk -F " " '{print $4}' +} + +teardown() +{ + cd $TONE_BM_RUN_DIR/redis-7.2 + sleep 2 + if [ $firewalld_status_flag -eq 1 ];then + systemctl start firewalld + fi + make clean + ps -ef |grep redis |grep -v "color"|awk -F " " '{print $2}' |xargs kill -9 + rm -rf $TONE_BM_RUN_DIR/redis-7.2 +} + diff --git a/tests/unixbench-v5.1.3-in-vm/README.md b/tests/unixbench-v5.1.3-in-vm/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5ead6a42a3701a0a06f025be949e082f67657289 --- /dev/null +++ b/tests/unixbench-v5.1.3-in-vm/README.md @@ -0,0 +1,50 @@ +# UnixBench + +## 中文 + +**UnixBench**旨在提供一个基本的类Unix系统的性能指标。 + +### 相关链接 +https://github.com/kdlucas/byte-unixbench + +## 使用说明 + +使用过程中遇到无法获取github上的仓库时,可以修改`install.sh`中`GIT_URL`为国内仓库地址或私有仓库地址,如: + +https://gitee.com/mirrors_aliyun/byte-unixbench.git + +### 参数说明 + +unixbench.conf参数: +* test: 测试名称 +* nr_task: 线程数量 +* iterations: 运行次数 + +### 结果 + +* score: 性能测试得分 + +## English + +The purpose of UnixBench is to provide a basic indicator of the performance of a Unix-like system; + +### Homepage + +https://github.com/kdlucas/byte-unixbench + +### Notes + +If your testbed can not get the repository from the Github, you can modify the `GIT_URL` in `install.sh` to a domestic repository or private repository. such as: + +https://gitee.com/mirrors_aliyun/byte-unixbench.git + +### Parameters: + +unixbench.conf: +* test: test name +* nr_task: thread numbers +* iterations: run times + +### Result + +* score: performance score \ No newline at end of file diff --git a/tests/unixbench-v5.1.3-in-vm/install.sh b/tests/unixbench-v5.1.3-in-vm/install.sh new file mode 120000 index 0000000000000000000000000000000000000000..3ef2519a5f19c33c1e0d66990584e19c2f5d73d3 --- /dev/null +++ b/tests/unixbench-v5.1.3-in-vm/install.sh @@ -0,0 +1 @@ +../unixbench-v5.1.3/install.sh \ No newline at end of file diff --git a/tests/unixbench-v5.1.3-in-vm/parse.awk b/tests/unixbench-v5.1.3-in-vm/parse.awk new file mode 120000 index 0000000000000000000000000000000000000000..b9dd580967e4479a030643c12f2546ba8bdf976c --- /dev/null +++ b/tests/unixbench-v5.1.3-in-vm/parse.awk @@ -0,0 +1 @@ +../unixbench-v5.1.3/parse.awk \ No newline at end of file diff --git a/tests/unixbench-v5.1.3-in-vm/patches b/tests/unixbench-v5.1.3-in-vm/patches new file mode 120000 index 0000000000000000000000000000000000000000..fd52df3db44c559adf261e3ca943da9def1b248f --- /dev/null +++ b/tests/unixbench-v5.1.3-in-vm/patches @@ -0,0 +1 @@ +../unixbench-v5.1.3/patches/ \ No newline at end of file diff --git a/tests/unixbench-v5.1.3-in-vm/run.sh b/tests/unixbench-v5.1.3-in-vm/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..0d180d89bab2b52bb0d29a278c8f2e69d3806e20 --- /dev/null +++ b/tests/unixbench-v5.1.3-in-vm/run.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# - vm_cfg + +. $TONE_ROOT/lib/common.sh +. $TONE_ROOT/lib/vm.sh + +setup() +{ + setup_qemu_env + fetch_vm_image + create_qemu_vm + #TBD: setup host ssh key to vm +} + +run() +{ + echo ""vm_cfg: $vm_cfg + #TBD: copy tone-cli to vm, then run unixbench in vm +} + +teardown() +{ + destroy_qemu_vm +} + +parse() +{ + $TONE_BM_SUITE_DIR/parse.awk +}