From aec5a328a237b6f524b52e2e6dae4c19901b8b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=A4=84?= Date: Fri, 17 Dec 2021 15:09:48 +0800 Subject: [PATCH 1/9] Add tpc-e benchmark --- conf/performance/tpc-e.conf | 4 +++ tests/tpc-e/README.md | 26 +++++++++++++++ tests/tpc-e/install.sh | 18 +++++++++++ tests/tpc-e/run.sh | 63 +++++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 conf/performance/tpc-e.conf create mode 100644 tests/tpc-e/README.md create mode 100644 tests/tpc-e/install.sh create mode 100644 tests/tpc-e/run.sh diff --git a/conf/performance/tpc-e.conf b/conf/performance/tpc-e.conf new file mode 100644 index 0000000..34e0ba2 --- /dev/null +++ b/conf/performance/tpc-e.conf @@ -0,0 +1,4 @@ +database concurrent duration +postgresql 30 120 +mysql 30 120 +oracle 30 120 \ No newline at end of file diff --git a/tests/tpc-e/README.md b/tests/tpc-e/README.md new file mode 100644 index 0000000..9999b82 --- /dev/null +++ b/tests/tpc-e/README.md @@ -0,0 +1,26 @@ +# TPC-E Benchmark + +## Description +TPC-e is used to test the benchmark of databases, currently, it support mysql, postgresql and oracle. + +## Homepage + +## Version + +## Category +performance + +## Parameters +- concurrent: concurrent connection +- duration: times to be run + +## Results +tpse: xxx + +## Manual Run + +**Offline:** + +1. copy `tpc-ebenchmark` to `$TONE_ROOT/cache/tpc-e/` +2. prepare `/etc/odbc.ini` +3. run: `tone run tpc-e:database=postgresql,concurrent=30,duration=120` \ No newline at end of file diff --git a/tests/tpc-e/install.sh b/tests/tpc-e/install.sh new file mode 100644 index 0000000..0c1cba1 --- /dev/null +++ b/tests/tpc-e/install.sh @@ -0,0 +1,18 @@ +DEP_PKG_LIST="cmake python3 R python3-pip python3-devel postgresql-odbc gcc gcc-c++ unixODBC unixODBC-devel libiodbc expect" + +extract_src() +{ + logger yum update -y anolis-repos + logger yum install -y epel-release +} + +build() +{ + echo "Nothing to build ..." +} + +install() +{ + echo "Just copy file to run directory" + cp -r $TONE_BM_CACHE_DIR/tpc-ebenchmark $TONE_BM_RUN_DIR/tpc-ebenchmark +} diff --git a/tests/tpc-e/run.sh b/tests/tpc-e/run.sh new file mode 100644 index 0000000..6c23014 --- /dev/null +++ b/tests/tpc-e/run.sh @@ -0,0 +1,63 @@ +#!/bin/bash +. $TONE_ROOT/lib/common.sh +. $TONE_ROOT/lib/testinfo.sh + +run() { + echo "install rpy2 via pip3" + logger pip3 install -U rpy2 + echo "Check odbcinst informations" + logger odbcinst -j + +# if [ ! -n "$DBSERVER" ]; then +# export DBSERVER=127.0.0.1 +# fi +# +# if [ ! -n "$DBPASSWORD" ]; then +# export DBPASSWORD=postgres +# fi + + if [ ! -n "$ODBC" ]; then + export ODBC=pg + fi + + echo "Build tpc-e benchmark" + + if [ "$database" = "postgresql" ]; then + build_params="-DUSE_BM=1 -DDBMS=$ODBC" + elif [ "$database" = "oracle" ]; then + build_params="-DORA=1 -DDBMS=$ODBC" + elif [ "$database" = "mysql" ]; then + build_params="-DMYSQL=1 -DDBMS=$ODBC" + else + echo "Not supported database type" + fi + + cd tpc-ebenchmark + logger cmake $build_params + mkdir bin + cd egen/prj + logger make + cd ../../ + logger make && make install + +# echo "Generate databases" +# cd egen/ +# logger ./bin/EGenLoader +# +# echo "Create datas" +# cd ../ +# cd createDB/postgresql +# export PGPASSWORD=$DBPASSWORD +# logger psql -U postgres -h $DBSERVER -f 1_create_table.sql +# logger psql -U postgres -h $DBSERVER -f 2_load_data.sql +# logger psql -U postgres -h $DBSERVER -f 3_create_index.sql + + echo "Run benchmark" + cd ../../ + rm -rf tmp/results + logger tpce-run-workload -a $database -n $ODBC -c 5000 -t 5000 -d $duration -u $concurrent -f 500 -w 300 -e 30000 -g 30010 -z 1 -p 0 -v 30 -i egen -o tmp/results +} + +parse() { + echo `grep "tpse" tmp/results/data/00.txt | sed 's/(/\ /g' | awk '{print $1}' | sed 's/=/: /g'` +} -- Gitee From ec212c590cb76508bf269725da872987730375bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=A4=84?= Date: Fri, 17 Dec 2021 15:28:43 +0800 Subject: [PATCH 2/9] update readme for run tpc-e benchmark --- tests/tpc-e/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/tpc-e/README.md b/tests/tpc-e/README.md index 9999b82..8ca596c 100644 --- a/tests/tpc-e/README.md +++ b/tests/tpc-e/README.md @@ -23,4 +23,6 @@ tpse: xxx 1. copy `tpc-ebenchmark` to `$TONE_ROOT/cache/tpc-e/` 2. prepare `/etc/odbc.ini` -3. run: `tone run tpc-e:database=postgresql,concurrent=30,duration=120` \ No newline at end of file +3. fetch: `tone fetch tpc-e` +4. install: `tone install tpc-e` +5. run: `tone run tpc-e:database=postgresql,concurrent=30,duration=120` \ No newline at end of file -- Gitee From 2473a3cca16848d866371833bfcef78f3d9e2120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=A4=84?= Date: Tue, 28 Dec 2021 12:52:12 +0800 Subject: [PATCH 3/9] update tpc scripts --- conf/performance/tpc-e.conf | 10 +++--- tests/tpc-e/install.sh | 23 ++++++++----- tests/tpc-e/run.sh | 67 ++++++++++++++++--------------------- 3 files changed, 49 insertions(+), 51 deletions(-) diff --git a/conf/performance/tpc-e.conf b/conf/performance/tpc-e.conf index 34e0ba2..f3828f4 100644 --- a/conf/performance/tpc-e.conf +++ b/conf/performance/tpc-e.conf @@ -1,4 +1,6 @@ -database concurrent duration -postgresql 30 120 -mysql 30 120 -oracle 30 120 \ No newline at end of file +database concurrent customer duration +postgresql 30 NA 120 +postgresql 10 5000 600 +postgresql 30 10000 120 +mysql 30 NA 120 +oracle 30 NA 120 \ No newline at end of file diff --git a/tests/tpc-e/install.sh b/tests/tpc-e/install.sh index 0c1cba1..5a7aaaa 100644 --- a/tests/tpc-e/install.sh +++ b/tests/tpc-e/install.sh @@ -1,10 +1,12 @@ -DEP_PKG_LIST="cmake python3 R python3-pip python3-devel postgresql-odbc gcc gcc-c++ unixODBC unixODBC-devel libiodbc expect" +GIT_URL="http://192.168.16.26/chenshuo/tpc-ebenchmark.git" -extract_src() -{ - logger yum update -y anolis-repos - logger yum install -y epel-release -} +DEP_PKG_LIST="cmake python3 R python3-pip python3-devel gcc gcc-c++ expect" + +#extract_src() +#{ +# logger yum update -y anolis-repos +# logger yum install -y epel-release +#} build() { @@ -13,6 +15,11 @@ build() install() { - echo "Just copy file to run directory" - cp -r $TONE_BM_CACHE_DIR/tpc-ebenchmark $TONE_BM_RUN_DIR/tpc-ebenchmark + echo "Just copy file to /opt/tpc-ebenchmark" + if [ -d "/opt/tpc-ebenchmark" ]; then + rm -rf /opt/tpc-ebenchmark + fi + + mkdir /opt/tpc-ebenchmark + cp -r * /opt/tpc-ebenchmark/ } diff --git a/tests/tpc-e/run.sh b/tests/tpc-e/run.sh index 6c23014..d487017 100644 --- a/tests/tpc-e/run.sh +++ b/tests/tpc-e/run.sh @@ -5,59 +5,48 @@ run() { echo "install rpy2 via pip3" logger pip3 install -U rpy2 - echo "Check odbcinst informations" - logger odbcinst -j - -# if [ ! -n "$DBSERVER" ]; then -# export DBSERVER=127.0.0.1 -# fi -# -# if [ ! -n "$DBPASSWORD" ]; then -# export DBPASSWORD=postgres -# fi - - if [ ! -n "$ODBC" ]; then - export ODBC=pg - fi - echo "Build tpc-e benchmark" + echo "Install unixODBC-2.3.9" + cd /opt/tpc-ebenchmark/utils/unixodbc + logger ./odbc-install.sh + source ./odbc-config.sh + echo "Prep odbc.ini" if [ "$database" = "postgresql" ]; then - build_params="-DUSE_BM=1 -DDBMS=$ODBC" + echo "[postgresql]" > /opt/unixodbc/etc/odbc.ini + echo "Driver = PostgreSQL" >> /opt/unixodbc/etc/odbc.ini + echo "Database = tpce" >> /opt/unixodbc/etc/odbc.ini + echo "Servername = $DBSERVER" >> /opt/unixodbc/etc/odbc.ini + echo "UserName = postgres" >> /opt/unixodbc/etc/odbc.ini + echo "Password = postgres" >> /opt/unixodbc/etc/odbc.ini + echo "Port = 5432" >> /opt/unixodbc/etc/odbc.ini elif [ "$database" = "oracle" ]; then - build_params="-DORA=1 -DDBMS=$ODBC" + echo "Prep oracle odbc.ini" elif [ "$database" = "mysql" ]; then - build_params="-DMYSQL=1 -DDBMS=$ODBC" + echo "Prep mysql odbc.ini" else echo "Not supported database type" fi - cd tpc-ebenchmark - logger cmake $build_params - mkdir bin - cd egen/prj - logger make - cd ../../ - logger make && make install + echo "Check odbcinst informations" + logger odbcinst -j -# echo "Generate databases" -# cd egen/ -# logger ./bin/EGenLoader -# -# echo "Create datas" -# cd ../ -# cd createDB/postgresql -# export PGPASSWORD=$DBPASSWORD -# logger psql -U postgres -h $DBSERVER -f 1_create_table.sql -# logger psql -U postgres -h $DBSERVER -f 2_load_data.sql -# logger psql -U postgres -h $DBSERVER -f 3_create_index.sql + echo "Build tpc-e benchmark" + cd /opt/tpc-ebenchmark + logger ./build.sh -t $database + if [ ! -n "$customer" ]; then + customer="5000" + fi echo "Run benchmark" - cd ../../ + cd /opt/tpc-ebenchmark rm -rf tmp/results - logger tpce-run-workload -a $database -n $ODBC -c 5000 -t 5000 -d $duration -u $concurrent -f 500 -w 300 -e 30000 -g 30010 -z 1 -p 0 -v 30 -i egen -o tmp/results + # logger tpce-run-workload -a $database -n $database -c 5000 -t 5000 -d $duration -u $concurrent -f 500 -w 300 -e 30000 -g 30010 -z 1 -p 0 -v 30 -i -i /opt/tpc-ebenchmark/egen + logger logger tpce-run-workload -a $database -n $database -c $customer -d $duration -u $concurrent -i /opt/tpc-ebenchmark/egen + result_dir=`ls -t /opt/tpc-ebenchmark/tmp/|head -n1|awk '{print $0}'` + cp -r /opt/tpc-ebenchmark/tmp/$result_dir/* $TONE_CURRENT_RESULT_DIR } parse() { - echo `grep "tpse" tmp/results/data/00.txt | sed 's/(/\ /g' | awk '{print $1}' | sed 's/=/: /g'` + echo `grep "tpse" $TONE_CURRENT_RESULT_DIR/data/00.txt | sed 's/(/\ /g' | awk '{print $1}' | sed 's/=/: /g'` } -- Gitee From ffe4b34eb1cf581855219298adabae918e83e775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=A4=84?= Date: Tue, 28 Dec 2021 17:24:11 +0800 Subject: [PATCH 4/9] Fix python verion issue and add tpc-h --- conf/performance/tpc-h.conf | 2 ++ tests/tpc-h/install.sh | 14 ++++++++++++++ tests/tpc-h/run.sh | 28 ++++++++++++++++++++++++++++ tone | 2 +- 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 conf/performance/tpc-h.conf create mode 100644 tests/tpc-h/install.sh create mode 100644 tests/tpc-h/run.sh diff --git a/conf/performance/tpc-h.conf b/conf/performance/tpc-h.conf new file mode 100644 index 0000000..d28e347 --- /dev/null +++ b/conf/performance/tpc-h.conf @@ -0,0 +1,2 @@ +database SF N +postgresql 1 10 \ No newline at end of file diff --git a/tests/tpc-h/install.sh b/tests/tpc-h/install.sh new file mode 100644 index 0000000..d835f2d --- /dev/null +++ b/tests/tpc-h/install.sh @@ -0,0 +1,14 @@ +GIT_URL="http://192.168.16.26/chenshuo/tpc-hbenchmark.git" + +DEP_PKG_LIST="gcc" + +build() +{ + echo "Nothing to build ..." +} + +install() +{ + echo "Copy code to run path" + cp -r * $TONE_BM_RUN_DIR/ +} diff --git a/tests/tpc-h/run.sh b/tests/tpc-h/run.sh new file mode 100644 index 0000000..6048436 --- /dev/null +++ b/tests/tpc-h/run.sh @@ -0,0 +1,28 @@ +#!/bin/bash +. $TONE_ROOT/lib/common.sh +. $TONE_ROOT/lib/testinfo.sh + +run() { + echo "run power.sh" + chown -R postgres:postgres tpch + chmod 777 tpch/power.sh + chmod 777 tpch/throughput.sh + #logger runuser -l postgres -c '$TONE_BM_RUN_DIR/tpch/power.sh $SF power.log' + + echo "run throughput.sh" + #logger runuser -l postgres -c '$TONE_BM_RUN_DIR/tpch/throughput.sh $SF $N throughput.log' + + echo "Copy result to $TONE_CURRENT_RESULT_DIR" + cp $TONE_BM_RUN_DIR/power.log $TONE_CURRENT_RESULT_DIR/ + cp $TONE_BM_RUN_DIR/throughput.log $TONE_CURRENT_RESULT_DIR/ +} + +parse() { + tpchpower=`grep "tpchpower" $TONE_CURRENT_RESULT_DIR/power.log | awk -F "=" '{print $2}'` + tpchthroughput=`grep "tpchthroughput" $TONE_CURRENT_RESULT_DIR/throughput.log | awk -F "=" '{print $2}'` + + echo "Power: $tpchpower" + echo "Throughput: $tpchthroughput" + qphh=`awk 'BEGIN{printf sqrt('$tpchpower'*'$tpchthroughput')}'` + echo "QphH: $qphh" +} \ No newline at end of file diff --git a/tone b/tone index 0909330..f900656 100755 --- a/tone +++ b/tone @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from core.tone import run -- Gitee From 92fb206b8b85beb9e606a657b9d4a6ba73f2777b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=A4=84?= Date: Tue, 28 Dec 2021 17:51:32 +0800 Subject: [PATCH 5/9] add python3-devel for dep-pkg --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 65049db..b6d1414 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ install: - yum install -y wget zip unzip git gcc + yum install -y wget zip unzip git gcc python3-devel if [ -h /usr/local/bin/tone ]; then \ rm -rf /usr/local/bin/tone; \ fi -- Gitee From ee72ad8c3628513cff0c92d4587a07c953e18c8f Mon Sep 17 00:00:00 2001 From: Jacob Qi <10035767+jacob-qi@user.noreply.gitee.com> Date: Wed, 5 Jan 2022 08:51:58 +0000 Subject: [PATCH 6/9] !9 sync archive logic changes * !8 change archive logic to add job.yaml * !7 Fix sysbench build failed * Fix xxd missing issue * !6 Add kernel-selftests test suite * Add kernel-selftests test suite --- conf/functional/kernel-selftests.conf | 0 core/modules/subcommand/run/Archive.py | 81 +++++++++++++++++++ requirements.txt | 3 +- tests/kernel-selftests/README.md | 42 ++++++++++ tests/kernel-selftests/install.sh | 49 +++++++++++ tests/kernel-selftests/parse.py | 32 ++++++++ .../kernel-selftests/patch/4.19/pmtu.sh.patch | 12 +++ .../kernel-selftests/patch/5.10/mincore.patch | 11 +++ .../kernel-selftests/patch/5.10/pmtu.sh.patch | 12 +++ tests/kernel-selftests/run.sh | 12 +++ tests/sysbench/install.sh | 2 +- 11 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 conf/functional/kernel-selftests.conf create mode 100644 tests/kernel-selftests/README.md create mode 100644 tests/kernel-selftests/install.sh create mode 100755 tests/kernel-selftests/parse.py create mode 100644 tests/kernel-selftests/patch/4.19/pmtu.sh.patch create mode 100644 tests/kernel-selftests/patch/5.10/mincore.patch create mode 100644 tests/kernel-selftests/patch/5.10/pmtu.sh.patch create mode 100644 tests/kernel-selftests/run.sh diff --git a/conf/functional/kernel-selftests.conf b/conf/functional/kernel-selftests.conf new file mode 100644 index 0000000..e69de29 diff --git a/core/modules/subcommand/run/Archive.py b/core/modules/subcommand/run/Archive.py index 74a822b..b1dcd47 100644 --- a/core/modules/subcommand/run/Archive.py +++ b/core/modules/subcommand/run/Archive.py @@ -4,7 +4,10 @@ import os import subprocess +import yaml +import time from core.module_interfaces import TESTMODULE +from core.utils.tests import read_conf from core.utils.log import logger @@ -12,6 +15,7 @@ class Archive(TESTMODULE): def run(self, subflow): if subflow.config.subcommand != 'archive': return + print("Archiving .... ") archive_dir = ( #'test_cache_path', @@ -30,6 +34,12 @@ class Archive(TESTMODULE): ) self.remove_file(tarball) + # prep job.yaml + all_test_conf = self.get_all_test_conf(subflow.config.test_conf_path) + job_file = os.path.join(subflow.config.tone_path, "job.yaml") + job = self.get_job(test_result_path=subflow.config.test_result_path, all_test_conf=all_test_conf, name="") + self.write_to_yaml(job, job_file=job_file) + target_dirs = [] if not subflow.config.parser['results']: for d in subflow.config.frame_tool: @@ -41,6 +51,7 @@ class Archive(TESTMODULE): print(subflow.config[d]) target_dirs.append(subflow.config[d]) target_dirs = [i for i in target_dirs if os.path.exists(i)] + target_dirs.append(job_file) self.create_tar(tarball, target_dirs) print( "Done\n" @@ -85,3 +96,73 @@ class Archive(TESTMODULE): cmd.append(os.path.basename(src)) logger.debug(" ".join(cmd)) subprocess.check_call(cmd) + + def is_result_exist(self, test_result_path, test_conf): + suite, conf = test_conf.split(":") + if "=" not in conf: + _result_path = conf + else: + _result_path = "-".join([x.split("=")[1] for x in conf.split(",")]) + _path = os.path.join(suite, _result_path) + return os.path.exists(os.path.join(test_result_path, _path)) + + def get_job(self, test_result_path, all_test_conf, name=""): + if not name: + name = self.gen_job_name() + job = {"name": name, "test_config": []} + ip = self.get_eth0_ip() + test_suites = {} + for test_conf in all_test_conf: + if self.is_result_exist(test_result_path, test_conf): + suite, conf = test_conf.split(":") + if suite not in test_suites: + test_suites[suite] = [conf] + else: + test_suites[suite].append(conf) + + for suite in test_suites: + test_suite = {"test_suite": suite, "cases": []} + for case in test_suites[suite]: + test_case = {"test_case": case, "server": {"ip": ip}} + test_suite["cases"].append(test_case) + job["test_config"].append(test_suite) + return job + + def write_to_yaml(self, job, job_file): + with open(job_file, "w") as f: + f.write(yaml.dump(job)) + + def get_eth0_ip(self): + try: + res = os.popen("ip add show dev eth0 | grep inet").read() + return res.split()[1].split("/")[0] + except: + return None + + def gen_job_name(self): + return "offline_job_" + str(time.strftime("%Y%m%d_%H-%M-%S", time.localtime())) + + def get_all_test_conf(self, conf_path): + test_conf = [] + if not os.path.exists(conf_path): + return None + posible_category = [ + 'functional', + 'performance', + 'stress', + ] + for category in posible_category: + curr_path = os.path.join(conf_path, category) + if not os.path.exists(curr_path): + continue + configs = os.listdir(curr_path) + for c in configs: + if not c.endswith(".conf"): + continue + suite = c.split(".")[0] + conf_file = os.path.join(curr_path, c) + value, indvalue, fields = read_conf(conf_file, suite=suite) + for i in indvalue: + if "testconf" in i: + test_conf.append(i["testconf"]) + return test_conf diff --git a/requirements.txt b/requirements.txt index 0b574b5..e749cd6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -psutil \ No newline at end of file +psutil +pyyaml \ No newline at end of file diff --git a/tests/kernel-selftests/README.md b/tests/kernel-selftests/README.md new file mode 100644 index 0000000..1802f6b --- /dev/null +++ b/tests/kernel-selftests/README.md @@ -0,0 +1,42 @@ +# kernel-selftests +### Description +The kernel contains a set of “self tests” under the tools/testing/selftests/ directory. + + +### Homepage +[cloud-kernel](https://gitee.com/anolis/cloud-kernel) + +### Version +kernel_version + +### Parameters +default + + +### Results +``` +rseq.basic_percpu_ops_test: PASS +rseq.param_test: PASS +rseq.param_test_benchmark: PASS +rseq.param_test_compare_twice: PASS +rseq.run_param_test.sh: PASS +rtc.rtctest: FAIL +seccomp.seccomp_bpf: PASS +seccomp.seccomp_benchmark: PASS +sgx.test_sgx: FAIL +sigaltstack.sas: PASS +size.get_size: PASS +splice.default_file_splice_read.sh: PASS +static_keys.test_static_keys.sh: SKIP +``` + + +### Manual Run +``` +cd tools/tesing/selftests +make -C ./ +./kselftest_install.sh +cd kselftest_install +./run_kselftest.sh +``` + diff --git a/tests/kernel-selftests/install.sh b/tests/kernel-selftests/install.sh new file mode 100644 index 0000000..7f000c9 --- /dev/null +++ b/tests/kernel-selftests/install.sh @@ -0,0 +1,49 @@ +GIT_URL="https://gitee.com/anolis/cloud-kernel.git" +DEP_PKG_LIST="gcc make bc patch rsync iproute-tc llvm-toolset glibc-static popt-devel libcap-ng-devel libcap-devel fuse-devel fuse numactl-devel elfutils-libelf-devel" + +get_kernel_version() { + version=$(uname -r | awk -F "-" '{print $1}') + echo ${version%.*} +} + +kernel_version=$(get_kernel_version) +kernel_branch="devel-$kernel_version" + +fetch() { + timeout 60m git clone -q --depth 1 -b $kernel_branch $GIT_URL $TONE_BM_CACHE_DIR +} + +build() { + + cd $TONE_BM_CACHE_DIR + patchpath="$TONE_BM_SUITE_DIR/patch/$kernel_version" + + # subcase return code not 0,2 --> exitcode=1 + [ -f $patchpath/pmtu.sh.patch ] && patch -p1 < $patchpath/pmtu.sh.patch + # fix kernel change + [ -f $patchpath/mincore.patch ] && patch -p1 < $patchpath/mincore.patch + + make -C tools/testing/selftests +} + +prepare_skip_list() { + + # skip breakpoints case if arch is x86_64 + [ "$(uname -m)" == "x86_64" ] && skip_test_list="breakpoints" + # skip gpio test if CONFIG_GPIO_MOCKUP is not set + grep CONFIG_GPIO_MOCKUP /boot/config-$(uname -r) | grep -q "is not set" && skip_test_list="$skip_test_list gpio" + # skip dma_heap test if CONFIG_DMABUF_HEAPS is not set + grep CONFIG_DMABUF_HEAPS /boot/config-$(uname -r) | grep -q "is not set" && skip_test_list="$skip_test_list dmabuf-heaps" + echo "the final skip_test_list is : $skip_test_list" + + # skip install test + for test in $skip_test_list; do + sed -i "/$test/ s/^/#/" Makefile + done +} + +install() { + cd $TONE_BM_CACHE_DIR/tools/testing/selftests/ + prepare_skip_list + ./kselftest_install.sh $TONE_BM_RUN_DIR +} diff --git a/tests/kernel-selftests/parse.py b/tests/kernel-selftests/parse.py new file mode 100755 index 0000000..bd60667 --- /dev/null +++ b/tests/kernel-selftests/parse.py @@ -0,0 +1,32 @@ +#!/bin/env python3 +import sys +import re + +def futex_parse(stdin): + for line in stdin: + if re.match(r'(# futex_|# futex.)',line): + subtest=line.split()[1][:-1] + if re.match(r'(.*Arguments:)',line): + subtest = subtest + '.' + line.split(": ")[1].replace(" ", ".").strip() + if re.match(r'(ok )', line): + print('%s.%s: %s' % ('futex', subtest, 'Pass')) + if re.match(r'(not ok )', line): + print('%s.%s: %s' % ('futex', subtest, 'Fail')) + if re.match(r'(TAP version 13)', line): + return + +with sys.stdin as stdin: + for line in stdin: + if re.match(r'(Running tests in)', line): + testname = line.split()[-1] + if ( "futex" == testname.strip() ): + futex_parse(stdin) + if re.match(r'(.*ok |.*not ok ).*selftests.*',line): + subtest = line.split()[-2] + status = line.split()[-1][1:-1] + print('%s.%s: %s' % (testname, subtest, status)) + if re.match(r'(ignored_by_tone )',line): + print('%s: %s' % (line.split()[1], status)) + + + diff --git a/tests/kernel-selftests/patch/4.19/pmtu.sh.patch b/tests/kernel-selftests/patch/4.19/pmtu.sh.patch new file mode 100644 index 0000000..a1c5758 --- /dev/null +++ b/tests/kernel-selftests/patch/4.19/pmtu.sh.patch @@ -0,0 +1,12 @@ +--- a/tools/testing/selftests/net/pmtu.sh 2021-03-08 10:31:54.124009831 +0800 ++++ b/tools/testing/selftests/net/pmtu.sh 2021-03-08 13:18:40.262931438 +0800 +@@ -471,7 +471,8 @@ + err_flush + fi + ) +- [ $? -ne 0 ] && exitcode=1 ++ ret=$? ++ [ $ret -ne 0 -a $ret -ne 2 ] && exitcode=1 + done + + exit ${exitcode} diff --git a/tests/kernel-selftests/patch/5.10/mincore.patch b/tests/kernel-selftests/patch/5.10/mincore.patch new file mode 100644 index 0000000..3a2d558 --- /dev/null +++ b/tests/kernel-selftests/patch/5.10/mincore.patch @@ -0,0 +1,11 @@ +--- a/tools/testing/selftests/mincore/mincore_selftest.c 2021-04-01 10:58:09.048497815 +0800 ++++ b/tools/testing/selftests/mincore/mincore_selftest.c 2021-03-31 20:13:53.005750372 +0800 +@@ -21,7 +21,7 @@ + + /* Default test file size: 4MB */ + #define MB (1UL << 20) +-#define FILE_SIZE (4 * MB) ++#define FILE_SIZE (8 * MB) + + + /* diff --git a/tests/kernel-selftests/patch/5.10/pmtu.sh.patch b/tests/kernel-selftests/patch/5.10/pmtu.sh.patch new file mode 100644 index 0000000..d3181b9 --- /dev/null +++ b/tests/kernel-selftests/patch/5.10/pmtu.sh.patch @@ -0,0 +1,12 @@ +diff -Nuar kernel_selftests/tools/testing/selftests/net/pmtu.sh kernel_selftests.new/tools/testing/selftests/net/pmtu.sh +--- kernel_selftests/tools/testing/selftests/net/pmtu.sh 2021-03-03 15:26:31.967989851 +0800 ++++ kernel_selftests.new/tools/testing/selftests/net/pmtu.sh 2021-03-03 15:31:33.308270342 +0800 +@@ -1662,7 +1662,7 @@ + return $ret + ) + ret=$? +- [ $ret -ne 0 ] && exitcode=1 ++ [ $ret -ne 0 -a $ret -ne 2 ] && exitcode=1 + + return $ret + } diff --git a/tests/kernel-selftests/run.sh b/tests/kernel-selftests/run.sh new file mode 100644 index 0000000..ea9c788 --- /dev/null +++ b/tests/kernel-selftests/run.sh @@ -0,0 +1,12 @@ +run () +{ + # run kernel_selftests + cd $TONE_BM_RUN_DIR/kselftest/ + ./run_kselftest.sh +} + +parse () +{ + $TONE_BM_SUITE_DIR/parse.py +} + \ No newline at end of file diff --git a/tests/sysbench/install.sh b/tests/sysbench/install.sh index 4912a3e..df833a2 100644 --- a/tests/sysbench/install.sh +++ b/tests/sysbench/install.sh @@ -2,7 +2,7 @@ GIT_URL="https://gitee.com/mhe/sysbench.git" BRANCH="1.0" -DEP_PKG_LIST="make automake libtool pkgconfig libaio-devel" +DEP_PKG_LIST="vim make automake libtool pkgconfig libaio-devel" build() { ./autogen.sh -- Gitee From ad86d69f4e14dc5a9ccb39ae4d9ab413f1ea15da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=A4=84?= Date: Thu, 6 Jan 2022 14:47:19 +0800 Subject: [PATCH 7/9] support debian series --- Makefile | 10 ++++++++-- lib/common.sh | 25 +++++++++++++++++++++---- tests/netperf/install.sh | 4 ++-- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b6d1414..6d38f95 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,12 @@ install: - yum install -y wget zip unzip git gcc python3-devel + if which apt; then \ + apt install -y wget zip unzip git gcc; \ + elif which yum; then \ + yum install -y wget zip unzip git gcc; \ + else \ + echo "Unsupported distribution"; \ + exit 1; \ + fi if [ -h /usr/local/bin/tone ]; then \ rm -rf /usr/local/bin/tone; \ fi @@ -14,7 +21,6 @@ install: exit 1; \ fi; \ fi - if [ ! -f /usr/bin/pip ]; then \ if [ -f /usr/bin/pip3 ]; then \ ln -s /usr/bin/pip3 /usr/bin/pip; \ diff --git a/lib/common.sh b/lib/common.sh index 210c036..a247ec0 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -352,8 +352,13 @@ extract_src() is_pkg_installed() { - yum list installed "$1" >& /dev/null && return 0 - return 1 + if which yum; then + yum list installed "$1" >& /dev/null && return 0 + elif which dpkg; then + dpkg -l "$1" >& /dev/null && return 0 + else + return 1 + fi } uninstall_pkg() @@ -362,7 +367,13 @@ uninstall_pkg() if [ -e "$pkg_installed" ]; then sort -u "$pkg_installed" | while read -r pkg do - yum erase -y "$pkg" || echo "Error: $pkg fail to uninstall" + if which yum; then + yum erase -y "$pkg" || echo "Error: $pkg fail to uninstall" + elif which apt; then + apt remove -y "$pkg" || echo "Error: $pkg fail to uninstall" + else + echo "Error: Unsupported Distribution" + fi done fi } @@ -388,7 +399,13 @@ install_pkg() echo "$pkg installed" else echo "$pkg not installed" - yum install $yumopts -y "$pkg" + if which yum; then + yum install $yumopts -y "$pkg" + elif which apt; then + apt install $yumopts -y "$pkg" + else + echo "Unsupported Distribution" + fi if [ $? -eq 0 ]; then echo "Success: $pkg install completed" echo "$pkg" >> "$pkg_installed" diff --git a/tests/netperf/install.sh b/tests/netperf/install.sh index 3501059..9bb12f1 100644 --- a/tests/netperf/install.sh +++ b/tests/netperf/install.sh @@ -1,7 +1,7 @@ GIT_URL="https://gitee.com/mirrors_HewlettPackard/netperf.git" BRANCH="netperf-2.7.0" -DEP_PKG_LIST="lksctp-tools-devel automake gcc texinfo" +DEP_PKG_LIST="automake gcc texinfo" build() { @@ -10,7 +10,7 @@ build() ) # Fix configure issue on aarch64 platform: # configure: error: cannot guess build type; you must specify one - if [ "$(/bin/arch)" = aarch64 ]; then + if [ "$(/usr/bin/arch)" = aarch64 ]; then configure_flags+=('--build=aarch64-unknown-linux-gnu') fi -- Gitee From efe4dda31160bc615bab447da1c1afaddc52307c Mon Sep 17 00:00:00 2001 From: Jacob Qi <10035767+jacob-qi@user.noreply.gitee.com> Date: Sat, 29 Jan 2022 06:42:54 +0000 Subject: [PATCH 8/9] !13 Archive supported to define jobname * archive support to define jobname --- Makefile | 4 ++-- core/modules/cli/run/Subcommand.py | 7 +++++-- core/modules/subcommand/run/Archive.py | 23 ++++++++++++++--------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 6d38f95..39f0a96 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ install: if which apt; then \ - apt install -y wget zip unzip git gcc; \ + apt install -y wget zip unzip git gcc python3-dev python3-pip gawk; \ elif which yum; then \ - yum install -y wget zip unzip git gcc; \ + yum install -y wget zip unzip git gcc python3-devel python3-pip gawk; \ else \ echo "Unsupported distribution"; \ exit 1; \ diff --git a/core/modules/cli/run/Subcommand.py b/core/modules/cli/run/Subcommand.py index 1400627..c8750d8 100644 --- a/core/modules/cli/run/Subcommand.py +++ b/core/modules/cli/run/Subcommand.py @@ -24,11 +24,14 @@ class Subcommand(CLI): lparser.set_defaults(subcommand='archive') group = lparser.add_mutually_exclusive_group() group.add_argument( - '--tools', action='store_true', default=True, + '--tools', action='store_true', default=False, help='Archive run tools includes tools, tests, results') group.add_argument( - '--results', action='store_true', default=False, + '--results', action='store_true', default=True, help='Archive results includes cache build run and result') + lparser.add_argument( + '--name', type=str, default=None, help="Name of Job and tar file" + ) logger.debug("Subcommand: CLI configure") diff --git a/core/modules/subcommand/run/Archive.py b/core/modules/subcommand/run/Archive.py index b1dcd47..b767784 100644 --- a/core/modules/subcommand/run/Archive.py +++ b/core/modules/subcommand/run/Archive.py @@ -18,16 +18,21 @@ class Archive(TESTMODULE): print("Archiving .... ") archive_dir = ( - #'test_cache_path', - #'test_run_path', 'test_result_path', - #'test_build_path', ) try: - if not subflow.config.parser['results']: - tarball = "test_tool.tar" + if subflow.config.parser['name']: + job_name = subflow.config.parser['name'] + else: + job_name = "" + if job_name: + tarball = job_name + ".tar" else: - tarball = "test_result.tar" + if not subflow.config.parser['results']: + tarball = "test_tool.tar" + else: + tarball = "test_result.tar" + tarball = os.path.join( subflow.config.tone_path, tarball @@ -37,8 +42,8 @@ class Archive(TESTMODULE): # prep job.yaml all_test_conf = self.get_all_test_conf(subflow.config.test_conf_path) job_file = os.path.join(subflow.config.tone_path, "job.yaml") - job = self.get_job(test_result_path=subflow.config.test_result_path, all_test_conf=all_test_conf, name="") - self.write_to_yaml(job, job_file=job_file) + job_yaml = self.get_job_yaml(test_result_path=subflow.config.test_result_path, all_test_conf=all_test_conf, name=job_name) + self.write_to_yaml(job_yaml, job_file=job_file) target_dirs = [] if not subflow.config.parser['results']: @@ -106,7 +111,7 @@ class Archive(TESTMODULE): _path = os.path.join(suite, _result_path) return os.path.exists(os.path.join(test_result_path, _path)) - def get_job(self, test_result_path, all_test_conf, name=""): + def get_job_yaml(self, test_result_path, all_test_conf, name=""): if not name: name = self.gen_job_name() job = {"name": name, "test_config": []} -- Gitee From 938fb45c528ab753188bc8e5db1100e1d3c74ad5 Mon Sep 17 00:00:00 2001 From: zhizhisheng Date: Tue, 12 Jul 2022 16:43:33 +0800 Subject: [PATCH 9/9] updates: 1. update script "tone" python interpreter using version --- tone | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tone b/tone index f900656..20603b6 100755 --- a/tone +++ b/tone @@ -1,6 +1,6 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python from core.tone import run if __name__ == '__main__': - run() \ No newline at end of file + run() -- Gitee