skyeye-sdk-js 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,7 +70,6 @@ class RequestFactory {
70
70
  baseRequest.setArgs(args);
71
71
  const request = new skyeye_rpc_pb_1.JSONRequest();
72
72
  request.setRequest(baseRequest.toJSONString());
73
- console.log("setMemoryValue:", request);
74
73
  return request;
75
74
  }
76
75
  enableDeviceWork(deviceName) {
@@ -150,7 +149,6 @@ class RequestFactory {
150
149
  baseRequest.setArgs(args);
151
150
  const request = new skyeye_rpc_pb_1.JSONRequest();
152
151
  request.setRequest(baseRequest.toJSONString());
153
- console.log("request:", request);
154
152
  return request;
155
153
  }
156
154
  setGlobalVarValue(cpuName, varName, bytesNum, valueType, value) {
@@ -164,7 +162,6 @@ class RequestFactory {
164
162
  baseRequest.setArgs(args);
165
163
  const request = new skyeye_rpc_pb_1.JSONRequest();
166
164
  request.setRequest(baseRequest.toJSONString());
167
- console.log('setGlobalVarValue:', request);
168
165
  return request;
169
166
  }
170
167
  getDeviceList() {
@@ -182,9 +179,9 @@ class RequestFactory {
182
179
  setRegisterValue(machName, deviceName, regName, value) {
183
180
  const baseRequest = new BaseRequest_1.BaseRequest("SE_set_device_register_value");
184
181
  const args = {};
185
- args.machName = machName;
186
- args.deviceName = deviceName;
187
- args.regName = regName;
182
+ args.machname = machName;
183
+ args.devname = deviceName;
184
+ args.regname = regName;
188
185
  args.value = String(value);
189
186
  baseRequest.setArgs(args);
190
187
  const request = new skyeye_rpc_pb_1.JSONRequest();
@@ -200,7 +197,7 @@ class RequestFactory {
200
197
  getRamAddrInfo(machName, addr) {
201
198
  const baseRequest = new BaseRequest_1.BaseRequest("SE_get_mem_device_addr_info");
202
199
  const args = {};
203
- args.machName = machName;
200
+ args.machname = machName;
204
201
  args.addr = addr;
205
202
  baseRequest.setArgs(args);
206
203
  const request = new skyeye_rpc_pb_1.JSONRequest();
@@ -210,8 +207,8 @@ class RequestFactory {
210
207
  setFaultInject(machName, deviceName, addr, bit, mode) {
211
208
  const baseRequest = new BaseRequest_1.BaseRequest("SE_set_fault_inject");
212
209
  const args = {};
213
- args.machName = machName;
214
- args.deviceName = deviceName;
210
+ args.machname = machName;
211
+ args.devicename = deviceName;
215
212
  args.addr = addr;
216
213
  args.bit = bit;
217
214
  args.mode = mode;
@@ -223,8 +220,8 @@ class RequestFactory {
223
220
  deleteFaultInject(machName, deviceName, addr, bit, mode) {
224
221
  const baseRequest = new BaseRequest_1.BaseRequest("SE_delete_fault");
225
222
  const args = {};
226
- args.machName = machName;
227
- args.deviceName = deviceName;
223
+ args.machname = machName;
224
+ args.devicename = deviceName;
228
225
  args.addr = addr;
229
226
  args.bit = bit;
230
227
  args.mode = mode;
@@ -645,14 +645,14 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
645
645
  if (!deviceTree.boardMap.has(boardName)) {
646
646
  throw new SkyEyeSDKException_1.SkyEyeSDKException("未能找到该板卡");
647
647
  }
648
- const board = boardMap.get(boardName);
649
- const deviceMap = board.getDeveceMap();
650
- if (!deviceMap.has(cpuName) || !(deviceMap.get(cpuName) instanceof Cpu_1.Cpu)) {
651
- throw new SkyEyeSDKException_1.SkyEyeSDKException("未能找到该设备");
652
- }
653
- const cpu = deviceMap.get(cpuName);
648
+ // const board: Board = boardMap.get(boardName);
649
+ // const deviceMap = board.deviceMap;
650
+ // if (!deviceMap.has(cpuName) || !(deviceMap.get(cpuName) instanceof Cpu)) {
651
+ // throw new SkyEyeSDKException("未能找到该设备");
652
+ // }
653
+ // const cpu = deviceMap.get(cpuName);
654
654
  try {
655
- return yield this.call(RequestFactory_1.RequestFactory.getInstance().setRegisterValue(cpu.getParent().getName(), cpuName, registerName, value));
655
+ return yield this.call(RequestFactory_1.RequestFactory.getInstance().setRegisterValue(boardName, cpuName, registerName, value));
656
656
  }
657
657
  catch (error) {
658
658
  console.error("Error during getAddressingSpace:", error);
package/dist/test.js CHANGED
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory');
13
13
  const { SkyEyeClient } = require('./src/SkyEyeClient');
14
+ const { Cpu } = require('./src/models/Cpu');
14
15
  const json = {
15
16
  "id": "4a162d75-3a84-5264-992f-287624830ead",
16
17
  "name": "鍙戦€佸唴瀛樻秷鎭祴璇?",
@@ -182,6 +183,71 @@ const json = {
182
183
  "updatedAt": "2024-06-11T06:37:05.487Z",
183
184
  "results": []
184
185
  };
186
+ class RegisterItem {
187
+ }
188
+ var RegisterType;
189
+ (function (RegisterType) {
190
+ RegisterType[RegisterType["CPU"] = 0] = "CPU";
191
+ RegisterType[RegisterType["Device"] = 1] = "Device";
192
+ })(RegisterType || (RegisterType = {}));
193
+ function getAllRegisterList() {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ const allRegister = [];
196
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
197
+ //通过 getDeviceTree 获取板卡、设备、寄存器层级, 列出所有寄存器列表选择
198
+ const resultTree = yield client.getDeviceTree();
199
+ console.log("结果 resultTree:", JSON.stringify(resultTree));
200
+ console.log("结果 keys:", resultTree.boardMap.keys());
201
+ for (const key of resultTree.boardMap.keys()) {
202
+ const device = resultTree.boardMap.get(key);
203
+ // 在这里对获取到的键值对进行处理
204
+ console.log(`板卡: ${key},设备: ${device.deviceMap}`);
205
+ if (!device.deviceMap || device.deviceMap.keys().length == 0) {
206
+ continue;
207
+ }
208
+ for (const k of device.deviceMap.keys()) {
209
+ const register = device.deviceMap.get(k);
210
+ console.log(`设备: ${k}, 寄存器: ${register}`);
211
+ console.log("寄存器下的寄存器: ", register.registerMap);
212
+ if (!register.registerMap || register.registerMap.keys().length == 0) {
213
+ continue;
214
+ }
215
+ getRegisterMap(register, allRegister);
216
+ }
217
+ }
218
+ console.log("allRegister2:", allRegister.length);
219
+ return allRegister;
220
+ });
221
+ }
222
+ function getRegisterMap(bean, allRegister) {
223
+ if (!bean.registerMap || bean.registerMap.keys().length == 0) {
224
+ return;
225
+ }
226
+ for (const r of bean.registerMap.keys()) {
227
+ const result = bean.registerMap.get(r);
228
+ console.log(`设备: ${r}, 寄存器: ${result}`);
229
+ const item = new RegisterItem();
230
+ item.name = r.name;
231
+ if (bean instanceof Cpu) {
232
+ console.log(`寄存器类型: ${bean.className}`);
233
+ item.type = RegisterType.CPU;
234
+ }
235
+ else {
236
+ item.type = RegisterType.Device;
237
+ }
238
+ allRegister.push(item);
239
+ getRegisterMap(result, allRegister);
240
+ }
241
+ }
242
+ function setRegister() {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
245
+ const result = yield client.setCpuRegisterValue('c6713_0', 'c67x_core_0', 'FADCR_REG', '3');
246
+ console.log("setRegister:", result);
247
+ });
248
+ }
249
+ // getAllRegisterList()
250
+ setRegister();
185
251
  function test() {
186
252
  return __awaiter(this, void 0, void 0, function* () {
187
253
  // console.log("Connected to SkyEye server");
@@ -206,49 +272,59 @@ function test() {
206
272
  // const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
207
273
  // const fileName = "c6713_fc_1553b.skyeye";
208
274
  // const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
209
- const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
275
+ // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
210
276
  // const response =await client.getCurrentRunningState()
211
277
  // const response = await client.getMemoryValueDefault("128","4")
212
- const response = yield client.getGlobalVarValueDefault("number_a", "int");
278
+ // const response = await client.getGlobalVarValueDefault("number_a","int")
213
279
  // const response = await client.setGlobalVarValueDefault("number_a", "int", "12")
280
+ // const response = await client.getDeviceTree()
214
281
  // const response = await client.getMemoryValueDefault("10001", "1")
215
- console.log("response:", response);
282
+ // console.log("response:", response)
283
+ // console.log("response:", response.boardMap)
284
+ // console.log("response:", response.boardMap.keys[0])
285
+ });
286
+ }
287
+ function testMutil() {
288
+ return __awaiter(this, void 0, void 0, function* () {
289
+ const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
290
+ const fileName = "c6713_fc_1553b.skyeye";
291
+ const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe";
292
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
216
293
  //启动多个skyeye
217
- // const count = 5;
218
- // const map = new Map<number, any>;
219
- // for (let i = 1; i < count; i++) {
220
- // const port = 50050 + i
221
- // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
222
- // await client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir)
223
- // await client.RunTestcase(json)
224
- // await client.runCommand()
225
- // const res = await client.getCurrentRunningState()
226
- // console.log("state3:", res.state)
227
- // map.set(port, client);
228
- // }
229
- // for (let i = 1; i < count; i++) {
230
- // setTimeout(async () => {
231
- // const port = 50050 + i
232
- // const client = map.get(port)
233
- // await client.quitCommand()
234
- // }, i * 5000)
235
- // }
236
- // setTimeout(async () => {
237
- // // await map.get(50051).stopGrpcService("")
238
- // await map.get(50051).quitCommand()
239
- // }, 2000)
240
- // setTimeout(async () => {
241
- // // await map.get(50052).stopGrpcService("")
242
- // await map.get(50052).quitCommand()
243
- // }, 5000)
244
- // setTimeout(async () => {
245
- // // await map.get(50053).stopGrpcService("")
246
- // await map.get(50053).quitCommand()
247
- // }, 8000)
248
- // setTimeout(async () => {
249
- // // await map.get(50054).stopGrpcService("")
250
- // await map.get(50054).quitCommand()
251
- // }, 11000)
294
+ const count = 5;
295
+ const map = new Map;
296
+ for (let i = 1; i < count; i++) {
297
+ const port = 50050 + i;
298
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
299
+ yield client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir);
300
+ yield client.RunTestcase(json);
301
+ yield client.runCommand();
302
+ const res = yield client.getCurrentRunningState();
303
+ console.log("state3:", res.state);
304
+ map.set(port, client);
305
+ }
306
+ for (let i = 1; i < count; i++) {
307
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
308
+ const port = 50050 + i;
309
+ const client = map.get(port);
310
+ yield client.quitCommand();
311
+ }), i * 5000);
312
+ }
313
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
314
+ // await map.get(50051).stopGrpcService("")
315
+ yield map.get(50051).quitCommand();
316
+ }), 2000);
317
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
318
+ // await map.get(50052).stopGrpcService("")
319
+ yield map.get(50052).quitCommand();
320
+ }), 5000);
321
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
322
+ // await map.get(50053).stopGrpcService("")
323
+ yield map.get(50053).quitCommand();
324
+ }), 8000);
325
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
326
+ // await map.get(50054).stopGrpcService("")
327
+ yield map.get(50054).quitCommand();
328
+ }), 11000);
252
329
  });
253
330
  }
254
- test();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skyeye-sdk-js",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "gRPC to SkyEye",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -83,7 +83,6 @@ export class RequestFactory {
83
83
  baseRequest.setArgs(args)
84
84
  const request = new JSONRequest()
85
85
  request.setRequest(baseRequest.toJSONString());
86
- console.log("setMemoryValue:",request)
87
86
  return request;
88
87
  }
89
88
 
@@ -178,7 +177,6 @@ export class RequestFactory {
178
177
  baseRequest.setArgs(args)
179
178
  const request = new JSONRequest()
180
179
  request.setRequest(baseRequest.toJSONString());
181
- console.log("request:", request)
182
180
  return request;
183
181
  }
184
182
 
@@ -194,7 +192,6 @@ export class RequestFactory {
194
192
  baseRequest.setArgs(args)
195
193
  const request = new JSONRequest()
196
194
  request.setRequest(baseRequest.toJSONString());
197
- console.log('setGlobalVarValue:', request)
198
195
  return request;
199
196
  }
200
197
 
@@ -220,9 +217,9 @@ export class RequestFactory {
220
217
  public setRegisterValue(machName: string, deviceName: string, regName: string, value: string) {
221
218
  const baseRequest = new BaseRequest("SE_set_device_register_value");
222
219
  const args: { [key: string]: string } = {};
223
- args.machName = machName;
224
- args.deviceName = deviceName;
225
- args.regName = regName;
220
+ args.machname = machName;
221
+ args.devname = deviceName;
222
+ args.regname = regName;
226
223
  args.value = String(value);
227
224
  baseRequest.setArgs(args)
228
225
  const request = new JSONRequest()
@@ -242,7 +239,7 @@ export class RequestFactory {
242
239
  public getRamAddrInfo(machName: string, addr: string) {
243
240
  const baseRequest = new BaseRequest("SE_get_mem_device_addr_info");
244
241
  const args: { [key: string]: string } = {};
245
- args.machName = machName;
242
+ args.machname = machName;
246
243
  args.addr = addr
247
244
  baseRequest.setArgs(args)
248
245
  const request = new JSONRequest()
@@ -256,8 +253,8 @@ export class RequestFactory {
256
253
  public setFaultInject(machName: string, deviceName: string, addr: string, bit: string, mode: string) {
257
254
  const baseRequest = new BaseRequest("SE_set_fault_inject");
258
255
  const args: { [key: string]: string } = {};
259
- args.machName = machName;
260
- args.deviceName = deviceName;
256
+ args.machname = machName;
257
+ args.devicename = deviceName;
261
258
  args.addr = addr;
262
259
  args.bit = bit;
263
260
  args.mode = mode;
@@ -272,8 +269,8 @@ export class RequestFactory {
272
269
  public deleteFaultInject(machName: string, deviceName: string, addr: string, bit: string, mode: string) {
273
270
  const baseRequest = new BaseRequest("SE_delete_fault");
274
271
  const args: { [key: string]: string } = {};
275
- args.machName = machName;
276
- args.deviceName = deviceName;
272
+ args.machname = machName;
273
+ args.devicename = deviceName;
277
274
  args.addr = addr;
278
275
  args.bit = bit;
279
276
  args.mode = mode;
@@ -23,6 +23,7 @@ import { GetCpuRegisterInfoResponse } from './response/GetCpuRegisterInfoRespons
23
23
  import { SkyEyeSDKException } from './exception/SkyEyeSDKException';
24
24
  import { ServiceError } from '@grpc/grpc-js';
25
25
  import * as cp from 'child_process';
26
+ import { Board } from './models/Board';
26
27
  let client: JSONTransmissionClient | any = null;
27
28
 
28
29
 
@@ -574,14 +575,14 @@ export class SkyEyeClient extends JSONTransmissionClient {
574
575
  if (!deviceTree.boardMap.has(boardName)) {
575
576
  throw new SkyEyeSDKException("未能找到该板卡");
576
577
  }
577
- const board = boardMap.get(boardName);
578
- const deviceMap = board.getDeveceMap();
579
- if (!deviceMap.has(cpuName) || !(deviceMap.get(cpuName) instanceof Cpu)) {
580
- throw new SkyEyeSDKException("未能找到该设备");
581
- }
582
- const cpu = deviceMap.get(cpuName);
578
+ // const board: Board = boardMap.get(boardName);
579
+ // const deviceMap = board.deviceMap;
580
+ // if (!deviceMap.has(cpuName) || !(deviceMap.get(cpuName) instanceof Cpu)) {
581
+ // throw new SkyEyeSDKException("未能找到该设备");
582
+ // }
583
+ // const cpu = deviceMap.get(cpuName);
583
584
  try {
584
- return await this.call(RequestFactory.getInstance().setRegisterValue(cpu.getParent().getName(), cpuName, registerName, value));
585
+ return await this.call(RequestFactory.getInstance().setRegisterValue(boardName, cpuName, registerName, value));
585
586
  } catch (error) {
586
587
  console.error("Error during getAddressingSpace:", error);
587
588
  throw error;
package/test.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { JSONResponse } from "./src/proto/skyeye_rpc_pb";
2
2
  import { GrpcUtil } from "./src/GrpcUtil";
3
3
  import { ServiceError } from "@grpc/grpc-js";
4
+ import { Enum } from "protobufjs";
4
5
 
5
6
  const { SkyEyeClientFactory } = require('./src/SkyEyeClientFactory')
6
7
  const { SkyEyeClient } = require('./src/SkyEyeClient')
7
8
 
8
-
9
+ const { Cpu } = require('./src/models/Cpu')
9
10
 
10
11
  const json = {
11
12
  "id": "4a162d75-3a84-5264-992f-287624830ead",
@@ -180,9 +181,95 @@ const json = {
180
181
  }
181
182
 
182
183
 
184
+ class RegisterItem {
185
+ name: string;
186
+ type: RegisterType; //0 cpu寄存器 1 设备寄存器
187
+ deviceName: string; //设备名称
188
+ boardName: string;
189
+ }
183
190
 
184
- async function test() {
191
+ enum RegisterType {
192
+ CPU,
193
+ Device
194
+ }
195
+
196
+
197
+
198
+ async function getAllRegisterList() {
199
+ const allRegister: RegisterItem[] = [];
200
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
201
+
202
+ //通过 getDeviceTree 获取板卡、设备、寄存器层级, 列出所有寄存器列表选择
203
+
204
+ const resultTree = await client.getDeviceTree()
205
+ console.log("结果 resultTree:", JSON.stringify(resultTree))
206
+ console.log("结果 keys:", resultTree.boardMap.keys())
207
+
208
+ for (const key of resultTree.boardMap.keys()) {
209
+ const device = resultTree.boardMap.get(key);
210
+ // 在这里对获取到的键值对进行处理
211
+ console.log(`板卡: ${key},设备: ${device.deviceMap}`);
212
+
213
+ if (!device.deviceMap || device.deviceMap.keys().length == 0) {
214
+ continue
215
+ }
216
+
217
+ for (const k of device.deviceMap.keys()) {
218
+ const register = device.deviceMap.get(k);
219
+ console.log(`设备: ${k}, 寄存器: ${register}`);
220
+ console.log("寄存器下的寄存器: ", register.registerMap)
221
+ if (!register.registerMap || register.registerMap.keys().length == 0) {
222
+ continue
223
+ }
224
+ getRegisterMap(register, allRegister)
225
+
226
+ }
227
+ }
228
+ console.log("allRegister2:", allRegister.length)
229
+ return allRegister;
230
+ }
231
+
232
+
233
+
234
+ function getRegisterMap(bean: any, allRegister: RegisterItem[]) {
235
+ if (!bean.registerMap || bean.registerMap.keys().length == 0) {
236
+ return
237
+ }
238
+
239
+ for (const r of bean.registerMap.keys()) {
240
+ const result = bean.registerMap.get(r);
241
+ console.log(`设备: ${r}, 寄存器: ${result}`);
242
+
243
+ const item = new RegisterItem()
244
+ item.name = r.name
245
+
246
+ if (bean instanceof Cpu) {
247
+ console.log(`寄存器类型: ${bean.className}`);
248
+ item.type = RegisterType.CPU
249
+ } else {
250
+ item.type = RegisterType.Device
251
+ }
252
+ allRegister.push(item)
253
+ getRegisterMap(result, allRegister)
254
+ }
255
+ }
185
256
 
257
+
258
+
259
+
260
+ async function setRegister() {
261
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
262
+ const result = await client.setCpuRegisterValue('c6713_0', 'c67x_core_0', 'FADCR_REG', '3')
263
+ console.log("setRegister:", result)
264
+
265
+ }
266
+
267
+ // getAllRegisterList()
268
+ setRegister()
269
+
270
+
271
+
272
+ async function test() {
186
273
  // console.log("Connected to SkyEye server");
187
274
  // await client.getDeviceList();
188
275
  // await client.getCurrentCpuMips();
@@ -202,10 +289,6 @@ async function test() {
202
289
 
203
290
 
204
291
  // await client.initSkyEyeAndRun(pathSkyEye,fileName,port,skyeyeDir);
205
-
206
-
207
-
208
-
209
292
  // const pathSkyEye = "D:/data/case/c6713_demo";
210
293
  // const fileName = "c6713_demo.skyeye";
211
294
  // const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
@@ -220,68 +303,76 @@ async function test() {
220
303
  // const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
221
304
 
222
305
 
223
- const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
306
+ // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
224
307
 
225
308
  // const response =await client.getCurrentRunningState()
226
309
  // const response = await client.getMemoryValueDefault("128","4")
227
- const response = await client.getGlobalVarValueDefault("number_a","int")
310
+ // const response = await client.getGlobalVarValueDefault("number_a","int")
228
311
  // const response = await client.setGlobalVarValueDefault("number_a", "int", "12")
229
312
 
313
+ // const response = await client.getDeviceTree()
230
314
 
231
315
 
232
316
  // const response = await client.getMemoryValueDefault("10001", "1")
233
- console.log("response:", response)
317
+ // console.log("response:", response)
318
+ // console.log("response:", response.boardMap)
319
+ // console.log("response:", response.boardMap.keys[0])
320
+ }
234
321
 
235
- //启动多个skyeye
236
- // const count = 5;
237
- // const map = new Map<number, any>;
238
- // for (let i = 1; i < count; i++) {
239
- // const port = 50050 + i
240
- // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
241
- // await client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir)
242
- // await client.RunTestcase(json)
243
- // await client.runCommand()
244
- // const res = await client.getCurrentRunningState()
245
- // console.log("state3:", res.state)
246
- // map.set(port, client);
247
- // }
248
- // for (let i = 1; i < count; i++) {
249
- // setTimeout(async () => {
250
- // const port = 50050 + i
251
- // const client = map.get(port)
252
- // await client.quitCommand()
253
- // }, i * 5000)
254
- // }
255
322
 
256
323
 
257
324
 
258
325
 
259
326
 
260
327
 
261
- // setTimeout(async () => {
262
- // // await map.get(50051).stopGrpcService("")
263
- // await map.get(50051).quitCommand()
264
- // }, 2000)
265
328
 
266
- // setTimeout(async () => {
267
- // // await map.get(50052).stopGrpcService("")
268
- // await map.get(50052).quitCommand()
269
- // }, 5000)
270
329
 
271
- // setTimeout(async () => {
272
- // // await map.get(50053).stopGrpcService("")
273
- // await map.get(50053).quitCommand()
274
- // }, 8000)
330
+ async function testMutil() {
275
331
 
276
- // setTimeout(async () => {
277
- // // await map.get(50054).stopGrpcService("")
278
- // await map.get(50054).quitCommand()
279
- // }, 11000)
332
+ const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
333
+ const fileName = "c6713_fc_1553b.skyeye";
334
+ const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
335
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
280
336
 
281
337
 
338
+ //启动多个skyeye
339
+ const count = 5;
340
+ const map = new Map<number, any>;
341
+ for (let i = 1; i < count; i++) {
342
+ const port = 50050 + i
343
+ const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', port.toString());
344
+ await client.initSkyEyeAndRun2(pathSkyEye, fileName, port.toString(), skyeyeDir)
345
+ await client.RunTestcase(json)
346
+ await client.runCommand()
347
+ const res = await client.getCurrentRunningState()
348
+ console.log("state3:", res.state)
349
+ map.set(port, client);
350
+ }
351
+ for (let i = 1; i < count; i++) {
352
+ setTimeout(async () => {
353
+ const port = 50050 + i
354
+ const client = map.get(port)
355
+ await client.quitCommand()
356
+ }, i * 5000)
357
+ }
358
+
359
+ setTimeout(async () => {
360
+ // await map.get(50051).stopGrpcService("")
361
+ await map.get(50051).quitCommand()
362
+ }, 2000)
363
+
364
+ setTimeout(async () => {
365
+ // await map.get(50052).stopGrpcService("")
366
+ await map.get(50052).quitCommand()
367
+ }, 5000)
368
+
369
+ setTimeout(async () => {
370
+ // await map.get(50053).stopGrpcService("")
371
+ await map.get(50053).quitCommand()
372
+ }, 8000)
373
+
374
+ setTimeout(async () => {
375
+ // await map.get(50054).stopGrpcService("")
376
+ await map.get(50054).quitCommand()
377
+ }, 11000)
282
378
  }
283
- test();
284
-
285
-
286
-
287
-