提交 92efd864 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

ztf test scripts

上级 a165f814
title: 私有IP
desc: 引用系统IP定义
author: zentao
version: 1.0
field: privateIP
instances:
- instance: all
fields:
- field: part1
from: system.ip.v1.yaml
use: privateA, privateB, privateC
prefix: ""
postfix: "/"
- field: part2
from: custom.test.number.v1.yaml
use: netmask
\ No newline at end of file
title: number
desc: 数字分组
author: wwccss
version: 1.0
field: number
note: 数值类型数据
prefix: "'"
postfix: "'"
ranges:
small: 1-9
medium: 101-199
large: 10001-99999
netmask: 8,16,24
\ No newline at end of file
title: IP地址
desc: 含有多种实现的示例。
author: wwccss
version: 1.0
field: ip
instances:
- instance: privateC
note: C类IP地址
prefix: 192.168.
fields:
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
- instance: privateB
note: B类IP地址
prefix: 172.
fields:
- field: part2
range: 16-31
postfix: .
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
- instance: privateA
note: A类IP地址
prefix: 10.
fields:
- field: part2
range: 0-254
postfix: .
- field: part3
range: 0-254
postfix: .
- field: part4
range: 1-254
\ No newline at end of file
>> 3
>> int_1
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '../common/zd.php';
$zd = new zendata();
$output = $zd->create("", "default.yaml", 3, "", array("fields"=>"field_common"));
$count = sprintf("%d", count($output));
print(">> $count\n");
print(">> $output[0]\n");
\ No newline at end of file
>> `%s zendata config %s`
>> `%s zendata config %s`
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '../common/zd.php';
$zd = new zendata();
$output = $zd->cmd("-e");
print(">> $output[0]\n");
$output = $zd->cmd("-example");
print(">> $output[0]\n");
\ No newline at end of file
>> system.ip.v1
>> system.ip.v1
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
>>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '../common/zd.php';
$zd = new zendata();
$output = $zd->cmd("-l");
print(">> $output[0]\n");
$output = $zd->cmd("-list");
print(">> $output[0]\n");
\ No newline at end of file
>> `ZenData is %s`
>> `ZenData is %s`
>> `ZenData is %s`
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
>>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '../common/zd.php';
$zd = new zendata();
$output = $zd->cmd("");
print(">> $output[0]\n");
$output = $zd->cmd("-h");
print(">> $output[0]\n");
$output = $zd->cmd("-help");
print(">> $output[0]\n");
\ No newline at end of file
>> `ZenData is %s`
>> `ZenData is %s`
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once __DIR__ . DIRECTORY_SEPARATOR . '../common/zd.php';
$zd = new zendata();
$output = $zd->cmd("-v");
print(">> $output[0]\n");
$output = $zd->cmd("-view");
print(">> $output[0]\n");
\ No newline at end of file
<?php
$config['zd']['win64'] = "../../bin/zendata/1.2.0/win64/zd.exe";
$config['zd']['win32'] = "../../bin/zendata/1.2.0/win32/zd.exe";
$config['zd']['linux'] = "../../bin/zendata/1.2.0/linux/zd";
$config['zd']['mac'] = "../../bin/zendata/1.2.0/mac/zd";
$config['zd']['workDir'] = "../../demo";
\ No newline at end of file
#!/usr/bin/env php
<?php
if (!function_exists('simplexml_load_file')) {
print("simplexml_load_file missing, pls use 'sudo apt-get install php7.0-simplexml' to install\n");
}
\ No newline at end of file
<?php
include_once __DIR__ . DIRECTORY_SEPARATOR . 'config.php';
function getZdCmd()
{
global $config;
$os = strtolower(PHP_OS);
$osBits = getOsBits();
if (strpos($os, "win") == 0) {
$os = $os . $osBits;
} else if ($os == "darwin") {
$os = "mac";
}
print("os = $os \n");
$ret = $config['zd'][$os];
if ($ret == '') {
die('Please test on windows, linux or mac os.\n');
} else {
print("cmdPath is $ret \n");
}
return $ret;
}
function getDemoDir()
{
$path = "../../demo";
print("demo dir is $path\n");
return $path;
}
function getOsBits() {
$int = "9223372036854775807";
$int = intval($int);
if ($int == 9223372036854775807) {
return "64";
} else if ($int == 2147483647) {
return "32";
} else {
return "";
}
}
<?php
include_once __DIR__ . DIRECTORY_SEPARATOR . 'utils.php';
class zendata
{
var $cmdPath;
var $workDir;
public function __construct()
{
global $config;
$this->cmdPath = getZdCmd();
$this->workDir = $config['zd']['workDir'];
}
public function cmd($params)
{
$cmdStr = sprintf("%s %s", $this->cmdPath, $params);
print("$cmdStr\n");
$output = [];
exec($cmdStr, $output);
return $output;
}
public function create($default, $conf, $lines, $output, $options = array())
{
$cmdStr = sprintf("%s -c %s/%s -n %d -F %s",
$this->cmdPath, $this->workDir, $conf, $lines, $options["fields"]);
print("$cmdStr\n");
$output = [];
exec($cmdStr, $output);
return $output;
}
public function parse($config, $input)
{
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册