代码拉取完成,页面将自动刷新
同步操作将从 anolis/tone-cli 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/env python3
# coding=utf-8
import os
import sys
common_head = """#!/bin/bash
# Avaliable environment:
#
# Download variable:
# WEB_URL=
# GIT_URL=
"""
def write2file(fn, string):
with open(fn, "w+") as fh:
fh.write(string)
def init_install(fn):
install = common_head + """
# fetch()
build()
{
:
}
install()
{
:
}
"""
write2file(fn, install)
def init_run(fn):
run = common_head + """
run()
{
echo "Please implement your test run step at here"
}
parse()
{
$TONE_BM_SUITE_DIR/parse.py
}
"""
write2file(fn, run)
def init_parse(fn):
parse = """#!/bin/env python3
import sys
import re
with sys.stdin as file:
# '''If you don't need to use stdin just pass it'''
pass
# '''If you want to proces stdin can use below codes'''
# for line in file:
# pass
# functional output should be:
# Tone_default_test: Pass/Fail/Skip
# benchmark test output should be:
# performance_indext: value unit
# Eg.
# bond_width: 10.0 MBps
# unit is optional
# Eg.
# score: 100.0
print("Tone_default_test: Pass")
"""
write2file(fn, parse)
os.chmod(fn, 0o755)
def init_readme(fn, test):
readme = "# " + test + """
## Description
About the test suite
## Homepage
[http://](http://)
## Version
## Category
functional/benchmarck/stress
## Parameters
- __value__ : about the value
## Results
```
result: value
```
## Manual Run
```
step n: xxxx
```
"""
write2file(fn, readme)
def init_test_directory(path):
if not os.path.exists(path):
os.makedirs(path)
if __name__ == '__main__':
test = sys.argv[1]
test_path = os.path.join(".", "tests", test)
init_test_directory(test_path)
init_install(os.path.join(test_path, 'install.sh'))
init_run(os.path.join(test_path, 'run.sh'))
init_parse(os.path.join(test_path, 'parse.py'))
init_readme(os.path.join(test_path, 'Readme.md'), test)
print("Done. init test: {}".format(test_path))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。