реализовал запуск анализов из консоли. осталось парсить вывод получения размерности.

This commit is contained in:
2023-11-24 02:11:33 +03:00
parent 1907f24100
commit 7c8299e10c
6 changed files with 50 additions and 15 deletions

1
.idea/workspace.xml generated
View File

@@ -12,6 +12,7 @@
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/Test/Test.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/Test/Test.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/Test/Test.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/Test/Test.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PerformSapforTask.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PerformSapforTask.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestFromFolder.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestFromFolder.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestFromFolder.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestFromFolder.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" />
</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" />

View File

@@ -491,7 +491,18 @@ public abstract class Sapfor extends OSDComponent {
return res; return res;
} }
//-- //--
//------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------
public String getConsoleFlags() throws Exception {
Vector<String> res = new Vector<>();
if (Global.getSetting(SettingName.FREE_FORM).toBoolean())
res.add("-f90");
if (Global.getSetting(SettingName.STATIC_SHADOW_ANALYSIS).toBoolean())
res.add("-sh");
res.add("-shwidth " + Global.getSetting(SettingName.MAX_SHADOW_WIDTH));
if (Global.getSetting(SettingName.KEEP_SPF_DIRECTIVES).toBoolean())
res.add("-keepSPF");
return String.join(" ", res);
}
public static boolean checkLines(Vector<String> lines) { public static boolean checkLines(Vector<String> lines) {
for (String line : lines) { for (String line : lines) {
if (line.toLowerCase().contains("internal error")) { if (line.toLowerCase().contains("internal error")) {
@@ -527,6 +538,7 @@ public abstract class Sapfor extends OSDComponent {
Utils.delete_with_check(errorsFile); Utils.delete_with_check(errorsFile);
//--- //---
File file = new File(data_workspace, name + (Global.isWindows ? ".bat" : ".sh")); File file = new File(data_workspace, name + (Global.isWindows ? ".bat" : ".sh"));
System.out.println(file.getAbsolutePath());
FileUtils.write(file, FileUtils.write(file,
Utils.DQuotes(sapfor_drv) Utils.DQuotes(sapfor_drv)
+ (flags.isEmpty() ? "" : (" " + flags)) + (flags.isEmpty() ? "" : (" " + flags))
@@ -562,4 +574,24 @@ public abstract class Sapfor extends OSDComponent {
checkLines(outputLines) && checkLines(outputLines) &&
checkLines(errorsLines); checkLines(errorsLines);
} }
public static boolean parse(File sapfor_drv, File workspace, String flags) throws Exception {
return performScript(
"parse",
sapfor_drv,
workspace,
"-parse *.f *.for *.fdv *.f90 *.f77",
flags,
Constants.parse_out_file,
Constants.parse_err_file)
&& (new File(workspace, "dvm.proj")).exists();
}
public static boolean analysis(File sapfor_drv, File workspace, PassCode_2021 code, String flags) throws Exception {
return performScript("analysis",
sapfor_drv,
workspace,
code.getTestingCommand(),
flags,
Constants.out_file,
Constants.err_file);
}
} }

View File

@@ -82,7 +82,7 @@ public class Test extends riDBObject {
File tempProject = getTempProject(); File tempProject = getTempProject();
File tempArchive = getTempArchive(); File tempArchive = getTempArchive();
//- создать бд. //- создать бд.
db_project_info project = new db_project_info(dir); db_project_info project = new db_project_info(tempProject);
project.Open(); project.Open();
project.Close(); project.Close();
//- //-

View File

@@ -47,17 +47,9 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
return true; return true;
} }
protected boolean parse() throws Exception { protected boolean parse() throws Exception {
if (Sapfor.performScript( if (Sapfor.parse(sapfor_drv, parentTask, target.flags)){
"parse",
sapfor_drv,
parentTask,
"-parse *.f *.for *.fdv *.f90 *.f77",
target.flags,
Constants.parse_out_file,
Constants.parse_err_file)
&& (new File(parentTask, "dvm.proj")).exists()) {
return true; return true;
} else { }else {
target.state = TaskState.DoneWithErrors; target.state = TaskState.DoneWithErrors;
return false; return false;
} }

View File

@@ -5,6 +5,7 @@ import Common.Utils.Files.VDirectoryChooser;
import Common.Utils.Utils; import Common.Utils.Utils;
import ProjectData.Files.ProjectFile; import ProjectData.Files.ProjectFile;
import ProjectData.Project.db_project_info; import ProjectData.Project.db_project_info;
import Repository.Component.Sapfor.Sapfor;
import TestingSystem.Common.Group.Group; import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Test.Test; import TestingSystem.Common.Test.Test;
import Visual_DVM_2021.Passes.PassCode_2021; import Visual_DVM_2021.Passes.PassCode_2021;
@@ -133,7 +134,14 @@ public class CreateTestFromFolder extends Pass_2021<Test> {
System.out.println("==================="); System.out.println("===================");
//-- //--
db_project_info project = target.packCode(dir); //создание копии папки, и архивация. db_project_info project = target.packCode(dir); //создание копии папки, и архивация.
//-- получить размерность консольным сапфором. //-- получить размерность консольным сапфором. папка уже отправлена и чистить ее не нужно!!
if (Sapfor.parse(Current.getSapfor().getFile(), project.Home, Current.getSapfor().getConsoleFlags())){
Sapfor.analysis(Current.getSapfor().getFile(),project.Home,
PassCode_2021.SPF_GetMaxMinBlockDistribution,
Current.getSapfor().getConsoleFlags());
}
//todo получить значение из файла вывода анализа.
} }
@Override @Override
protected void performDone() throws Exception { protected void performDone() throws Exception {

View File

@@ -314,7 +314,6 @@ public enum PassCode_2021 {
return "Удаление Open MP директив"; return "Удаление Open MP директив";
case CreateGroupFromDirectory: case CreateGroupFromDirectory:
return "Создать группу тестов из папки"; return "Создать группу тестов из папки";
case AbortTaskPackage: case AbortTaskPackage:
return "Прерывать пакет тестирования DVM"; return "Прерывать пакет тестирования DVM";
case DeleteConfiguration: case DeleteConfiguration:
@@ -883,6 +882,9 @@ public enum PassCode_2021 {
case SPF_ResolveCommonBlockConflicts: case SPF_ResolveCommonBlockConflicts:
name = "FIX_COMMON_BLOCKS"; name = "FIX_COMMON_BLOCKS";
break; break;
case SPF_GetMaxMinBlockDistribution:
name = "GET_MIN_MAX_BLOCK_DIST";
break;
} }
return p + " " + name; return p + " " + name;
} }