При анализе результатов добавлен учет версий и вариантов, при неудачном завершении процесса.
This commit is contained in:
13
.idea/workspace.xml
generated
13
.idea/workspace.xml
generated
@@ -9,19 +9,8 @@
|
|||||||
<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$/src/Common/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Constants.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Common/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Constants.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Files/ProjectsChooser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Files/ProjectsChooser.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/ProjectData/Messages/Errors/MessageError.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Messages/Errors/MessageError.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/ProjectData/Project/db_project_info.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Project/db_project_info.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/SapforTestingSystem/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/PerformSapforTask.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/TestingSystem/UserConnection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/UserConnection.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateEmptyDirectory.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateEmptyDirectory.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateEmptyProject.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateEmptyProject.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/OpenCurrentProject.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/OpenCurrentProject.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/OpenSapforTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/OpenSapforTest.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishTest.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/SSH/ConnectionPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/SSH/ConnectionPass.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" />
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public class Constants {
|
|||||||
public final static String DONE = "DONE";
|
public final static String DONE = "DONE";
|
||||||
public final static String TIMEOUT = "TIMEOUT";
|
public final static String TIMEOUT = "TIMEOUT";
|
||||||
//-вывод задач
|
//-вывод задач
|
||||||
|
public final static String parse_out_file = "parse_out.txt";
|
||||||
|
public final static String parse_err_file = "parse_err.txt";
|
||||||
public final static String out_file = "out.txt";
|
public final static String out_file = "out.txt";
|
||||||
public final static String err_file = "err.txt";
|
public final static String err_file = "err.txt";
|
||||||
public final static String time_file = "total_time";
|
public final static String time_file = "total_time";
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ package ProjectData.Messages.Errors;
|
|||||||
import ProjectData.Messages.Message;
|
import ProjectData.Messages.Message;
|
||||||
public class MessageError extends Message {
|
public class MessageError extends Message {
|
||||||
public MessageError(String file_in, int line_in, String value_in, int group_in) throws Exception {
|
public MessageError(String file_in, int line_in, String value_in, int group_in) throws Exception {
|
||||||
super(file_in, line_in, value_in, group_in);
|
super(file_in,
|
||||||
|
line_in,
|
||||||
|
value_in,
|
||||||
|
group_in);
|
||||||
}
|
}
|
||||||
public MessageError() {
|
public MessageError() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import SapforTestingSystem.Json.SapforConfiguration_json;
|
|||||||
import SapforTestingSystem.Json.SapforVersion_json;
|
import SapforTestingSystem.Json.SapforVersion_json;
|
||||||
import SapforTestingSystem.SapforTask.SapforTask;
|
import SapforTestingSystem.SapforTask.SapforTask;
|
||||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||||
import Visual_DVM_2021.Passes.PassException;
|
|
||||||
import Visual_DVM_2021.Passes.Pass_2021;
|
import Visual_DVM_2021.Passes.Pass_2021;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
@@ -109,18 +108,17 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
|||||||
procBuilder.directory(workspace);
|
procBuilder.directory(workspace);
|
||||||
process = procBuilder.start();
|
process = procBuilder.start();
|
||||||
exit_code = process.waitFor();
|
exit_code = process.waitFor();
|
||||||
if (exit_code != 0)
|
|
||||||
throw new PassException("Процесс завершился с кодом " + exit_code);
|
|
||||||
process = null;
|
process = null;
|
||||||
//---
|
//---
|
||||||
outputLines = new Vector<>(FileUtils.readLines(outputFile));
|
outputLines = new Vector<>(FileUtils.readLines(outputFile));
|
||||||
errorsLines = new Vector<>(FileUtils.readLines(errorsFile));
|
errorsLines = new Vector<>(FileUtils.readLines(errorsFile));
|
||||||
return checkLines(outputLines) && checkLines(errorsLines);
|
return (exit_code == 0) && checkLines(outputLines) && checkLines(errorsLines);
|
||||||
}
|
}
|
||||||
protected boolean parse() throws Exception {
|
protected boolean parse() throws Exception {
|
||||||
if (performSapforScript("parse", parentTask,
|
if (performSapforScript("parse", parentTask,
|
||||||
"-parse *.f *.for *.fdv *.f90 *.f77",
|
"-parse *.f *.for *.fdv *.f90 *.f77",
|
||||||
"parse_out.txt", "parse_err.txt")
|
Constants.parse_out_file,
|
||||||
|
Constants.parse_err_file)
|
||||||
&& (new File(parentTask, "dvm.proj")).exists()) {
|
&& (new File(parentTask, "dvm.proj")).exists()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -128,16 +126,19 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//слегка изменить подход.
|
||||||
protected boolean transformation(PassCode_2021 code) throws Exception {
|
protected boolean transformation(PassCode_2021 code) throws Exception {
|
||||||
task = new File(parentTask, "v1");
|
task = new File(parentTask, "v1");
|
||||||
Utils.CheckAndCleanDirectory(task); //папка для преобразования.
|
Utils.CheckAndCleanDirectory(task); //папка для преобразования.
|
||||||
|
//если версия пустая, это тоже результат тестирования. Поэтому должна учитываться в древе.
|
||||||
|
target.versions.add(new SapforVersion_json(task.getAbsolutePath(), code.getDescription()));
|
||||||
|
//---
|
||||||
if (performSapforScript("transformation", parentTask,
|
if (performSapforScript("transformation", parentTask,
|
||||||
code.getTestingCommand() + " -F " + Utils.DQuotes(task.getAbsolutePath()),
|
code.getTestingCommand() + " -F " + Utils.DQuotes(task.getAbsolutePath()),
|
||||||
"out.txt",
|
Constants.out_file,
|
||||||
"err.txt"
|
Constants.err_file
|
||||||
)) {
|
)) {
|
||||||
target.state = TaskState.Done;
|
target.state = TaskState.Done;
|
||||||
target.versions.add(new SapforVersion_json(task.getAbsolutePath(), code.getDescription()));
|
|
||||||
parentTask = task;
|
parentTask = task;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -145,25 +146,21 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
|||||||
target.state = TaskState.DoneWithErrors;
|
target.state = TaskState.DoneWithErrors;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
protected boolean variants() throws Exception {
|
protected void variants() throws Exception {
|
||||||
if (performSapforScript("create_variants", parentTask, " -t 13 -allVars",
|
//папки вариантов создается самим сапфором.
|
||||||
"out.txt",
|
target.state = performSapforScript("create_variants", parentTask, " -t 13 -allVars",
|
||||||
"err.txt"
|
Constants.out_file,
|
||||||
)) {
|
Constants.err_file
|
||||||
|
) ? TaskState.Done : TaskState.DoneWithErrors;
|
||||||
//найти папки с вариантами.
|
//найти папки с вариантами.
|
||||||
File[] files_ = parentTask.listFiles((dir, name) -> dir.isDirectory() && Utils.isParallelVersionName(name));
|
File[] files_ = parentTask.listFiles((dir, name) -> dir.isDirectory() && Utils.isParallelVersionName(name));
|
||||||
if ((files_ != null) && (files_.length > 0)) {
|
if ((files_ != null) && (files_.length > 0)) {
|
||||||
Vector<File> files = new Vector<>(Arrays.asList(files_));
|
Vector<File> files = new Vector<>(Arrays.asList(files_));
|
||||||
files.sort(Comparator.comparingInt(o -> Integer.parseInt(o.getName().substring(1))));
|
files.sort(Comparator.comparingInt(o -> Integer.parseInt(o.getName().substring(1))));
|
||||||
target.state = TaskState.Done;
|
|
||||||
for (File file : files)
|
for (File file : files)
|
||||||
target.variants.add(new SapforVersion_json(file.getAbsolutePath(), PassCode_2021.SPF_CreateParallelVariant.getDescription()));
|
target.variants.add(new SapforVersion_json(file.getAbsolutePath(), PassCode_2021.SPF_CreateParallelVariant.getDescription()));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
target.state = TaskState.DoneWithErrors;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//-------------------------------------------------->>
|
//-------------------------------------------------->>
|
||||||
public MessageError unpackMessage(String line_in) throws Exception {
|
public MessageError unpackMessage(String line_in) throws Exception {
|
||||||
MessageError res = new MessageError();
|
MessageError res = new MessageError();
|
||||||
@@ -281,7 +278,9 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected void checkVersion(SapforVersion_json version, boolean isTransformation) throws Exception {
|
//--
|
||||||
|
protected void createVersionProjectData(SapforVersion_json version, boolean isTransformation) throws Exception {
|
||||||
|
System.out.println("Checking version " + version);
|
||||||
db_project_info project = new db_project_info();
|
db_project_info project = new db_project_info();
|
||||||
project.Home = new File(version.version);
|
project.Home = new File(version.version);
|
||||||
project.name = project.Home.getName();
|
project.name = project.Home.getName();
|
||||||
@@ -292,8 +291,10 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
|||||||
Vector<MessageError> messages = new Vector<>();
|
Vector<MessageError> messages = new Vector<>();
|
||||||
//--
|
//--
|
||||||
if (isTransformation) {
|
if (isTransformation) {
|
||||||
File p_out = Paths.get(project.Home.getAbsolutePath(), Constants.data, "parse_out.txt").toFile();
|
File p_out = Paths.get(project.Home.getAbsolutePath(), Constants.data, Constants.parse_out_file).toFile();
|
||||||
File out = Paths.get(project.Home.getAbsolutePath(), Constants.data, "out.txt").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()) {
|
if (p_out.exists()) {
|
||||||
project.Log += (FileUtils.readFileToString(p_out));
|
project.Log += (FileUtils.readFileToString(p_out));
|
||||||
@@ -303,9 +304,15 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
|||||||
project.Log += "\n" + FileUtils.readFileToString(out);
|
project.Log += "\n" + FileUtils.readFileToString(out);
|
||||||
readMessagesFromFileDump(out, messages);
|
readMessagesFromFileDump(out, messages);
|
||||||
}
|
}
|
||||||
|
//в потоки ошибок идет информация от операционной системы. сообщений там быть не должно.
|
||||||
|
if (p_err.exists())
|
||||||
|
project.Log += (FileUtils.readFileToString(p_err));
|
||||||
|
if (err.exists())
|
||||||
|
project.Log += "\n" + FileUtils.readFileToString(err);
|
||||||
//--
|
//--
|
||||||
}
|
}
|
||||||
project.CreateVisualiserData();
|
project.CreateVisualiserData();
|
||||||
|
System.out.println("visualiser data created");
|
||||||
//---
|
//---
|
||||||
if (isTransformation && !messages.isEmpty()) {
|
if (isTransformation && !messages.isEmpty()) {
|
||||||
project.Open();
|
project.Open();
|
||||||
@@ -327,8 +334,9 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
|||||||
@Override
|
@Override
|
||||||
protected void body() throws Exception {
|
protected void body() throws Exception {
|
||||||
System.out.println(target.root + " " + Utils.Brackets(sapforConfiguration_json.flags));//!!
|
System.out.println(target.root + " " + Utils.Brackets(sapforConfiguration_json.flags));//!!
|
||||||
|
target.versions.add(new SapforVersion_json(target.root, "исходная"));
|
||||||
for (PassCode_2021 code : sapforConfiguration_json.codes) {
|
for (PassCode_2021 code : sapforConfiguration_json.codes) {
|
||||||
// System.out.println(code); //!!
|
System.out.println(code); //!!
|
||||||
if (parse()) {
|
if (parse()) {
|
||||||
if (code.equals(PassCode_2021.CreateParallelVariants))
|
if (code.equals(PassCode_2021.CreateParallelVariants))
|
||||||
variants();
|
variants();
|
||||||
@@ -337,14 +345,16 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
|||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//теперь строим деревья версий.
|
}
|
||||||
//System.out.println("Построение дерева версий..");
|
@Override
|
||||||
checkVersion(new SapforVersion_json(target.root, "исходная"), true);
|
protected void performFinish() throws Exception {
|
||||||
|
//теперь строим деревья версий. нельзя делать в body. так как могут быть исключения например неверный код процесса.
|
||||||
|
System.out.println("Построение дерева версий..");
|
||||||
for (SapforVersion_json version : target.versions)
|
for (SapforVersion_json version : target.versions)
|
||||||
checkVersion(version, true);
|
createVersionProjectData(version, true);
|
||||||
for (SapforVersion_json version : target.variants)
|
for (SapforVersion_json version : target.variants)
|
||||||
checkVersion(version, false);
|
createVersionProjectData(version, false);
|
||||||
//---->>>>
|
//---->>>>
|
||||||
//System.out.println("DONE");
|
System.out.println("DONE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user