распаковка дампа сообщений, и сохранение журналов версий.
This commit is contained in:
6
.idea/workspace.xml
generated
6
.idea/workspace.xml
generated
@@ -8,10 +8,8 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/Json/SapforVersion_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/Json/SapforVersion_json.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/PerformSapforTask.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/OpenSapforVersionPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/OpenSapforVersionPass.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTask/SapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTask/SapforTask.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTask/SapforTasksDBTable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTask/SapforTasksDBTable.java" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"InstructionPath": "",
|
"InstructionPath": "",
|
||||||
"PerformanceAnalyzerPath": "",
|
"PerformanceAnalyzerPath": "",
|
||||||
"ComponentsBackUpsCount": 10,
|
"ComponentsBackUpsCount": 10,
|
||||||
"TestingKernels": 16,
|
"TestingKernels": 14,
|
||||||
"AutoCheckTesting": false,
|
"AutoCheckTesting": false,
|
||||||
"CheckTestingIntervalSeconds": 15,
|
"CheckTestingIntervalSeconds": 15,
|
||||||
"EmailOnTestingProgress": true
|
"EmailOnTestingProgress": true
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package SapforTestingSystem.Json;
|
|||||||
import Common.Constants;
|
import Common.Constants;
|
||||||
import Common.Global;
|
import Common.Global;
|
||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
|
import ProjectData.Files.DBProjectFile;
|
||||||
import ProjectData.Files.FileType;
|
import ProjectData.Files.FileType;
|
||||||
import ProjectData.Files.ProjectFile;
|
import ProjectData.Files.ProjectFile;
|
||||||
import ProjectData.LanguageName;
|
import ProjectData.LanguageName;
|
||||||
|
import ProjectData.Messages.Errors.MessageError;
|
||||||
import ProjectData.Project.db_project_info;
|
import ProjectData.Project.db_project_info;
|
||||||
import SapforTestingSystem.SapforTask.SapforTask;
|
import SapforTestingSystem.SapforTask.SapforTask;
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
@@ -15,6 +17,9 @@ import java.io.Serializable;
|
|||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import static java.lang.Character.isDigit;
|
||||||
public class SapforVersion_json implements Serializable {
|
public class SapforVersion_json implements Serializable {
|
||||||
@Expose
|
@Expose
|
||||||
public String version = "";
|
public String version = "";
|
||||||
@@ -105,6 +110,127 @@ public class SapforVersion_json implements Serializable {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
public MessageError unpackMessage(String line_in) throws Exception {
|
||||||
|
MessageError res = new MessageError();
|
||||||
|
res.file = "";
|
||||||
|
res.line = Constants.Nan;
|
||||||
|
res.value = "";
|
||||||
|
String line = line_in.substring(9);
|
||||||
|
//System.out.println(line);
|
||||||
|
int i = 0;
|
||||||
|
int s = 0;
|
||||||
|
String lexeme = "";
|
||||||
|
//#1020: red43.fdv: line 988]: Active DVM directives are not supported (turn on DVM-directive support option)
|
||||||
|
for (char c : line.toCharArray()) {
|
||||||
|
// System.out.print("<s=" + s + ">");
|
||||||
|
// System.out.println(c);
|
||||||
|
switch (s) {
|
||||||
|
case 0:
|
||||||
|
//поиск groups_s
|
||||||
|
if (c == '#') {
|
||||||
|
s = 1;
|
||||||
|
lexeme = "";
|
||||||
|
} else return null;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
//group_s
|
||||||
|
if (isDigit(c)) {
|
||||||
|
res.group_s += c;
|
||||||
|
lexeme += c;
|
||||||
|
} else if (c == ':') {
|
||||||
|
s = 2;
|
||||||
|
res.group = Integer.parseInt(lexeme);
|
||||||
|
} else return null;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//поиск filename
|
||||||
|
if (c == ' ') {
|
||||||
|
s = 3;
|
||||||
|
} else return null;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
//filename
|
||||||
|
if (c == ':') {
|
||||||
|
s = 4;
|
||||||
|
} else {
|
||||||
|
res.file += c;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
//поиск line
|
||||||
|
if (c == ' ') {
|
||||||
|
s = 5;
|
||||||
|
lexeme = "";
|
||||||
|
} else return null;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
//line
|
||||||
|
if (c == ' ') {
|
||||||
|
if (!lexeme.equals("line"))
|
||||||
|
return null;
|
||||||
|
else {
|
||||||
|
s = 6;
|
||||||
|
lexeme = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lexeme += c;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
//line number
|
||||||
|
if (isDigit(c)) {
|
||||||
|
lexeme += c;
|
||||||
|
} else if (c == ']') {
|
||||||
|
res.line = Integer.parseInt(lexeme);
|
||||||
|
s = 7;
|
||||||
|
} else return null;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
//Поиск value
|
||||||
|
if (c == ':') {
|
||||||
|
s = 8;
|
||||||
|
} else return null;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
if (c == ' ') {
|
||||||
|
s = 9;
|
||||||
|
} else return null;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
//value
|
||||||
|
res.value += c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
//--
|
||||||
|
if (s != 9)
|
||||||
|
return null;
|
||||||
|
//--
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public void readMessagesFromFileDump(File file, Vector<MessageError> messages) {
|
||||||
|
try {
|
||||||
|
//Образец запакованного сообщения
|
||||||
|
//ERROR - [#1020: red43.fdv: line 988]: Active DVM directives are not supported (turn on DVM-directive support option)
|
||||||
|
Vector<String> lines = new Vector<>(FileUtils.readLines(file));
|
||||||
|
if (!lines.isEmpty()) {
|
||||||
|
for (int i = lines.size() - 1; i >= 0; --i) {
|
||||||
|
String line = lines.get(i);
|
||||||
|
if (line.startsWith("ERROR - ")) {
|
||||||
|
MessageError message = unpackMessage(line);
|
||||||
|
if (message != null)
|
||||||
|
messages.add(message);
|
||||||
|
//--
|
||||||
|
} else break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//--
|
||||||
public void createProject(File rootHome) throws Exception {
|
public void createProject(File rootHome) throws Exception {
|
||||||
project = null;
|
project = null;
|
||||||
String version_ = Global.isWindows ? Utils.toW(version) : Utils.toU(version);
|
String version_ = Global.isWindows ? Utils.toW(version) : Utils.toU(version);
|
||||||
@@ -116,6 +242,48 @@ public class SapforVersion_json implements Serializable {
|
|||||||
project.creationDate = Utils.getDateNumber();
|
project.creationDate = Utils.getDateNumber();
|
||||||
//---
|
//---
|
||||||
FileUtils.copyDirectory(Home, project.Home);
|
FileUtils.copyDirectory(Home, project.Home);
|
||||||
|
///--------------------------------------
|
||||||
project.CreateVisualiserData();
|
project.CreateVisualiserData();
|
||||||
}
|
}
|
||||||
|
public void ReadMessages() throws Exception {
|
||||||
|
if (project!=null) {
|
||||||
|
Vector<MessageError> messages = new Vector<>();
|
||||||
|
//--
|
||||||
|
File p_out = Paths.get(project.Home.getAbsolutePath(), Constants.data, Constants.parse_out_file).toFile();
|
||||||
|
File p_err = Paths.get(project.Home.getAbsolutePath(), Constants.data, Constants.parse_err_file).toFile();
|
||||||
|
File out = Paths.get(project.Home.getAbsolutePath(), Constants.data, Constants.out_file).toFile();
|
||||||
|
File err = Paths.get(project.Home.getAbsolutePath(), Constants.data, Constants.err_file).toFile();
|
||||||
|
//--
|
||||||
|
if (p_out.exists()) {
|
||||||
|
project.Log += (FileUtils.readFileToString(p_out));
|
||||||
|
readMessagesFromFileDump(p_out, messages);
|
||||||
|
}
|
||||||
|
if (out.exists()) {
|
||||||
|
project.Log += "\n" + FileUtils.readFileToString(out);
|
||||||
|
readMessagesFromFileDump(out, messages);
|
||||||
|
}
|
||||||
|
//в потоки ошибок идет информация от операционной системы. сообщений там быть не должно.
|
||||||
|
if (p_err.exists())
|
||||||
|
project.Log += (FileUtils.readFileToString(p_err));
|
||||||
|
if (err.exists())
|
||||||
|
project.Log += "\n" + FileUtils.readFileToString(err);
|
||||||
|
//--
|
||||||
|
if (!messages.isEmpty()) {
|
||||||
|
project.Open();
|
||||||
|
project.Update(); //Журнал
|
||||||
|
//а так же, убрать dep и txt
|
||||||
|
project.db.BeginTransaction();
|
||||||
|
for (MessageError m : messages) {
|
||||||
|
if (project.db.files.containsKey(m.file)) {
|
||||||
|
DBProjectFile file = project.db.files.Data.get(m.file);
|
||||||
|
file.CreateAndAddNewMessage(1, m.value, m.line, m.group);
|
||||||
|
//update file
|
||||||
|
project.db.Update(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
project.db.Commit();
|
||||||
|
project.db.Disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public abstract class OpenSapforVersionPass extends Pass_2021<SapforVersion_json
|
|||||||
ShowMessage2(version_json.version);
|
ShowMessage2(version_json.version);
|
||||||
version_json.createProject(rootHome);
|
version_json.createProject(rootHome);
|
||||||
}
|
}
|
||||||
|
//-второй проход это запись логов и сообщений. у вариантов их быть не может.
|
||||||
|
ShowMessage1("Прочтение журналов и сообщений..."); //без версий нельзя, иначе лишние файлы захватит.
|
||||||
|
for (SapforVersion_json version_json : task.versions) {
|
||||||
|
ShowMessage2(version_json.version);
|
||||||
|
version_json.ReadMessages();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void performDone() throws Exception {
|
protected void performDone() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user