Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
4d4be853
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
10 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4d4be853
编写于
2月 15, 2022
作者:
m0_58228130
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
expect and fix issues
上级
41b8681c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
118 addition
and
42 deletion
+118
-42
cmd/command/main.go
cmd/command/main.go
+6
-1
internal/comm/consts/var.go
internal/comm/consts/var.go
+3
-3
internal/comm/helper/exec/ztf.go
internal/comm/helper/exec/ztf.go
+2
-2
internal/command/action/expect.go
internal/command/action/expect.go
+48
-0
internal/command/config/config.go
internal/command/config/config.go
+59
-13
internal/command/index.go
internal/command/index.go
+0
-23
未找到文件。
cmd/command/main.go
浏览文件 @
4d4be853
...
...
@@ -5,6 +5,7 @@ import (
"github.com/aaronchen2k/deeptest/internal/comm/consts"
"github.com/aaronchen2k/deeptest/internal/command"
"github.com/aaronchen2k/deeptest/internal/command/action"
commandConfig
"github.com/aaronchen2k/deeptest/internal/command/config"
_consts
"github.com/aaronchen2k/deeptest/internal/pkg/consts"
commonUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/common"
fileUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/file"
...
...
@@ -102,6 +103,10 @@ func main() {
files
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
action
.
Extract
(
files
)
case
"expect"
:
files
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
action
.
GenExpectFiles
(
files
)
case
"checkout"
,
"co"
:
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
2
:
]);
err
==
nil
{
action
.
Generate
(
productId
,
moduleId
,
suiteId
,
taskId
,
independentFile
,
language
,
actionModule
)
...
...
@@ -223,7 +228,7 @@ func run(args []string, actionModule *command.IndexModule) {
func
init
()
{
cleanup
()
command
.
InitConfig
()
command
Config
.
Init
()
}
func
cleanup
()
{
...
...
internal/comm/consts/var.go
浏览文件 @
4d4be853
...
...
@@ -9,9 +9,9 @@ var (
LanguageEn
=
"en"
Language
=
LanguageZh
Verbose
=
true
IsRelease
bool
//
ExeDir string
Verbose
=
true
IsRelease
bool
ExeDir
string
WorkDir
string
ExecLogDir
string
LogDir
string
...
...
internal/comm/helper/exec/ztf.go
浏览文件 @
4d4be853
...
...
@@ -77,7 +77,7 @@ func RunZtf(ch chan int, sendOutputMsg, sendExecMsg func(info, isRunning string,
conf
:=
configUtils
.
LoadByProjectPath
(
projectPath
)
casesToRun
,
casesToIgnore
:=
f
ilterCases
(
cases
,
conf
)
casesToRun
,
casesToIgnore
:=
F
ilterCases
(
cases
,
conf
)
numbMaxWidth
:=
0
numbMaxWidth
,
pathMaxWidth
=
getNumbMaxWidth
(
casesToRun
)
...
...
@@ -318,7 +318,7 @@ ExitCurrCase:
return
}
func
f
ilterCases
(
cases
[]
string
,
conf
commDomain
.
ProjectConf
)
(
casesToRun
,
casesToIgnore
[]
string
)
{
func
F
ilterCases
(
cases
[]
string
,
conf
commDomain
.
ProjectConf
)
(
casesToRun
,
casesToIgnore
[]
string
)
{
for
_
,
cs
:=
range
cases
{
if
commonUtils
.
IsWin
()
{
if
path
.
Ext
(
cs
)
==
".sh"
{
// filter by os
...
...
internal/command/action/expect.go
0 → 100644
浏览文件 @
4d4be853
package
action
import
(
commConsts
"github.com/aaronchen2k/deeptest/internal/comm/consts"
configUtils
"github.com/aaronchen2k/deeptest/internal/comm/helper/config"
_scriptUtils
"github.com/aaronchen2k/deeptest/internal/comm/helper/exec"
scriptUtils
"github.com/aaronchen2k/deeptest/internal/comm/helper/script"
fileUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/file"
i118Utils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/i118"
logUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/log"
"github.com/kataras/iris/v12/websocket"
"path/filepath"
)
func
GenExpectFiles
(
files
[]
string
)
error
{
var
cases
[]
string
for
_
,
v1
:=
range
files
{
group
:=
scriptUtils
.
LoadScriptByProject
(
v1
)
for
_
,
v2
:=
range
group
{
cases
=
append
(
cases
,
v2
)
}
}
if
len
(
cases
)
<
1
{
logUtils
.
Info
(
"
\n
"
+
i118Utils
.
Sprintf
(
"no_cases"
))
return
nil
}
conf
:=
configUtils
.
LoadByProjectPath
(
commConsts
.
WorkDir
)
casesToRun
,
_
:=
_scriptUtils
.
FilterCases
(
cases
,
conf
)
dryRunScripts
(
casesToRun
)
return
nil
}
func
dryRunScripts
(
casesToRun
[]
string
)
{
for
_
,
file
:=
range
casesToRun
{
dryRunScript
(
file
)
}
}
func
dryRunScript
(
file
string
)
{
conf
:=
configUtils
.
LoadByProjectPath
(
commConsts
.
WorkDir
)
wsMsg
:=
websocket
.
Message
{}
out
,
_
:=
_scriptUtils
.
RunScript
(
file
,
commConsts
.
WorkDir
,
conf
,
nil
,
nil
,
nil
,
wsMsg
)
expFile
:=
filepath
.
Join
(
filepath
.
Dir
(
file
),
fileUtils
.
GetFileNameWithoutExt
(
file
)
+
".exp"
)
fileUtils
.
WriteFile
(
expFile
,
out
)
}
internal/command/config/config.go
浏览文件 @
4d4be853
package
commandConfig
import
(
"bytes"
"fmt"
commConsts
"github.com/aaronchen2k/deeptest/internal/comm/consts"
configUtils
"github.com/aaronchen2k/deeptest/internal/comm/helper/config"
"github.com/aaronchen2k/deeptest/internal/pkg/consts"
commonUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/common"
"github.com/aaronchen2k/deeptest/internal/pkg/lib/display"
fileUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/file"
i118Utils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/i118"
langUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/lang"
logUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/log"
resUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/res"
stdinUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/stdin"
"github.com/aaronchen2k/deeptest/internal/server/modules/v1/repo
"
serverConfig
"github.com/aaronchen2k/deeptest/internal/server/config
"
"github.com/fatih/color"
"github.com/spf13/viper"
"os"
"path/filepath"
"reflect"
)
type
ConfigCtrl
struct
{
ProjectRepo
*
repo
.
ProjectRepo
`inject:""`
func
CheckConfigPermission
()
{
err
:=
fileUtils
.
MkDirIfNeeded
(
commConsts
.
ExeDir
+
"conf"
)
if
err
!=
nil
{
msg
:=
i118Utils
.
Sprintf
(
"perm_deny"
,
commConsts
.
ExeDir
)
logUtils
.
ExecConsolef
(
color
.
FgRed
,
msg
)
os
.
Exit
(
0
)
}
}
//func CheckConfigPermission() {
// //err := syscall.Access(vari.ExeDir, syscall.O_RDWR)
//
// err := fileUtils.MkDirIfNeeded(commConsts.ExeDir + "conf")
// if err != nil {
// msg := i118Utils.Sprintf("perm_deny", commConsts.ExeDir)
// logUtils.ExecConsolef(color.FgRed, msg)
// os.Exit(0)
// }
//}
func
InitConfig
()
{
commConsts
.
IsRelease
=
commonUtils
.
IsRelease
()
commConsts
.
WorkDir
=
fileUtils
.
GetWorkDir
()
commConsts
.
ConfigPath
=
commConsts
.
WorkDir
+
commConsts
.
ConfigFile
serverConfig
.
InitExecLog
(
commConsts
.
WorkDir
)
if
commConsts
.
Verbose
{
fmt
.
Printf
(
"
\n
launch %s%s in %s
\n
"
,
""
,
commConsts
.
App
,
commConsts
.
WorkDir
)
}
v
:=
viper
.
New
()
serverConfig
.
VIPER
=
v
serverConfig
.
VIPER
.
SetConfigType
(
"yaml"
)
configRes
:=
filepath
.
Join
(
"res"
,
commConsts
.
AppServer
+
".yaml"
)
yamlDefault
,
_
:=
resUtils
.
ReadRes
(
configRes
)
if
err
:=
serverConfig
.
VIPER
.
ReadConfig
(
bytes
.
NewBuffer
(
yamlDefault
));
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"读取默认配置文件错误: %w "
,
err
))
}
if
err
:=
serverConfig
.
VIPER
.
Unmarshal
(
&
serverConfig
.
CONFIG
);
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"同步配置文件错误: %w "
,
err
))
}
return
}
func
Init
()
{
InitConfig
()
serverConfig
.
InitLog
()
//commandConfig.CheckConfigPermission()
// screen size
InitScreenSize
()
// internationalization
i118Utils
.
Init
(
commConsts
.
Language
,
commConsts
.
AppServer
)
langUtils
.
GetExtToNameMap
()
commConsts
.
ComeFrom
=
"cmd"
return
}
func
InitScreenSize
()
{
w
,
h
:=
display
.
GetScreenSize
()
consts
.
ScreenWidth
=
w
...
...
internal/command/index.go
浏览文件 @
4d4be853
package
command
import
(
commConsts
"github.com/aaronchen2k/deeptest/internal/comm/consts"
commandConfig
"github.com/aaronchen2k/deeptest/internal/command/config"
i118Utils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/i118"
langUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/lang"
serverConfig
"github.com/aaronchen2k/deeptest/internal/server/config"
"github.com/aaronchen2k/deeptest/internal/server/modules/v1/service"
)
func
InitConfig
()
{
serverConfig
.
Init
()
serverConfig
.
InitLog
()
//commandConfig.CheckConfigPermission()
// screen size
commandConfig
.
InitScreenSize
()
// internationalization
i118Utils
.
Init
(
commConsts
.
Language
,
commConsts
.
AppServer
)
langUtils
.
GetExtToNameMap
()
commConsts
.
ComeFrom
=
"cmd"
return
}
type
IndexModule
struct
{
ProjectService
*
service
.
ProjectService
`inject:""`
SyncService
*
service
.
SyncService
`inject:""`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录