Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
9d4f389f
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9d4f389f
编写于
1月 05, 2016
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'apahim/port_autotest_tests'
上级
b921fb84
0962637f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
132 addition
and
0 deletion
+132
-0
avocado/utils/disk.py
avocado/utils/disk.py
+26
-0
examples/tests/stress.py
examples/tests/stress.py
+91
-0
examples/tests/stress.py.data/stress-1.0.4.tar.gz
examples/tests/stress.py.data/stress-1.0.4.tar.gz
+0
-0
examples/tests/stress.py.data/stress.yaml
examples/tests/stress.py.data/stress.yaml
+15
-0
未找到文件。
avocado/utils/disk.py
0 → 100644
浏览文件 @
9d4f389f
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# This code was inspired in the autotest project,
#
# client/base_utils.py
"""
Disk utilities
"""
import
os
def
freespace
(
path
):
fs_stats
=
os
.
statvfs
(
path
)
return
fs_stats
.
f_bsize
*
fs_stats
.
f_bavail
examples/tests/stress.py
0 → 100755
浏览文件 @
9d4f389f
#!/usr/bin/env python
import
os
import
multiprocessing
from
avocado
import
Test
from
avocado
import
main
from
avocado.utils
import
archive
from
avocado.utils
import
disk
from
avocado.utils
import
build
from
avocado.utils
import
memory
from
avocado.utils
import
process
class
Stress
(
Test
):
"""
Calls stress, a simple program which aims to impose certain types of
computing stress on the target machine.
@author: Yi Yang (yang.y.yi@gmail.com)
"""
def
setUp
(
self
):
"""
Build 'stress'.
Source:
http://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz
"""
stress_tarball
=
self
.
params
.
get
(
'stress_tarball'
,
default
=
'stress-1.0.4.tar.gz'
)
tarball_path
=
self
.
get_data_path
(
stress_tarball
)
archive
.
extract
(
tarball_path
,
self
.
srcdir
)
stress_version
=
stress_tarball
.
split
(
'.tar.'
)[
0
]
self
.
srcdir
=
os
.
path
.
join
(
self
.
srcdir
,
stress_version
)
os
.
chdir
(
self
.
srcdir
)
process
.
run
(
'./configure'
)
build
.
make
(
self
.
srcdir
)
def
test
(
self
):
"""
Execute 'stress' with proper arguments.
"""
length
=
self
.
params
.
get
(
'stress_lenght'
,
default
=
60
)
threads
=
self
.
params
.
get
(
'threads'
,
default
=
None
)
memory_per_thread
=
self
.
params
.
get
(
'memory_per_thread'
,
default
=
None
)
file_size_per_thread
=
self
.
params
.
get
(
'file_size_per_thread'
,
default
=
None
)
if
threads
is
None
:
# We will use 2 workers of each type for each CPU detected
threads
=
2
*
multiprocessing
.
cpu_count
()
if
memory_per_thread
is
None
:
# Sometimes the default memory used by each memory worker (256 M)
# might make our machine go OOM and then funny things might start to
# happen. Let's avoid that.
mb
=
(
memory
.
freememtotal
()
+
memory
.
read_from_meminfo
(
'SwapFree'
)
/
2
)
memory_per_thread
=
(
mb
*
1024
)
/
threads
if
file_size_per_thread
is
None
:
# Even though unlikely, it's good to prevent from allocating more
# disk than this machine actually has on its autotest directory
# (limit the amount of disk used to max of 90 % of free space)
free_disk
=
disk
.
freespace
(
self
.
srcdir
)
file_size_per_thread
=
1024
**
2
if
(
0.9
*
free_disk
)
<
file_size_per_thread
*
threads
:
file_size_per_thread
=
(
0.9
*
free_disk
)
/
threads
# Number of CPU workers spinning on sqrt()
args
=
'--cpu %d '
%
threads
# Number of IO workers spinning on sync()
args
+=
'--io %d '
%
threads
# Number of Memory workers spinning on malloc()/free()
args
+=
'--vm %d '
%
threads
# Amount of memory used per each worker
args
+=
'--vm-bytes %d '
%
memory_per_thread
# Number of HD workers spinning on write()/ulink()
args
+=
'--hdd %d '
%
threads
# Size of the files created by each worker in bytes
args
+=
'--hdd-bytes %d '
%
file_size_per_thread
# Time for which the stress test will run
args
+=
'--timeout %d '
%
length
# Verbose flag
args
+=
'--verbose'
os
.
chdir
(
self
.
srcdir
)
cmd
=
(
'./src/stress %s'
%
args
)
process
.
run
(
cmd
)
if
__name__
==
"__main__"
:
main
()
examples/tests/stress.py.data/stress-1.0.4.tar.gz
0 → 100644
浏览文件 @
9d4f389f
文件已添加
examples/tests/stress.py.data/stress.yaml
0 → 100644
浏览文件 @
9d4f389f
setup
:
duration
:
!mux
default
:
stress_lenght
:
60
quick
:
stress_lenght
:
5
workers
:
!mux
default
:
threads
:
null
minimal
:
threads
:
1
memory
:
memory_per_thread
:
null
files
:
file_size_per_thread
:
null
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录