|
@@ -39,6 +39,7 @@ public class TraceDaemon extends Thread{
|
|
|
private boolean stopImmediately = false;
|
|
|
private boolean needGenerateReport;
|
|
|
private String reportType;
|
|
|
+ private boolean needCrowdSourcedAnalysis = false;
|
|
|
|
|
|
public TraceDaemon(String traceId, int minutes, List<CoverageTest> deviceThreads,
|
|
|
boolean needGenerateReport, String reportType){
|
|
@@ -52,6 +53,10 @@ public class TraceDaemon extends Thread{
|
|
|
apkService = (ApkService) BeanFactory.getBean(ApkService.class);
|
|
|
}
|
|
|
|
|
|
+ public void setNeedCrowdSourcedAnalysis(boolean i){
|
|
|
+ needCrowdSourcedAnalysis = i;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void run() {
|
|
|
boolean allTaskEnd = false;
|
|
@@ -106,6 +111,17 @@ public class TraceDaemon extends Thread{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void crowdSourcedAnalysis(){
|
|
|
+ try {
|
|
|
+ PrintUtil.print("Generate crowd sourced report by bb2h.jar.", TAG);
|
|
|
+ String command = String.format("java -jar tasks/bb2h.jar %s", traceId);
|
|
|
+ String result = OsUtil.runCommand(command);
|
|
|
+ PrintUtil.print(result, TAG);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void generateReport(){
|
|
|
traceService.updateTraceStatue(traceId, TraceStatus.GEN_REPORT);
|
|
|
// 上传截图到OSS
|
|
@@ -128,8 +144,12 @@ public class TraceDaemon extends Thread{
|
|
|
String command = String.format("java -jar tasks/%s.jar %s", reportType, traceId);
|
|
|
String result = OsUtil.runCommand(command);
|
|
|
PrintUtil.print(result, TAG);
|
|
|
- } catch (Exception ignored) {
|
|
|
- }
|
|
|
+
|
|
|
+ // 如果需要众包分析,那么就调用bb2h工具,改写BugReport.json
|
|
|
+ if (needCrowdSourcedAnalysis){
|
|
|
+ crowdSourcedAnalysis();
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) { }
|
|
|
PrintUtil.print(String.format("Upload %s report json file", reportType), TAG);
|
|
|
// 上传data.json文件
|
|
|
File data = new File(AddressUtil.getDataJsonPath(traceId));
|