рефакторинг определения размерности тестов на сервере.
This commit is contained in:
28
.idea/workspace.xml
generated
28
.idea/workspace.xml
generated
@@ -7,32 +7,14 @@
|
|||||||
</component>
|
</component>
|
||||||
<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 afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/VisualiserSettingsMenu/TestingMenu.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Tables/RendererTestingPackageStatus.java" afterDir="false" />
|
|
||||||
<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$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Common/Visual/Tables/HeaderTextFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Visual/Tables/HeaderTextFilter.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/Component/Sapfor/Sapfor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/Component/Sapfor/Sapfor.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/Component/Sapfor/Sapfor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/Component/Sapfor/Sapfor.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/CreateTestFromFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/CreateTestFromFile.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/NormalProperties.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/NormalProperties.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/UI/TestsForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/UI/TestsForm.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/RefreshDVMPackageResults.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/RefreshDVMPackageResults.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_SharedMemoryParallelization.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_SharedMemoryParallelization.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestsDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestsDatabase.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingPackage/TestingPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingPackage/TestingPackage.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/DVMPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/DVMPackage.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/UI/DVMPackagesForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/UI/DVMPackagesForm.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMTasks/DVMCompilationTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMTasks/DVMCompilationTask.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMTasks/DVMRunTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMTasks/DVMRunTask.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMTasks/UI/DVMRunTasksForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMTasks/UI/DVMRunTasksForm.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/RemoteDVMTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/RemoteDVMTestingPlanner.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/Json/SapforPackage_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/Json/SapforPackage_json.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/PerformSapforTask.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforPackage/UI/SapforPackagesForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforPackage/UI/SapforPackagesForm.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Utils.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Utils.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/MainUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/MainUI.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/SynchronizationSettingsMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/VisualiserSettingsMenu/SynchronizationSettingsMenu.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/VersionsComparisonMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/VisualiserSettingsMenu/VersionsComparisonMenu.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/VisualiserSettingsMenu/VisualiserSettingsMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/VisualiserSettingsMenu/VisualiserSettingsMenu.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" />
|
||||||
@@ -131,11 +113,11 @@
|
|||||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\Common\icons" />
|
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\Common\icons" />
|
||||||
</key>
|
</key>
|
||||||
<key name="MoveMembersDialog.RECENTS_KEY">
|
<key name="MoveMembersDialog.RECENTS_KEY">
|
||||||
|
<recent name="_VisualDVM.ComponentsServer.Component.Sapfor.Sapfor" />
|
||||||
<recent name="_VisualDVM.Constants" />
|
<recent name="_VisualDVM.Constants" />
|
||||||
<recent name="_VisualDVM.Global" />
|
<recent name="_VisualDVM.Global" />
|
||||||
<recent name="_VisualDVM.ProjectData.SapforData.Arrays.UI.ProjectArraysForm" />
|
<recent name="_VisualDVM.ProjectData.SapforData.Arrays.UI.ProjectArraysForm" />
|
||||||
<recent name="_VisualDVM.TestingSystem.SAPFOR.SapforPackage.UI.SapforPackagesForm" />
|
<recent name="_VisualDVM.TestingSystem.SAPFOR.SapforPackage.UI.SapforPackagesForm" />
|
||||||
<recent name="_VisualDVM.TestingSystem.DVM.DVMPackage.UI.DVMPackagesForm" />
|
|
||||||
</key>
|
</key>
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\TestingSystem\SAPFOR\SapforSettingsCommand\UI" />
|
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\TestingSystem\SAPFOR\SapforSettingsCommand\UI" />
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"ServerUserPassword": "mprit_2011",
|
"ServerUserPassword": "mprit_2011",
|
||||||
"OfferRegistrationOnStart": true,
|
"OfferRegistrationOnStart": true,
|
||||||
"Workspace": "E:\\Tests",
|
"Workspace": "E:\\Tests",
|
||||||
"ProjectsSearchDirectory": "E:\\Tests\\Downloads",
|
"ProjectsSearchDirectory": "E:\\Tests\\test_c",
|
||||||
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
|
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
|
||||||
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
||||||
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package _VisualDVM.ComponentsServer.Component.Sapfor;
|
|||||||
import Common.CommonConstants;
|
import Common.CommonConstants;
|
||||||
import Common.Passes.PassException;
|
import Common.Passes.PassException;
|
||||||
import Common.Utils.Utils_;
|
import Common.Utils.Utils_;
|
||||||
import Common.Utils.Vector_;
|
|
||||||
import Common.Visual.UI;
|
import Common.Visual.UI;
|
||||||
import _VisualDVM.ComponentsServer.Component.OSDComponent;
|
import _VisualDVM.ComponentsServer.Component.OSDComponent;
|
||||||
import _VisualDVM.ComponentsServer.Component.Visualizer_2;
|
import _VisualDVM.ComponentsServer.Component.Visualizer_2;
|
||||||
@@ -12,15 +11,18 @@ import _VisualDVM.Passes.PassCode;
|
|||||||
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
|
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
|
||||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||||
import _VisualDVM.ProjectData.Files.UI.Editor.SPFEditor;
|
import _VisualDVM.ProjectData.Files.UI.Editor.SPFEditor;
|
||||||
|
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||||
import _VisualDVM.Utils;
|
import _VisualDVM.Utils;
|
||||||
|
import javafx.util.Pair;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.Files;
|
import java.util.Collections;
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
import java.util.Vector;
|
||||||
public abstract class Sapfor extends OSDComponent {
|
public abstract class Sapfor extends OSDComponent {
|
||||||
public static final int empty_code = -100;
|
public static final int empty_code = -100;
|
||||||
public static final int canceled_code = -99;
|
public static final int canceled_code = -99;
|
||||||
@@ -271,37 +273,7 @@ public abstract class Sapfor extends OSDComponent {
|
|||||||
result_lines
|
result_lines
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
public static File getTempCopy(File src) throws Exception {
|
|
||||||
if (temp_copy == null || !temp_copy.exists()) {
|
|
||||||
temp_copy = Utils.getTempFileName("SAPFOR" + (Utils_.isWindows() ? ".exe" : ""));
|
|
||||||
FileUtils.copyFile(src, temp_copy);
|
|
||||||
temp_copy.setExecutable(true);
|
|
||||||
}
|
|
||||||
return temp_copy;
|
|
||||||
}
|
|
||||||
//--
|
//--
|
||||||
public static boolean getMinMaxDim(File sapfor_drv, File workspace, Test test) throws Exception {
|
|
||||||
File sapfor = Sapfor.getTempCopy(sapfor_drv);
|
|
||||||
String flags = "-noLogo";
|
|
||||||
if (Sapfor.parse(sapfor, workspace, flags)
|
|
||||||
) {
|
|
||||||
Vector<String> outputLines = new Vector<>();
|
|
||||||
if (Sapfor.analysis(sapfor, workspace, PassCode.SPF_GetMaxMinBlockDistribution, flags, outputLines)) {
|
|
||||||
//---
|
|
||||||
for (String line : outputLines) {
|
|
||||||
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
|
|
||||||
if (line.startsWith(prefix)) {
|
|
||||||
String s = line.substring(prefix.length());
|
|
||||||
String[] data = s.split(" ");
|
|
||||||
test.min_dim = Math.max(Integer.parseInt(data[0]), 0);
|
|
||||||
test.max_dim = Math.max(Integer.parseInt(data[1]), 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public static int readVersionFromCode(File versionFile) {
|
public static int readVersionFromCode(File versionFile) {
|
||||||
int res = CommonConstants.Nan;
|
int res = CommonConstants.Nan;
|
||||||
if (versionFile.exists()) {
|
if (versionFile.exists()) {
|
||||||
@@ -366,7 +338,7 @@ public abstract class Sapfor extends OSDComponent {
|
|||||||
"SPF_OpenDvmStatistic",
|
"SPF_OpenDvmStatistic",
|
||||||
-Global.messagesServer.getPort(),
|
-Global.messagesServer.getPort(),
|
||||||
"",
|
"",
|
||||||
// Global.packSapforSettings(),
|
// Global.packSapforSettings(),
|
||||||
src);
|
src);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -567,26 +539,113 @@ public abstract class Sapfor extends OSDComponent {
|
|||||||
if ((UI.isActive()) && (Global.mainModule.getUI().hasMainWindow()) && (Global.mainModule.getUI().getVersionsWindow() != null))
|
if ((UI.isActive()) && (Global.mainModule.getUI().hasMainWindow()) && (Global.mainModule.getUI().getVersionsWindow() != null))
|
||||||
Global.mainModule.getUI().getVersionsWindow().BlockVariants();
|
Global.mainModule.getUI().getVersionsWindow().BlockVariants();
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------->>
|
//--
|
||||||
//временный (?) проход, по тихому получить размерность теста, предварительно выполнив тихий парс.
|
public static int getFileMaxDim_C(File file) {
|
||||||
//тут все одноразовое. считаем что таблицы бд уже заполнены как надо.
|
int fileMax = 0;
|
||||||
/*
|
final String prefix = "#pragma dvm array distribute";
|
||||||
public LanguageStyle getStyle() throws Exception {
|
int n = 0;
|
||||||
return (Global.mainModule.getDb()).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
|
try {
|
||||||
|
for (String line : FileUtils.readLines(file, Charset.defaultCharset())) {
|
||||||
|
// #pragma dvm array distribute[block][block], не важно
|
||||||
|
String packedLine = Utils_.removeCharacters(Utils_.removeRedundantSpaces(line).toLowerCase(), "\n", "\r", "\t");
|
||||||
|
if (packedLine.startsWith(prefix)) {
|
||||||
|
packedLine = packedLine.substring(prefix.length());
|
||||||
|
boolean bracketOpen = false;
|
||||||
|
int pragmaMax = 0;
|
||||||
|
String distr = "";
|
||||||
|
for (int i = packedLine.indexOf('['); i < packedLine.length(); ++i) {
|
||||||
|
char c = packedLine.charAt(i);
|
||||||
|
if (bracketOpen) {
|
||||||
|
if (c == ']') {
|
||||||
|
bracketOpen = false;
|
||||||
|
if (distr.equals("block"))
|
||||||
|
pragmaMax++;
|
||||||
|
distr = "";
|
||||||
|
} else {
|
||||||
|
distr += c;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (c == '[') {
|
||||||
|
bracketOpen = true;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileMax = Math.max(fileMax, pragmaMax);
|
||||||
|
}
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return fileMax;
|
||||||
}
|
}
|
||||||
*/
|
public static int getProjectMinMaxDim_C(db_project_info project) {
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
int res = 0;
|
||||||
/*
|
for (DBProjectFile file : project.db.files.Data.values()) {
|
||||||
public String getConsoleFlags() throws Exception {
|
if (file.isActiveProgram())
|
||||||
Vector<String> res = new Vector<>();
|
res = Math.max(res, Sapfor.getFileMaxDim_C(file.file));
|
||||||
if ((Global.mainModule.getDb()).settings.get(SettingName.FREE_FORM).toBoolean())
|
}
|
||||||
res.add("-f90");
|
return res;
|
||||||
if ((Global.mainModule.getDb()).settings.get(SettingName.STATIC_SHADOW_ANALYSIS).toBoolean())
|
|
||||||
res.add("-sh");
|
|
||||||
res.add("-shwidth " + (Global.mainModule.getDb()).settings.get(SettingName.MAX_SHADOW_WIDTH));
|
|
||||||
if ((Global.mainModule.getDb()).settings.get(SettingName.KEEP_SPF_DIRECTIVES).toBoolean())
|
|
||||||
res.add("-keepSPF");
|
|
||||||
return String.join(" ", res);
|
|
||||||
}
|
}
|
||||||
*/
|
public static Pair<Integer, Integer> getProjectFolderMinMaxDim_F(File sapfor_drv, File projectPath) {
|
||||||
|
String flags = "-noLogo";
|
||||||
|
Pair<Integer, Integer> res = new Pair<>(0, 0);
|
||||||
|
try {
|
||||||
|
if (Sapfor.parse(sapfor_drv, projectPath, flags)
|
||||||
|
) {
|
||||||
|
Vector<String> outputLines = new Vector<>();
|
||||||
|
if (Sapfor.analysis(sapfor_drv, projectPath, PassCode.SPF_GetMaxMinBlockDistribution, flags, outputLines)) {
|
||||||
|
//---
|
||||||
|
for (String line : outputLines) {
|
||||||
|
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
|
||||||
|
if (line.startsWith(prefix)) {
|
||||||
|
String s = line.substring(prefix.length());
|
||||||
|
String[] data = s.split(" ");
|
||||||
|
res = new Pair<>(Math.max(Integer.parseInt(data[0]), 0), Math.max(Integer.parseInt(data[1]), 0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
Utils.deleteFilesByExtensions(projectPath,
|
||||||
|
"proj", "dep", "jar"
|
||||||
|
);
|
||||||
|
File visualiser_data = new File(projectPath, Constants.data);
|
||||||
|
if (visualiser_data.exists())
|
||||||
|
FileUtils.forceDelete(visualiser_data);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public static void getTestMinMaxDim_F(File sapfor_drv, Test test) {
|
||||||
|
Pair<Integer, Integer> res = getProjectFolderMinMaxDim_F(sapfor_drv, test.getServerPath());
|
||||||
|
test.min_dim = res.getKey();
|
||||||
|
test.max_dim = res.getValue();
|
||||||
|
}
|
||||||
|
public static void getTestMinMaxDime_C(Test test) {
|
||||||
|
File workspace = test.getServerPath();
|
||||||
|
Vector<File> files = new Vector<>();
|
||||||
|
String[] names = test.files.split("\n");
|
||||||
|
for (String name : names) {
|
||||||
|
if (!name.isEmpty()) {
|
||||||
|
files.add(new File(workspace, name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int min_dim = 0;
|
||||||
|
int max_dim = 0;
|
||||||
|
for (File file: files){
|
||||||
|
max_dim = Math.max(max_dim,getFileMaxDim_C(file));
|
||||||
|
}
|
||||||
|
test.min_dim = min_dim;
|
||||||
|
test.max_dim = max_dim;
|
||||||
|
}
|
||||||
|
//--
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ public class CreateTestFromFile extends Pass<Test> {
|
|||||||
@Override
|
@Override
|
||||||
protected void body() throws Exception {
|
protected void body() throws Exception {
|
||||||
ShowMessage1(projectFile.file.getName());
|
ShowMessage1(projectFile.file.getName());
|
||||||
//--
|
packTestCode();
|
||||||
File tempProject = packTestCode();
|
|
||||||
ShowMessage2("Синтаксический анализ и определение размерности");
|
|
||||||
if (group.language == LanguageName.fortran)
|
|
||||||
Sapfor.getMinMaxDim(Sapfor.getTempCopy(Global.mainModule.getSapfor().getFile()), tempProject, target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,12 +36,6 @@ public class TestsForm extends DataSetControlForm<Test> {
|
|||||||
return RendererLongCell.class;
|
return RendererLongCell.class;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new ColumnInfo<Test>("min_dim") {
|
|
||||||
@Override
|
|
||||||
public Object getFieldAt(Test object) {
|
|
||||||
return object.min_dim;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new ColumnInfo<Test>("max_dim") {
|
new ColumnInfo<Test>("max_dim") {
|
||||||
@Override
|
@Override
|
||||||
public Object getFieldAt(Test object) {
|
public Object getFieldAt(Test object) {
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
+ "\nТест будет удален"
|
+ "\nТест будет удален"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
db.DetectTestMinMaxDim(db.serverSapfors.getLastDoneVersion(), db.groups.get(test.group_id), test);
|
||||||
} else if (object instanceof DVMPackage) {
|
} else if (object instanceof DVMPackage) {
|
||||||
DVMPackage dvmPackage = (DVMPackage) object;
|
DVMPackage dvmPackage = (DVMPackage) object;
|
||||||
//--
|
//--
|
||||||
@@ -287,6 +288,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
protected void startAdditionalThreads() {
|
protected void startAdditionalThreads() {
|
||||||
testingThread.start();
|
testingThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformAutoSapforTesting() throws Exception {
|
void PerformAutoSapforTesting() throws Exception {
|
||||||
TextLog Log = new TextLog();
|
TextLog Log = new TextLog();
|
||||||
SapforPackage autoPackage = tryAutoSapforTesting(Log);
|
SapforPackage autoPackage = tryAutoSapforTesting(Log);
|
||||||
@@ -337,7 +339,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
return new Pair<>(object, groupFiles);
|
return new Pair<>(object, groupFiles);
|
||||||
}
|
}
|
||||||
void RefreshDVMTests() throws Exception {
|
void RefreshDVMTests() throws Exception {
|
||||||
UserAccount account = new UserAccount("server", Constants.MailAddress);
|
UserAccount account = new UserAccount("server", Constants.MailAddress);
|
||||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||||
DownloadRepository downloadRepository = new DownloadRepository();
|
DownloadRepository downloadRepository = new DownloadRepository();
|
||||||
if (!downloadRepository.Do())
|
if (!downloadRepository.Do())
|
||||||
@@ -379,8 +381,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
groups.sort(Comparator.comparing(o -> o.getKey().description));
|
groups.sort(Comparator.comparing(o -> o.getKey().description));
|
||||||
//-теперь создать тесты.
|
|
||||||
//--
|
|
||||||
for (Pair<Group, Vector<File>> p : groups)
|
for (Pair<Group, Vector<File>> p : groups)
|
||||||
db.RefreshGroup(account, serverSapfor, p);
|
db.RefreshGroup(account, serverSapfor, p);
|
||||||
}
|
}
|
||||||
@@ -682,6 +682,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
}
|
}
|
||||||
ZipFolderPass zip = new ZipFolderPass();
|
ZipFolderPass zip = new ZipFolderPass();
|
||||||
//создание тестов.
|
//создание тестов.
|
||||||
|
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||||
Vector<Test> tests = new Vector<>();
|
Vector<Test> tests = new Vector<>();
|
||||||
for (String name : versions.keySet()) {
|
for (String name : versions.keySet()) {
|
||||||
File src = versions.get(name);
|
File src = versions.get(name);
|
||||||
@@ -716,27 +717,9 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
throw new RepositoryRefuseException("Не удалось переписать архив проекта");
|
throw new RepositoryRefuseException("Не удалось переписать архив проекта");
|
||||||
}
|
}
|
||||||
tests.add(test);
|
tests.add(test);
|
||||||
|
db.DetectTestMinMaxDim(serverSapfor, group, test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//определение размерности тестов
|
|
||||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
|
||||||
if (serverSapfor != null) {
|
|
||||||
File sapfor_copy = Sapfor.getTempCopy(new File(serverSapfor.call_command));
|
|
||||||
for (Test test : tests) {
|
|
||||||
try {
|
|
||||||
Sapfor.getMinMaxDim(sapfor_copy, test.getServerPath(), test);
|
|
||||||
db.Update(test);
|
|
||||||
Utils.deleteFilesByExtensions(test.getServerPath(),
|
|
||||||
"proj", "dep", "jar"
|
|
||||||
);
|
|
||||||
File visualiser_data = new File(test.getServerPath(), Constants.data);
|
|
||||||
FileUtils.forceDelete(visualiser_data);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//-"sh"
|
|
||||||
}
|
}
|
||||||
void ReplaceDVMPackageJson() throws Exception {
|
void ReplaceDVMPackageJson() throws Exception {
|
||||||
Pair<DVMPackage, byte[]> p = (Pair<DVMPackage, byte[]>) request.object;
|
Pair<DVMPackage, byte[]> p = (Pair<DVMPackage, byte[]>) request.object;
|
||||||
@@ -756,27 +739,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
if (!db.tests.containsKey(key))
|
if (!db.tests.containsKey(key))
|
||||||
throw new RepositoryRefuseException("не существует пакета с ключом " + key);
|
throw new RepositoryRefuseException("не существует пакета с ключом " + key);
|
||||||
}
|
}
|
||||||
//определение размерности тестов
|
|
||||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||||
if (serverSapfor != null) {
|
for (Object key : keys) {
|
||||||
File sapfor_copy = Sapfor.getTempCopy(new File(serverSapfor.call_command));
|
Test test = db.tests.get(key);
|
||||||
for (Object key : keys) {
|
Group group = db.groups.get(test.group_id);
|
||||||
Test test = db.tests.get(key);
|
db.DetectTestMinMaxDim(serverSapfor, group, test);
|
||||||
Group group = db.groups.get(test.group_id);
|
|
||||||
if (group.language.equals(LanguageName.fortran)) {
|
|
||||||
try {
|
|
||||||
Sapfor.getMinMaxDim(sapfor_copy, test.getServerPath(), test);
|
|
||||||
db.Update(test);
|
|
||||||
Utils.deleteFilesByExtensions(test.getServerPath(),
|
|
||||||
"proj", "dep", "jar"
|
|
||||||
);
|
|
||||||
File visualiser_data = new File(test.getServerPath(), Constants.data);
|
|
||||||
FileUtils.forceDelete(visualiser_data);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void GetDVMPackageCredentials() throws Exception {
|
void GetDVMPackageCredentials() throws Exception {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package _VisualDVM.TestingSystem.Common;
|
|||||||
import Common.CommonConstants;
|
import Common.CommonConstants;
|
||||||
import Common.Database.RepositoryRefuseException;
|
import Common.Database.RepositoryRefuseException;
|
||||||
import Common.Database.SQLITE.SQLiteDatabase;
|
import Common.Database.SQLITE.SQLiteDatabase;
|
||||||
import Common.Utils.TextLog;
|
|
||||||
import Common.Utils.Utils_;
|
import Common.Utils.Utils_;
|
||||||
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
|
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
|
||||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||||
@@ -174,6 +173,20 @@ public class TestsDatabase extends SQLiteDatabase {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
|
public void DetectTestMinMaxDim(ServerSapfor serverSapfor, Group group, Test test) throws Exception {
|
||||||
|
switch (group.language) {
|
||||||
|
case fortran:
|
||||||
|
if (serverSapfor != null) {
|
||||||
|
Sapfor.getTestMinMaxDim_F(new File(serverSapfor.call_command), test);
|
||||||
|
Update(test);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case c:
|
||||||
|
Sapfor.getTestMinMaxDime_C(test);
|
||||||
|
Update(test);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
public void SaveTestFromSingleFile(ServerSapfor sapfor, Group group, Test test, File file) throws Exception {
|
public void SaveTestFromSingleFile(ServerSapfor sapfor, Group group, Test test, File file) throws Exception {
|
||||||
File testDirectory = new File(Global.TestsDirectory, String.valueOf(test.id));
|
File testDirectory = new File(Global.TestsDirectory, String.valueOf(test.id));
|
||||||
Utils_.CheckAndCleanDirectory(testDirectory);
|
Utils_.CheckAndCleanDirectory(testDirectory);
|
||||||
@@ -187,29 +200,10 @@ public class TestsDatabase extends SQLiteDatabase {
|
|||||||
//----------->>
|
//----------->>
|
||||||
ZipFolderPass zip = new ZipFolderPass();
|
ZipFolderPass zip = new ZipFolderPass();
|
||||||
zip.Do(testDirectory.getAbsolutePath(), archive.getAbsolutePath());
|
zip.Do(testDirectory.getAbsolutePath(), archive.getAbsolutePath());
|
||||||
//---
|
DetectTestMinMaxDim(sapfor, group, test);
|
||||||
//Определение размерности
|
|
||||||
switch (group.language) {
|
|
||||||
case fortran:
|
|
||||||
// временная папка для анализа. чтобы не засорять нормальную.
|
|
||||||
File tempProject = Utils.getTempFileName("test");
|
|
||||||
FileUtils.forceMkdir(tempProject);
|
|
||||||
FileUtils.copyDirectory(testDirectory, tempProject);
|
|
||||||
//--
|
|
||||||
if (sapfor!=null) {
|
|
||||||
if (Sapfor.getMinMaxDim(Sapfor.getTempCopy(new File(sapfor.call_command)), tempProject, test)) {
|
|
||||||
Update(test);
|
|
||||||
} else
|
|
||||||
throw new RepositoryRefuseException("Не удалось определить размерность теста " + Utils_.Brackets(test.description));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case c:
|
|
||||||
test.max_dim = Utils.getCTestMaxDim(testFile);
|
|
||||||
Update(test);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//---
|
//---
|
||||||
|
//---
|
||||||
public void CreateTestFromSingleFile(UserAccount account, ServerSapfor sapfor, Group group, File file, String testDescription) throws Exception {
|
public void CreateTestFromSingleFile(UserAccount account, ServerSapfor sapfor, Group group, File file, String testDescription) throws Exception {
|
||||||
Test test = new Test();
|
Test test = new Test();
|
||||||
test.description = testDescription;
|
test.description = testDescription;
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import Common.Utils.Utils_;
|
|||||||
import Common.Visual.UI;
|
import Common.Visual.UI;
|
||||||
import Common.Visual.Windows.Dialog.VFileChooser_;
|
import Common.Visual.Windows.Dialog.VFileChooser_;
|
||||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
|
||||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
@@ -19,7 +17,6 @@ import java.net.InetAddress;
|
|||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -358,56 +355,6 @@ public class Utils {
|
|||||||
if (matrix.trim().isEmpty()) return 0;
|
if (matrix.trim().isEmpty()) return 0;
|
||||||
return matrix.split(" ").length;
|
return matrix.split(" ").length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCTestMaxDim(File test) {
|
|
||||||
int fileMax = 0;
|
|
||||||
final String prefix = "#pragma dvm array distribute";
|
|
||||||
int n = 0;
|
|
||||||
try {
|
|
||||||
for (String line : FileUtils.readLines(test, Charset.defaultCharset())) {
|
|
||||||
// #pragma dvm array distribute[block][block], не важно
|
|
||||||
String packedLine = Utils_.removeCharacters(Utils_.removeRedundantSpaces(line).toLowerCase(), "\n", "\r", "\t");
|
|
||||||
if (packedLine.startsWith(prefix)) {
|
|
||||||
packedLine = packedLine.substring(prefix.length());
|
|
||||||
boolean bracketOpen = false;
|
|
||||||
int pragmaMax = 0;
|
|
||||||
String distr = "";
|
|
||||||
for (int i = packedLine.indexOf('['); i < packedLine.length(); ++i) {
|
|
||||||
char c = packedLine.charAt(i);
|
|
||||||
if (bracketOpen) {
|
|
||||||
if (c == ']') {
|
|
||||||
bracketOpen = false;
|
|
||||||
if (distr.equals("block"))
|
|
||||||
pragmaMax++;
|
|
||||||
distr = "";
|
|
||||||
} else {
|
|
||||||
distr += c;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (c == '[') {
|
|
||||||
bracketOpen = true;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fileMax = Math.max(fileMax, pragmaMax);
|
|
||||||
}
|
|
||||||
++n;
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
return fileMax;
|
|
||||||
}
|
|
||||||
public static int getCProjectMaxDim(db_project_info project) {
|
|
||||||
int res = 0;
|
|
||||||
for (DBProjectFile file : project.db.files.Data.values()) {
|
|
||||||
if (file.isActiveProgram())
|
|
||||||
res = Math.max(res, getCTestMaxDim(file.file));
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
public static boolean isTimeout(long startDate, long maxtime_sec) {
|
public static boolean isTimeout(long startDate, long maxtime_sec) {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
long delta = (now.getTime() - startDate) / 1000;
|
long delta = (now.getTime() - startDate) / 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user