1。 下载autotest
git clone git://github.com/autotest/autotest.git
2. 运行简单的例子
cd autotes/client
bin/autotest --verbose tests/sleeptest/control
格式是 autotest control_file
3. 查看结果
html格式的
firefox results/default/job_report.html
文本格式的
./tools/scan_results.py results/default/status
测试log,结果存放在
result/default/sleeptest
4. 编译kernel的例子
./bin/autotest samples/control.kbuild_and_tests
指定kernel的源代码为本机的目录
diff --git a/client/samples/control.kbuild_and_tests b/client/samples/control.kbuild_and_tests
index 59dd757..d842dc9 100644
--- a/client/samples/control.kbuild_and_tests
+++ b/client/samples/control.kbuild_and_tests
@@ -30,7 +30,8 @@ def step_init():
# If you have a local/different kernel.org mirror, you can set it by
# uncommenting the below and set the URL properly.
#job.config_set('local_mirror', 'http://foo/bar')
- testkernel = job.kernel('2.6.35')
+# testkernel = job.kernel('2.6.35')
+ testkernel = job.kernel('/media/Study/Project/kernel_driver/git/linux-2.6/')
# If you want to see kernel expansion in action, comment the above and
# uncomment the below. Keep in mind that after some months, it's expected
# that some of the patches might not exist, so you might want to edit
运行后命令后,可以看到在 autotest/client/tmp目录下会有一个symbol link到指定的内核目录
$ls tmp/build/ -l
total 1
lrwxrwxrwx 1 root root 106 2011-11-18 06:50 linux -> /media/Study/Project/kernel_driver/git/linux-2.6/
drwxrwxrwx 1 root root 0 2011-11-18 06:50 src
这个过程很长。
5. control file的例子 https://github.com/autotest/autotest/wiki/ControlHowto
一个用step_init()的例子
def step_init():
job.next_step([step_test])
def step_test():
job.run_test('sleeptest')
job.run_test('aborttest')
用parallel 并行执行的例子
job.parallel([job.run_test, 'sleeptest'], [job.run_test, 'hwclock'])
或者
def first_task():
job.run_test('sleeptest')
def second_test():
job.run_test('hwclock')
job.parallel([first_task], [second_task])
6. 添加一个完整client test的例子
其实就是在client/tests目录下面添加一个control 文件 和 一个 python的脚本。
contro file
-------------------------------------------
job.run_test('my_test', seconds = 1, iterations = 2 )
my_test.py
-------------------------------------------
import time, loggingfrom autotest_lib.client.bin import test
class my_test(test.test):
version = 1
def initialize(self):
logging.info("my_test initialize")
def setup(self):
logging.info("my_test setup")
def run_once(self, seconds=1):
logging.info("my_test run_once " )
def postprocess(self):
logging.info("my_test postprocess")
def postprocess_iteration(self):
logging.info("my_test postprocess_iteration")
7. 从git tree上下载或者更新 安装kernel的例子
这个只要一个control file就可以了
import sys, os, logging
os.environ['LANG'] = 'en_US.UTF-8'
kvm_test_dir = os.path.join(os.environ['AUTODIR'],'tests', 'kvm')
sys.path.append(kvm_test_dir)
from autotest_lib.client.common_lib import cartesian_config
from autotest_lib.client.virt import virt_utils
kernel_install_params = { \
'host_kernel_git_branch': 'master', \
'user_git_repo': 'git://github.com/avikivity/qemu.git', \
'dep': [], \
'test_git_repo': 'git://github.com/avikivity/kvm-unit-tests.git', \
'host_kernel_install_type': 'git', \
'mode': 'git', \
'host_kernel_patch_list': '', \
'host_kernel_config': '/boot/config-2.6.38.8', \
'host_kernel_git_repo': 'git://github.com/avikivity/kvm.git', \
'vm_type': 'kvm'}
def step_init():
job.next_step([step_test])
virt_utils.install_host_kernel(job, kernel_install_params)
def step_test():
pass
本文详细介绍了Autotest客户端的使用步骤,包括下载安装、运行简单测试、查看结果、编译内核测试、并行执行、创建自定义测试及从Git更新安装内核。通过实例演示了如何配置和执行各种测试任务。
1005

被折叠的 条评论
为什么被折叠?



