Signed-off-by: Li Ping 15396232681@163.com --- doc/manual/how-to-apply-for-machine.md | 251 ++++++++++++++++++ doc/manual/how-to-compare-test-results.md | 49 ++++ ...to-use-cci-to-test-open-source-projects.md | 68 +++++ doc/manual/how-to-view-test-results.md | 24 ++ doc/manual/how-to-write-pkgbuild.md | 81 ++++++ doc/manual/install-cci-client-locally.md | 28 ++ doc/manual/submit-usage.md | 211 +++++++++++++++ 7 files changed, 712 insertions(+) create mode 100644 doc/manual/how-to-apply-for-machine.md create mode 100644 doc/manual/how-to-compare-test-results.md create mode 100644 doc/manual/how-to-use-cci-to-test-open-source-projects.md create mode 100644 doc/manual/how-to-view-test-results.md create mode 100644 doc/manual/how-to-write-pkgbuild.md create mode 100644 doc/manual/install-cci-client-locally.md create mode 100644 doc/manual/submit-usage.md
diff --git a/doc/manual/how-to-apply-for-machine.md b/doc/manual/how-to-apply-for-machine.md new file mode 100644 index 0000000..d70136f --- /dev/null +++ b/doc/manual/how-to-apply-for-machine.md @@ -0,0 +1,251 @@ +# 前提条件 + +请确认您已按照 [apply-account.md](https://gitee.com/wu_fengguang/compass-ci/blob/master/doc/manual/apply-accou... +- send apply account email. +- receive email from compass-ci@qq.com. +- local environment configuration. + + +# 申请测试机(虚拟机) + +1. 生成本地RSA公私钥对 + + ```shell + hi684@account-vm ~% ssh-keygen -t rsa + Generating public/private rsa key pair. + Enter file in which to save the key (/home/hi684/.ssh/id_rsa): + Created directory '/home/hi684/.ssh'. + Enter passphrase (empty for no passphrase): + Enter same passphrase again: + Your identification has been saved in /home/hi684/.ssh/id_rsa. + Your public key has been saved in /home/hi684/.ssh/id_rsa.pub. + The key fingerprint is: + SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx hi684@account-vm + The key's randomart image is: + +---[RSA 2048]----+ + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + +----[SHA256]-----+ + hi684@account-vm ~% ls -hla .ssh + total 16K + drwx------. 2 hi684 hi684 4.0K Nov 26 16:37 . + drwx------. 7 hi684 hi684 4.0K Nov 26 16:37 .. + -rw-------. 1 hi684 hi684 1.8K Nov 26 16:37 id_rsa + -rw-r--r--. 1 hi684 hi684 398 Nov 26 16:37 id_rsa.pub + ``` + +2. 根据需求选择yaml + + 每位用户`/home/${USER}`目录下面都存放了一个 lkp-tests 的文件夹。 + + ```shell + hi684@account-vm ~% cd lkp-tests/jobs + hi684@account-vm ~/lkp-tests/jobs% ls -hl borrow-* + -rw-r--r--. 1 root root 53 Nov 2 14:54 borrow-10d.yaml + -rw-r--r--. 1 root root 64 Nov 2 14:54 borrow-1d.yaml + -rw-r--r--. 1 root root 235 Nov 19 15:27 borrow-1h.yaml + ``` + +3. 提交yaml并连接测试机(虚拟机) + + ```shell + hi684@account-vm ~/lkp-tests/jobs% submit -c -m testbox=vm-2p8g borrow-1h.yaml + 2020-11-26 14:44:25 +0800 WARN -- skip non-executable /home/hi684/lkp-tests/monitors/plain/wait + submit borrow-1h.yaml, got job_id=z9.170593 + query=>{"job_id":["z9.170593"]} + connect to ws://172.168.131.2:11310/filter + {"job_id":"z9.170593","message":"","job_state":"submit","result_root":"/srv/result/borrow/2020-11-26/vm-2p8g/openeuler-20.03-aarch64/3600/z9.170593"} + {"job_id": "z9.170593", "result_root": "/srv/result/borrow/2020-11-26/vm-2p8g/openeuler-20.03-aarch64/3600/z9.170593", "job_state": "set result root"} + {"job_id": "z9.170593", "job_state": "boot"} + {"job_id": "z9.170593", "job_state": "download"} + {"time":"2020-11-26 14:45:06","mac":"0a-1f-0d-3c-91-5c","ip":"172.18.156.13","job_id":"z9.170593","state":"running","testbox":"vm-2p8g.taishan200-2280-2s64p-256g--a38-12"} + {"job_state":"running","job_id":"z9.170593"} + {"job_id": "z9.170593", "state": "set ssh port", "ssh_port": "51840", "tbox_name": "vm-2p8g.taishan200-2280-2s64p-256g--a38-12"} + Host 172.168.131.2 not found in /home/hi684/.ssh/known_hosts + Warning: Permanently added '[172.168.131.2]:51840' (ECDSA) to the list of known hosts. + Last login: Wed Sep 23 11:10:58 2020 + + + Welcome to 4.19.90-2003.4.0.0036.oe1.aarch64 + + System information as of time: Thu Nov 26 06:44:18 CST 2020 + + System load: 0.83 + Processes: 107 + Memory used: 6.1% + Swap used: 0.0% + Usage On: 89% + IP address: 172.18.156.13 + Users online: 1 + + + + root@vm-2p8g ~# + ``` + + 更多关于`submit命令如何使用`、`testbox都有什么可选项`、`如何borrow指定的操作系统`,请参见文章末尾FAQ。 + +4. 使用完毕退还测试机(虚拟机) + + ```shell + root@vm-2p8g ~# reboot + Connection to 172.168.131.2 closed by remote host. + Connection to 172.168.131.2 closed. + hi684@account-vm ~/lkp-tests/jobs% + ``` + + +# 申请测试机(物理机) + + +1. 生成本地RSA公私钥对 + + ```shell + hi684@account-vm ~% ssh-keygen -t rsa + Generating public/private rsa key pair. + Enter file in which to save the key (/home/hi684/.ssh/id_rsa): + Created directory '/home/hi684/.ssh'. + Enter passphrase (empty for no passphrase): + Enter same passphrase again: + Your identification has been saved in /home/hi684/.ssh/id_rsa. + Your public key has been saved in /home/hi684/.ssh/id_rsa.pub. + The key fingerprint is: + SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx hi684@account-vm + The key's randomart image is: + +---[RSA 2048]----+ + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + |xxxxxxxxxxxxxxxxx| + +----[SHA256]-----+ + hi684@account-vm ~% ls -hla .ssh + total 16K + drwx------. 2 hi684 hi684 4.0K Nov 26 16:37 . + drwx------. 7 hi684 hi684 4.0K Nov 26 16:37 .. + -rw-------. 1 hi684 hi684 1.8K Nov 26 16:37 id_rsa + -rw-r--r--. 1 hi684 hi684 398 Nov 26 16:37 id_rsa.pub + ``` + +2. 根据需求选择yaml + + 每位用户`/home/${USER}`目录下面都存放了一个 lkp-tests 的文件夹。 + + ```shell + hi684@account-vm ~% cd lkp-tests/jobs + hi684@account-vm ~/lkp-tests/jobs% ls -hl borrow-* + -rw-r--r--. 1 root root 53 Nov 2 14:54 borrow-10d.yaml + -rw-r--r--. 1 root root 64 Nov 2 14:54 borrow-1d.yaml + -rw-r--r--. 1 root root 235 Nov 19 15:27 borrow-1h.yaml + ``` + +3. 提交yaml并连接测试机(物理机) + + ```shell + hi684@account-vm ~/lkp-tests/jobs% submit -c -m testbox=taishan200-2280-2s64p-256g borrow-1h.yaml + 2020-11-26 14:49:13 +0800 WARN -- skip non-executable /home/hi684/lkp-tests/monitors/plain/wait + submit borrow-1h.yaml, got job_id=z9.170594 + query=>{"job_id":["z9.170594"]} + connect to ws://172.168.131.2:11310/filter + {"job_id":"z9.170594","message":"","job_state":"submit","result_root":"/srv/result/borrow/2020-11-26/taishan200-2280-2s64p-256g/openeuler-20.03-aarch64/3600/z9.170594"} + {"job_id": "z9.170594", "result_root": "/srv/result/borrow/2020-11-26/taishan200-2280-2s64p-256g/openeuler-20.03-aarch64/3600/z9.170594", "job_state": "set result root"} + {"job_id": "z9.170594", "job_state": "boot"} + {"job_id": "z9.170594", "job_state": "download"} + {"time":"2020-11-26 14:51:56","mac":"84-46-fe-26-d3-47","ip":"172.168.178.48","job_id":"z9.170594","state":"running","testbox":"taishan200-2280-2s64p-256g--a5"} + {"job_state":"running","job_id":"z9.170594"} + {"job_id": "z9.170594", "state": "set ssh port", "ssh_port": "50420", "tbox_name": "taishan200-2280-2s64p-256g--a5"} + Host 172.168.131.2 not found in /home/hi684/.ssh/known_hosts + Warning: Permanently added '[172.168.131.2]:50420' (ECDSA) to the list of known hosts. + Last login: Wed Sep 23 11:10:58 2020 + + + Welcome to 4.19.90-2003.4.0.0036.oe1.aarch64 + + System information as of time: Thu Nov 26 14:51:59 CST 2020 + + System load: 1.31 + Processes: 1020 + Memory used: 5.1% + Swap used: 0.0% + Usage On: 3% + IP address: 172.168.178.48 + Users online: 1 + + + + root@taishan200-2280-2s64p-256g--a5 ~# + ``` + + 更多关于`submit命令如何使用`、`testbox都有什么可选项`、`如何borrow指定的操作系统`,请参见文章末尾FAQ。 + +4. 使用完毕退还测试机(物理机) + + ```shell + root@taishan200-2280-2s64p-256g--a5 ~# reboot + Connection to 172.168.131.2 closed by remote host. + Connection to 172.168.131.2 closed. + hi684@account-vm ~/lkp-tests/jobs% + ``` + + +# FAQ + + +* 如何自行修改申请时长 + + ```shell + hi684@account-vm ~/lkp-tests/jobs% cat borrow-1h.yaml + suite: borrow + testcase: borrow + + sshd: + pub_key: <%= + begin + File.read("#{ENV['HOME']}/.ssh/id_rsa.pub").chomp + rescue + nil + end + %> + # sleep at the bottom + sleep: 1h + hi684@account-vm ~/lkp-tests/jobs% grep sleep: borrow-1h.yaml + sleep: 1h + # 使用vim来修改你的sleep字段的值 + hi684@account-vm ~/lkp-tests/jobs% vim borrow-1h.yaml + # 修改完毕后重新submit即可 + hi684@account-vm ~/lkp-tests/jobs% submit -c -m testbox=vm-2p8g borrow-1h.yaml + ``` + +* Submit命令指导 + + 参考文档:[submit命令详解.md](https://gitee.com/wu_fengguang/compass-ci/blob/master/doc/manual/submit%E5%9...) + +* testbox有什么可选项 + + testbox可选项请参考:https://gitee.com/wu_fengguang/lab-z9/tree/master/hosts + + >![](./../public_sys-resources/icon-note.gif) **说明:** + > + > 虚拟机的testbox : vm-xxx + > 物理机的testbox : taishan200-2280-xxx + + + + >![](./../public_sys-resources/icon-notice.gif) **注意:** + > - 物理机的testbox若选择以`--axx`结尾的,则表示指定到了具体的某一个物理机。若此物理机任务队列中已经有任务在排队,则需要等待队列中前面的任务执行完毕后,才会轮到你提交的borrow任务。 + > - 物理机的testbox若不选择以`-axx`结尾的,表示不指定具体的某一个物理机。则此时集群中的空闲物理机会即时被分配执行你的borrow任务。 + +* 如何 borrow 指定的操作系统 + + 关于支持的`os`, `os_arch`, `os_version`,参见:[os-os_verison-os_arch.md](https://gitee.com/wu_fengguang/compass-ci/blob/master/doc/job/os-os_verison-...) diff --git a/doc/manual/how-to-compare-test-results.md b/doc/manual/how-to-compare-test-results.md new file mode 100644 index 0000000..a7348d8 --- /dev/null +++ b/doc/manual/how-to-compare-test-results.md @@ -0,0 +1,49 @@ +# Introduction of compare feature + The compare feature used to analyze the results of different jobs, showing the performance waves and changes + under different influencing factors, for users to analyze performance influencing factor. + +## url: https://compass-ci.openeuler.org/compare + +## options directions +### filters: + - suite: iperf, netperf, mysql, ... + - OS: openeuler 20.03, centos 7.6, ... + - os_arch: aarch64, x86 + - tbox_group: vm-2p8g, taishan200-2880-2s48p-256g, ... + we can combine the above options arbitrarily to limit compare scope. + choose at least one option as filter. + +### dimension + Dimension can select: os, os_version, os_arch, suite, tbox_group. + Within filter, we will compare all different job result by dimension + and keep other test conditions are same. + +## example: + filter: suite = iperf + dimension: os_version + + result: + os=openeuler/os_arch=aarch64/pp.iperf.protocol=tcp/pp.iperf.runtime=20/tbox_group=vm-2p8g # other test conditions keep same + + + 20.09 20.03 metric + -------------------- ------------------------------ ------------------------------ + fails:runs change fails:runs + | | | + 3:3 -100.0% 0:3 last_state.exit_fail + 3:3 -100.0% 0:3 last_state.is_incomplete_run + 3:3 -100.0% 0:3 last_state.test.iperf.exit_code.127 + 3:3 -100.0% 0:3 stderr.perf_command_failed + + + + 20.09 20.03 metric + -------------------- ------------------------------ ------------------------------ + %stddev change %stddev + \ | \ + 4.461021e+10 ± 6% -17.4% 3.686392e+10 ± 12% iperf.tcp.receiver.bps + 4.461112e+10 ± 6% -17.4% 3.686935e+10 ± 12% iperf.tcp.sender.bps + 94.82 -44.0% 53.10 boot-time.boot + 123.11 -58.4% 51.19 boot-time.idle + 0.00 0 4.87 boot-time.kernel_boot + 4165.50 ± 12% -99.9% 5.00 interrupts.38:GICv3.36.Level.virtio0 diff --git a/doc/manual/how-to-use-cci-to-test-open-source-projects.md b/doc/manual/how-to-use-cci-to-test-open-source-projects.md new file mode 100644 index 0000000..e73b9f9 --- /dev/null +++ b/doc/manual/how-to-use-cci-to-test-open-source-projects.md @@ -0,0 +1,68 @@ +# 使用 compass-ci 平台测试开源项目 + +本文介绍了使用 compass-ci 平台测试开源项目的操作。 + +### 添加待测试仓库 URL 到 upstream-repos 仓库 + +执行以下步骤,将想要测试的代码仓信息以 yaml 文件的方式添加到 upstream-repos 仓库(https://gitee.com/wu_fengguang/upstream-repos )。 + +1. Fork 要测试的代码仓库并 git clone 到本地,本文以 blacklight 仓库(https://github.com/baskerville/backlight )为例说明。 + +![](./../pictures/fork_blacklight.png) + +2. 执行以下命令,以首字母和仓库名创建文件路径。 + + ``` + mkdir -p b/backlight + ``` + +3. 执行以下命令,在该目录下新建同名文件 backlight。 + ``` + cd b/backlight + touch backlight + ``` + +4. 执行以下命令,将 backlight 仓库 url 信息写入 backlight 文件。 + + ``` + vim backlight + ``` + 内容格式为 + + ``` + --- + url: + - https://github.com/baskerville/backlight + ``` + + >![](./../public_sys-resources/icon-notice.gif) **注意:** + > + >可参考 upstream-repos 仓库中已有文件格式,请保持格式一致。 + +5. 通过 Pull Request 命令将新增的 backlight 文件提交到 blacklight 仓库。 + + +### 提交测试任务到 compass-ci 平台 + +1. 准备测试用例 + + 测试用例可以自己编写并添加到 lkp-tests 仓库,也可以直接使用 lkp-tests 仓库(https://gitee.com/wu_fengguang/lkp-tests )的 jobs 目录下已有的测试用例。 + + * 使用仓库中已经适配好的测试用例 + 如果 lkp-tests 仓库中正好有你想要的测试用例,你可以直接使用。以 iperf.yaml 文件为例说明如下: + iperf.yaml 是一个已经适配好的测试用例,它位于 lkp-tests 仓库的 jobs 目录下,其中有一些基本的测试参数。 + + * 编写测试用例并添加到仓库 + + 请参考:[如何添加测试用例](https://gitee.com/wu_fengguang/lkp-tests/blob/master/doc/add-testcase.md ) + +2. 配置 auto_submit.yaml 文件,提交测试任务 + + 你只需要在 compass-ci 仓库下面的 sbin/auto_submit.yaml 文件中添加配置信息,如: + ``` + b/backlight/backlight: + - testbox=vm-2p8g os=openEuler os_version=20.03 os_mount=initramfs os_arch=aarch64 iperf.yaml + ``` + 通过 Pull Request 的方式将修改好的 auto_submit.yaml 文件提交到 compass-ci 仓库,就可以使用 compass-ci 测试你的项目了。 + + auto_submit.yaml 文件的参数配置请参考 https://gitee.com/wu_fengguang/compass-ci/tree/master/doc/job 。 diff --git a/doc/manual/how-to-view-test-results.md b/doc/manual/how-to-view-test-results.md new file mode 100644 index 0000000..36caaeb --- /dev/null +++ b/doc/manual/how-to-view-test-results.md @@ -0,0 +1,24 @@ +# 如何查看任务结果 + +测试用例执行完成后,可以登录到 https://compass-ci.openeuler.org/jobs 查看执行结果。 + +可以根据提交时定义的 suite 或者提交任务返回的 id 在网站上找到自己的任务,点击任务对应的 job_state 列即可查看任务结果。 + +![](./../pictures/jobs.png) + +## 结果文件介绍 + +**job.yaml文件** + + +job.yaml 文件中部分字段是用户提交上来的,其他字段是平台根据提交的 job 自动添加进来的。此文件包含了测试任务需要的所有参数。 + +**output文件** + +output 文件记录了用例的执行过程,文件最后部分一般会有 check_exit_code 这个状态码,非 0 代表测试用例错误。 + +**stats.json** + +测试用例执行完成会生成一个与测试用例同名的文件,记录它们的测试命令及标准化输出结果。compass-ci 会对这些文件进行解析,生成后缀名是 .json 的文件。 + +stats.json 是所有的 json 文件的汇总,所有测试命令的关键结果都会统计到这个文件中,便于后续的比较和分析。 diff --git a/doc/manual/how-to-write-pkgbuild.md b/doc/manual/how-to-write-pkgbuild.md new file mode 100644 index 0000000..66a1833 --- /dev/null +++ b/doc/manual/how-to-write-pkgbuild.md @@ -0,0 +1,81 @@ +# PKGBUILD是什么 + +PKGBUILD 是一个 shell 脚本,makepkg 通过 PKGBUILD 中包含的指令,生成包含二进制文件和安装指令的软件包。 + +# PKGBUILD包含什么 + +PKGBUILD包含两部分内容:变量和函数。 + +## 定义变量 + +- pkgname: 必须定义,表示软件包的名称; +- pkgver: 必须定义,表示软件包的版本号; +- pkgrel: 必须定义,表示软件包的发布号; +- arch: 必须定义,表示软件包使用的架构序列; +- depends: 可选字段,软件测试运行时需要的依赖包名称; +- makedepends: 可选字段,构建软件包时需要的文件列表; +- source: 可选字段,指定每个源文件的MD5哈希值,用于构建过程中验证源文件的完整性。 + +## 定义函数 + +- package函数 + package函数必须定义,此函数用于将文件安装到将成为构建包的根目录的目录中; +- prepare函数 + 定义可选的prepare函数,在其中执行用于准备构建源码的操作; +- build函数 + 定义可选的build函数,用于编译和/或构建源码; +- check函数 + 定义可选的check函数,用于运行程序包的测试套件。 + +>![](./../public_sys-resources/icon-notice.gif) **注意:** +> +> srcdir 是提取或复制源文件的目录,所有打包功能都在 srcdir 目录内部运行;pkgdir 是构建软件包的根目录,仅在 package 函数中使用。 + + +# 如何编写PKGBUILD + + +1. 执行如下命令创建PKGBUILD,文件名必须以“PKGBUILD”命名。 + + ```shell + touch PKGBUILD + ``` + + +2. 使用 vim 打开 PKGBUILD,编写 PKGBUILD 文件内容,一个 PKGBUILD 示例如下: + + ```shell + pkgname=zstd + pkgver=1.4.4 + pkgrel=2 + arch=('i686' 'x86_64' 'aarch64') + url='https://github.com/facebook/zstd' + license=('custom:BSD3' 'GPL2') + depends=('xz' 'zlib' 'lz4') + makedepends=('git') + source=('git://github.com/facebook/zstd.git#branch=dev') + md5sums=('SKIP') + + pkgver() { + cd "$srcdir/$pkgname" + git describe --long --tags | sed 's/([^-]*-g)/r\1/;s/-/./g;s/^v//g' + } + + build() { + cd "$srcdir/$pkgname" + make + make -C contrib/pzstd + } + + package() { + cd "$srcdir/$pkgname" + make PREFIX="/usr" DESTDIR="$pkgdir/" install + install -D -m755 contrib/pzstd/pzstd "$pkgdir/usr/bin/pzstd" + install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + } + ``` + +# 参考 + +- [PKGBUILD(5) Manual Page](https://www.archlinux.org/pacman/PKGBUILD.5.html) +- [pkgbuild demo文件](https://git.archlinux.org/pacman.git/plain/proto/PKGBUILD.proto) diff --git a/doc/manual/install-cci-client-locally.md b/doc/manual/install-cci-client-locally.md new file mode 100644 index 0000000..43a6bf5 --- /dev/null +++ b/doc/manual/install-cci-client-locally.md @@ -0,0 +1,28 @@ +# 本地安装compass-ci客户端 + +Compass-CI 将 [lkp-tests](https://gitee.com/wu_fengguang/lkp-tests) 作为客户端,通过本地安装 lkp-tests 可以手动提交测试任务 + +:exclamation: 前提条件:按照 [apply-ssh-account.md](https://gitee.com/wu_fengguang/compass-ci/blob/master/doc/manual/apply-accou...) 完成如下动作: +- send apply account email +- receive email from compass-ci@qq.com + +## Getting started + +1. setup default config + run the following command to add the below setup to default config file + mkdir -p ~/.config/compass-ci/defaults/ + cat >> ~/.config/compass-ci/defaults/${USER}.yaml <<-EOF + my_uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx + my_email: xxx + my_name: xx + EOF + +2. download lkp-tests and dependencies + run the following command to install the lkp-test and effect the configuration + git clone https://gitee.com/wu_fengguang/lkp-tests.git + cd lkp-tests + make install + source ~/.bashrc && source ~/.bash_profile + +3. submit job + Now try [submitting a job to compass-ci](https://gitee.com/wu_fengguang/compass-ci/blob/master/doc/manual/submit%E5%9...) diff --git a/doc/manual/submit-usage.md b/doc/manual/submit-usage.md new file mode 100644 index 0000000..71d9dfd --- /dev/null +++ b/doc/manual/submit-usage.md @@ -0,0 +1,211 @@ +# submit 命令详解 + +### 前提条件 + +已经按照[本地安装compass-ci客户端.md](https://gitee.com/wu_fengguang/compass-ci/blob/master/doc/manual/%E6%9C%AC%E... )完成安装 + +### 概述 + +submit 命令的作用是提交测试任务。该命令提供了多个选项帮助用户更灵活的提交任务,您可以在命令行直接输入 summit 命令来查看帮助信息,并根据实际需求灵活使用。 + + +### 基本用法 + +测试任务以 yaml 文件的方式提交,因此,您需要事先准备好测试任务的 yaml 文件(本文以 iperf.yaml 为例)。使用如下命令提交测试任务: + +``` +submit iperf.yaml +``` +如下所示: + +```shell +hi8109@account-vm ~% submit iperf.yaml +submit iperf.yaml, got job_id=z9.173924 +``` + +本文所示的 yaml 文件均已添加 testbox 字段,若您提交的 yaml 文件不包含该字段将报错: + +```shell +hi8109@account-vm ~% submit iperf.yaml +submit iperf.yaml failed, got job_id=0, error: Missing required job key: 'testbox' +``` + +您可以在 yaml 文件中添加 testbox 字段,或使用如下命令: + +``` +submit iperf.yaml testbox=vm-2p8g +``` + +testbox 字段的值指定需要的测试机,可以使用 `ls` 命令查看 `lkp-tests/hosts` 路径下的可选测试机。如下图所示: + +```shell +hi8109@account-vm ~/lkp-tests/hosts% ll +total 120K +-rw-r--r--. 1 root root 76 2020-11-02 14:54 vm-snb +-rw-r--r--. 1 root root 64 2020-11-02 14:54 vm-pxe-hi1620-2p8g +-rw-r--r--. 1 root root 64 2020-11-02 14:54 vm-pxe-hi1620-2p4g +-rw-r--r--. 1 root root 64 2020-11-02 14:54 vm-pxe-hi1620-2p1g +-rw-r--r--. 1 root root 64 2020-11-02 14:54 vm-pxe-hi1620-1p1g +-rw-r--r--. 1 root root 75 2020-11-02 14:54 vm-hi1620-2p8g +-rw-r--r--. 1 root root 75 2020-11-02 14:54 vm-hi1620-2p4g +-rw-r--r--. 1 root root 75 2020-11-02 14:54 vm-hi1620-2p1g +-rw-r--r--. 1 root root 75 2020-11-02 14:54 vm-hi1620-1p1g +-rw-r--r--. 1 root root 61 2020-11-02 14:54 vm-2p8g-pxe +-rw-r--r--. 1 root root 61 2020-11-02 14:54 vm-2p8g +-rw-r--r--. 1 root root 61 2020-11-02 14:54 vm-2p4g-pxe +-rw-r--r--. 1 root root 61 2020-11-02 14:54 vm-2p4g +-rw-r--r--. 1 root root 61 2020-11-02 14:54 vm-2p1g-pxe +-rw-r--r--. 1 root root 61 2020-11-02 14:54 vm-2p1g +-rw-r--r--. 1 root root 61 2020-11-02 14:54 vm-1p1g-pxe +-rw-r--r--. 1 root root 61 2020-11-02 14:54 vm-1p1g +-rw-r--r--. 1 root root 14 2020-11-02 14:54 taishan200-2280-2s64p-256g +-rw-r--r--. 1 root root 497 2020-11-02 14:54 lkp-skl-d01 +-rw-r--r--. 1 root root 574 2020-11-02 14:54 lkp-ivb-d04 +-rw-r--r--. 1 root root 606 2020-11-02 14:54 lkp-ivb-d02 +-rw-r--r--. 1 root root 384 2020-11-02 14:54 lkp-ivb-d01 +-rw-r--r--. 1 root root 388 2020-11-02 14:54 lkp-hsw-d01 +-rw-r--r--. 1 root root 385 2020-11-02 14:54 lkp-bdw-de1 +-rw-r--r--. 1 root root 11 2020-11-02 14:54 dc-8g +-rw-r--r--. 1 root root 11 2020-11-02 14:54 dc-4g +-rw-r--r--. 1 root root 11 2020-11-02 14:54 dc-2g +-rw-r--r--. 1 root root 11 2020-11-02 14:54 dc-1g +-rw-r--r--. 1 root root 13 2020-11-02 14:54 2288hv5-2s64p +-rw-r--r--. 1 root root 74 2020-11-02 14:54 vm-snb-i386 +``` + +>![](./../public_sys-resources/icon-note.gif) **说明:** +> +>使用 "=" 更新 yaml 中的字段,"=" 在命令行中的位置不同优先级不同:. +> * submit iperf.yaml testbox=vm-2p8g 命令中 "=" 定义在 yaml 文件之后,则 "=" 的优先级高于 yaml 文件,testbox=vm-2p8g 会覆盖 yaml 文件中已经定义的 testbox 字段。 +> * submit testbox=vm-2p8g iperf.yaml 命令中 "=" 定义在 yaml 文件之前,则 "=" 的优先级低于 yaml 文件,testbox=vm-2p8g 不会覆盖 yaml 文件中已经定义的 testbox 字段,只有当 yaml 文件中不存在 testbox 字段才会赋值。 + + + +### 高级用法 + +submit 命令的选项如下图所示: + +```shell +hi8109@account-vm ~% submit +Usage: submit [options] job1.yaml job2.yaml ... + submit test jobs to the scheduler + +options: + -s, --set 'KEY: VALUE' add YAML hash to job + -o, --output DIR save job yaml to DIR/ + -a, --auto-define-files auto add define_files + -c, --connect auto connect to the host + -m, --monitor monitor job status: use -m 'KEY: VALUE' to add rule + --my-queue add to my queue +``` + +* **-s的用法** + + 使用 -s 'KEY:VALUE' 参数可以将键值对更新到提交的任务当中。示例如下所示: + ``` + submit -s 'testbox: vm-2p8g' iperf.yaml + ``` + + + * 如果 iperf.yaml 中不存在 testbox:vm-2p8g ,最终提交的任务将会加上该信息。 + * 如果 iperf.yaml 中存在 testbox 字段,但是值不为 vm-2p8g ,最终提交的任务中 testbox 的值将会被替换为vm-2p8g。 + +* **-o的用法** + + 使用-o DIR 命令可以将最终生成的yaml文件保存到指定目录 DIR 下。示例如下所示: + + ``` + submit -o ~/iperf.yaml + ``` + + 运行命令之后会在指定目录生成经过 submit 处理过的 yaml 文件。 + +* **-a的用法** + + 如果你的测试用例对客户端的lkp-tests 做了更改,需要使用 -a 选项来适配。将客户端的 lkp-tests 下做的更改,同步到服务端,并在测试机上生成你的测试脚本。 + 示例命令如下: + + ``` + submit -a iperf.yaml + ``` + +* **-m的用法** + + 使用 -m 参数可以启动任务监控功能,并将任务执行过程中的各种状态信息打印到控制台上,方便用户实时监控测试任务的执行过程。 + 示例命令如下: + + ``` + submit -m iperf.yaml + ``` + + 控制台显示如下: + + ```shell + hi8109@account-vm ~% submit -m iperf.yaml + submit iperf.yaml, got job_id=z9.173923 + query=>{"job_id":["z9.173923"]} + connect to ws://172.168.131.2:11310/filter + {"job_id":"z9.173923","message":"","job_state":"submit","result_root":"/srv/result/iperf/2020-11-30/vm-2p8g/openeuler-20.03-aarch6 + {"job_id": "z9.173923", "result_root": "/srv/result/iperf/2020-11-30/vm-2p8g/openeuler-20.03-aarch64/tcp-30/z9.173923", "job_state + {"job_id": "z9.173923", "job_state": "boot"} + {"job_id": "z9.173923", "job_state": "download"} + {"time":"2020-11-30 20:28:16","mac":"0a-f5-9f-83-62-ea","ip":"172.18.192.21","job_id":"z9.173923","state":"running","testbox":"vm- + {"job_state":"running","job_id":"z9.173923"} + {"job_state":"post_run","job_id":"z9.173923"} + {"start_time":"2020-11-30 12:25:15","end_time":"2020-11-30 12:25:45","loadavg":"1.12 0.38 0.14 1/105 1956","job_id":"z9.173923"} + {"job_state":"finished","job_id":"z9.173923"} + {"job_id": "z9.173923", "job_state": "complete"} + {"time":"2020-11-30 20:28:54","mac":"0a-f5-9f-83-62-ea","ip":"172.18.192.21","job_id":"z9.173923","state":"rebooting","testbox":"v + {"job_id": "z9.173923", "job_state": "extract_finished"} + connection closed: normal + ``` + +* **-c的用法** + + -c 参数需要搭配 -m 参数来使用,可以使申请设备的任务实现自动登入功能。 + + 示例命令如下: + + ``` + submit -m -c borrow-1h.yaml + ``` + 当我们提交一个申请设备的任务后,会获取到返回的登陆信息,如 `ssh ip -p port`,添加 -c 参数之后不需要我们手动输入 ssh 登陆命令来进入执行机。 + + 控制台显示如下: + + ```shell + hi8109@account-vm ~% submit -m -c borrow-1h.yaml + submit borrow-1h.yaml, got job_id=z9.173925 + query=>{"job_id":["z9.173925"]} + connect to ws://172.168.131.2:11310/filter + {"job_id":"z9.173925","message":"","job_state":"submit","result_root":"/srv/result/borrow/2020-11-30/vm-2p8g/openeuler-20.03-aarch + {"job_id": "z9.173925", "result_root": "/srv/result/borrow/2020-11-30/vm-2p8g/openeuler-20.03-aarch64/3600/z9.173925", "job_state" + {"job_id": "z9.173925", "job_state": "boot"} + {"job_id": "z9.173925", "job_state": "download"} + {"time":"2020-11-30 20:35:04","mac":"0a-24-5d-c8-aa-d0","ip":"172.18.101.4","job_id":"z9.173925","state":"running","testbox":"vm-2 + {"job_state":"running","job_id":"z9.173925"} + {"job_id": "z9.173925", "state": "set ssh port", "ssh_port": "50200", "tbox_name": "vm-2p8g.taishan200-2280-2s48p-256g--a52-7"} + Host 172.168.131.2 not found in /home/hi8109/.ssh/known_hosts + Warning: Permanently added '[172.168.131.2]:50200' (ECDSA) to the list of known hosts. + Last login: Wed Sep 23 11:10:58 2020 + + + Welcome to 4.19.90-2003.4.0.0036.oe1.aarch64 + + System information as of time: Mon Nov 30 12:32:04 CST 2020 + + System load: 0.50 + Processes: 105 + Memory used: 6.1% + Swap used: 0.0% + Usage On: 89% + IP address: 172.17.0.1 + Users online: 1 + + + + root@vm-2p8g ~# + ``` + + 已经成功登陆执行机。 +