MCPcopy Create free account
hub / github.com/LanceLRQ/deer-executor / CallGenerator

Function CallGenerator

common/utils/binary.go:142–165  ·  view source on GitHub ↗

CallGenerator 调用Generator

(ctx context.Context, tc *structs.TestCase, configDir string)

Source from the content-addressed store, hash-verified

140
141// CallGenerator 调用Generator
142func CallGenerator(ctx context.Context, tc *structs.TestCase, configDir string) ([]byte, error) {
143 name, args, err := ParseGeneratorScript(tc.Generator)
144 if err != nil {
145 return nil, err
146 }
147 gBin, err := GetCompiledBinaryFileAbsPath("generator", name, configDir)
148 if err != nil {
149 return nil, err
150 }
151 rel, err := RunUnixShell(&structs.ShellOptions{
152 Context: ctx,
153 Name: gBin,
154 Args: args,
155 StdWriter: nil,
156 OnStart: nil,
157 })
158 if err != nil {
159 return nil, err
160 }
161 if rel.Success {
162 return []byte(rel.Stdout), nil
163 }
164 return nil, errors.Errorf("generator error")
165}
166
167// IsZipFile 判断是否是Zip文件
168func IsZipFile(filePath string) (bool, error) {

Callers 2

runTestCaseGenFunction · 0.92
runTestCaseFunction · 0.92

Calls 4

ParseGeneratorScriptFunction · 0.85
RunUnixShellFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected