++
Оптимизация анализа состояния версий пакетов сапфор
This commit is contained in:
@@ -180,6 +180,11 @@ public abstract class Sapfor extends OSDComponent {
|
||||
if (line.toLowerCase().contains("segmentation fault")) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
if (line.toLowerCase().contains("error in unparse")) {
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import Common.Utils.Vector_;
|
||||
|
||||
import java.util.Vector;
|
||||
public class Constants {
|
||||
public static final int version = 1232;
|
||||
public static final int version = 1233;
|
||||
public static final int planner_version = 24;
|
||||
public static final int testingMaxKernels = 64;
|
||||
//--
|
||||
|
||||
47
src/_VisualDVM/Passes/All/RefreshSapforPackageResults.java
Normal file
47
src/_VisualDVM/Passes/All/RefreshSapforPackageResults.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Server.TestingServerPass;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.io.File;
|
||||
public class RefreshSapforPackageResults extends TestingServerPass<SapforPackage> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Menu/Undo.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!Global.testingServer.db.sapforPackages.getUI().CheckCurrent(Log))
|
||||
return false;
|
||||
target = Global.testingServer.db.sapforPackages.getUI().getCurrent();
|
||||
if (!new File(target.getLocalWorkspace(), CommonConstants.LOADED).exists()) {
|
||||
Log.Writeln_("Пакет не загружен!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
target.checkFinishState();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
SendRequest(ServerCode.ReplaceSapforPackageResults, "",
|
||||
new Pair<>(
|
||||
target,
|
||||
Utils_.fileToBytes(target.getJsonFile())
|
||||
)
|
||||
);
|
||||
Global.mainModule.getPass(PassCode.SynchronizeTests).Do();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +360,8 @@ public enum PassCode implements PassCode_ {
|
||||
ComponentsServerBackUp,
|
||||
TestingServerBackUp,
|
||||
CompareDVMRunTaskToEthalon,
|
||||
DropSapforConfigurationEthalon;
|
||||
DropSapforConfigurationEthalon,
|
||||
RefreshSapforPackageResults;
|
||||
//--
|
||||
@Override
|
||||
public String getDescription() {
|
||||
@@ -393,6 +394,8 @@ public enum PassCode implements PassCode_ {
|
||||
return "Определить размерность тестов";
|
||||
case RefreshDVMPackageResults:
|
||||
return "Обновить результаты анализа пакета тестирования DVM";
|
||||
case RefreshSapforPackageResults:
|
||||
return "Обновить результаты анализа пакета тестирования SAPFOR";
|
||||
case JoinSapforTestingVersionsToGroup:
|
||||
return "Присоединить итоговые версии пакета тестирования SAPFOR к текущей группе тестов";
|
||||
case ResumeDVMPackage:
|
||||
|
||||
@@ -68,7 +68,8 @@ public enum ServerCode {
|
||||
GetDVMPackageCredentials,
|
||||
CreateBackUp,
|
||||
GetFirstEmailToSend,
|
||||
SynchronizeSapforRepoitory;
|
||||
SynchronizeSapforRepoitory,
|
||||
ReplaceSapforPackageResults;
|
||||
public String getDescription() {
|
||||
switch (this) {
|
||||
case SynchronizeSapforRepoitory:
|
||||
@@ -95,6 +96,8 @@ public enum ServerCode {
|
||||
return "Определить размерность тестов на сервере";
|
||||
case ReplaceDVMPackageResults:
|
||||
return "Заменить json DVM пакета";
|
||||
case ReplaceSapforPackageResults:
|
||||
return "Заменить json Sapfor пакета";
|
||||
case JoinSapforVersionsToGroup:
|
||||
return "Присоединение версий к группе на сервере";
|
||||
case GetComponentsVersionsInfo:
|
||||
|
||||
@@ -689,6 +689,16 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
db.Update(dst);
|
||||
Utils_.bytesToFile(packed_file, dst.getJsonFile());
|
||||
}
|
||||
void ReplaceSapforPackageJson() throws Exception {
|
||||
Pair<SapforPackage, byte[]> p = (Pair<SapforPackage, byte[]>) request.object;
|
||||
SapforPackage src = p.getKey();
|
||||
byte[] packed_file = p.getValue();
|
||||
checkExistense(src.id, SapforPackage.class);
|
||||
SapforPackage dst = db.sapforPackages.get(src.id);
|
||||
dst.SynchronizeFields(src);
|
||||
db.Update(dst);
|
||||
Utils_.bytesToFile(packed_file, dst.getJsonFile());
|
||||
}
|
||||
void DetectTestsMinMaxDim() throws Exception {
|
||||
Vector<Object> keys = (Vector<Object>) request.object;
|
||||
for (Object key : keys) {
|
||||
@@ -776,6 +786,9 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
case ReplaceDVMPackageResults:
|
||||
ReplaceDVMPackageJson();
|
||||
break;
|
||||
case ReplaceSapforPackageResults:
|
||||
ReplaceSapforPackageJson();
|
||||
break;
|
||||
case DetectTestsMinMaxDim:
|
||||
DetectTestsMinMaxDim();
|
||||
break;
|
||||
|
||||
@@ -667,53 +667,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
}
|
||||
//--
|
||||
public void Patch() throws Exception {
|
||||
/*
|
||||
Vector<DVMCompilationOptionsSet> sets1 = new Vector<>();
|
||||
for (DVMSettings dvm_settings : dvmSettings.Data.values()) {
|
||||
OptionsSetJson optionsSetJson = Utils_.gson.fromJson(dvm_settings.packedCompilationOptionsJson, OptionsSetJson.class);
|
||||
for (OptionsJson optionsJson : optionsSetJson.values) {
|
||||
DVMCompilationOptionsSet set = new DVMCompilationOptionsSet(dvm_settings);
|
||||
set.options = new Vector<>();
|
||||
for (OptionJson optionJson : optionsJson.values) {
|
||||
set.options.add(new DVMCompilationOption(optionJson.name, optionJson.value));
|
||||
}
|
||||
sets1.add(set);
|
||||
}
|
||||
}
|
||||
BeginTransaction();
|
||||
for (DVMCompilationOptionsSet set : sets1) {
|
||||
Insert(set);
|
||||
|
||||
for (DVMCompilationOption option : set.options) {
|
||||
option.dvmcompilationoptionsset_id = set.id;
|
||||
Insert(option);
|
||||
}
|
||||
}
|
||||
Commit();
|
||||
Vector<DVMEnvironmentsSet> sets = new Vector<>();
|
||||
for (DVMSettings dvm_settings : dvmSettings.Data.values()) {
|
||||
EnvironmentsSetJson environmentsSetJson = Utils_.gson.fromJson(dvm_settings.packedRunEnvironmentValuesJson, EnvironmentsSetJson.class);
|
||||
for (EnvironmentsJson environmentsJson : environmentsSetJson.values) {
|
||||
DVMEnvironmentsSet set = new DVMEnvironmentsSet(dvm_settings);
|
||||
set.environments = new Vector<>();
|
||||
for (EnvironmentJson environmentJson : environmentsJson.values) {
|
||||
set.environments.add(new DVMEnvironment(environmentJson.name, environmentJson.value));
|
||||
}
|
||||
sets.add(set);
|
||||
}
|
||||
}
|
||||
BeginTransaction();
|
||||
for (DVMEnvironmentsSet set : sets) {
|
||||
Insert(set);
|
||||
for (DVMEnvironment option : set.environments) {
|
||||
option.dvmenvironmentsset_id = set.id;
|
||||
Insert(option);
|
||||
}
|
||||
}
|
||||
Commit();
|
||||
*/
|
||||
}
|
||||
public Vector<Pair<String, String>> getTasksParameters(DVMSettings dvmSettings_in) {
|
||||
//уравниваем количество наборов опций и окружений и сопоставляем 1 к 1
|
||||
Vector<Pair<String, String>> res = new Vector<>();
|
||||
@@ -739,4 +692,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public void Patch() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +177,7 @@ public class SapforPackage_json implements Serializable {
|
||||
}
|
||||
return comparison_root.mismatches_count;
|
||||
}
|
||||
|
||||
public void getVersionsFiles(SapforPackage package_in) {
|
||||
//---
|
||||
//---
|
||||
|
||||
@@ -27,6 +27,8 @@ public class SapforVersion_json implements Serializable {
|
||||
public String version = "";
|
||||
@Expose
|
||||
public String description = "";
|
||||
@Expose
|
||||
public SapforVersionState state = null;
|
||||
//поля для отображения деревьев.
|
||||
public File Home = null;
|
||||
public LinkedHashMap<String, ProjectFile> files = new LinkedHashMap<>();
|
||||
@@ -39,8 +41,7 @@ public class SapforVersion_json implements Serializable {
|
||||
public SapforTask task = null; //родная задача. Нужна для построения дерева версий.
|
||||
public db_project_info project = null;
|
||||
//--
|
||||
public SapforVersionState state = null;
|
||||
public VersionComparisonState comparisonState = null;
|
||||
public VersionComparisonState comparisonState = VersionComparisonState.Unknown;
|
||||
//--
|
||||
public SapforVersion_json(String version_in, String description_in) {
|
||||
version = version_in;
|
||||
@@ -52,7 +53,6 @@ public class SapforVersion_json implements Serializable {
|
||||
}
|
||||
public void getFiles(File configurationRoot) {
|
||||
//--
|
||||
state = SapforVersionState.Empty;
|
||||
comparisonState = VersionComparisonState.Unknown;
|
||||
//--
|
||||
String relativePath = Utils_.isWindows() ? Utils_.toW(version) : version;
|
||||
@@ -70,7 +70,37 @@ public class SapforVersion_json implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
parse_out = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.parse_out_file).toFile());
|
||||
parse_err = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.parse_err_file).toFile());
|
||||
out = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.out_file).toFile());
|
||||
err = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.err_file).toFile());
|
||||
//--
|
||||
Vector<File> out_files = new Vector<>();
|
||||
out_files.add(parse_out.file);
|
||||
out_files.add(parse_err.file);
|
||||
out_files.add(out.file);
|
||||
out_files.add(err.file);
|
||||
}
|
||||
public void getFilesAndCheckState(File configurationRoot) {
|
||||
//--
|
||||
state = SapforVersionState.Empty;
|
||||
//--
|
||||
String relativePath = Utils_.isWindows() ? Utils_.toW(version) : version;
|
||||
Home = Paths.get(configurationRoot.getAbsolutePath(), relativePath).toFile();
|
||||
files = new LinkedHashMap<>();
|
||||
//--
|
||||
File[] files_ = Home.listFiles();
|
||||
if (files_ != null) {
|
||||
for (File file : files_) {
|
||||
if (file.isFile()) {
|
||||
ProjectFile projectFile = new ProjectFile(file);
|
||||
if (!projectFile.fileType.equals(FileType.forbidden)
|
||||
) {
|
||||
files.put(projectFile.file.getName(), projectFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!files.isEmpty())
|
||||
state = SapforVersionState.Normal;
|
||||
}
|
||||
@@ -84,7 +114,7 @@ public class SapforVersion_json implements Serializable {
|
||||
out_files.add(parse_err.file);
|
||||
out_files.add(out.file);
|
||||
out_files.add(err.file);
|
||||
|
||||
//--
|
||||
for (File file : out_files) {
|
||||
try {
|
||||
if (file.exists()) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
import _VisualDVM.TestingSystem.Common.TasksPackageState;
|
||||
import _VisualDVM.TestingSystem.Common.TestingPackage.TestingPackage;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.Json.SapforVersion_json;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforPackageConfiguration.SapforPackageConfiguration;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||
@@ -17,6 +18,7 @@ import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Vector;
|
||||
public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||
public int sapforId = CommonConstants.Nan; // так как сапфор на машине.
|
||||
@@ -106,8 +108,21 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||
if (!task.state.equals(TaskState.Done))
|
||||
bad++;
|
||||
else good++;
|
||||
//--
|
||||
Vector<SapforVersion_json> all_versions= new Vector<>();
|
||||
all_versions.addAll(task.versions);
|
||||
all_versions.addAll(task.variants);
|
||||
for (SapforVersion_json version_json: all_versions){
|
||||
File configurationRoot = Utils_.getFile(
|
||||
getLocalWorkspace().getAbsolutePath(),
|
||||
String.valueOf(task.set_id),
|
||||
String.valueOf(task.sapfor_configuration_id));
|
||||
version_json.getFilesAndCheckState(configurationRoot);
|
||||
}
|
||||
//--
|
||||
}
|
||||
state = (bad > 0) ? TasksPackageState.DoneWithErrors : TasksPackageState.Done;
|
||||
saveJson();
|
||||
state = ((bad > 0) ||(mismatchesCount>0)) ? TasksPackageState.DoneWithErrors : TasksPackageState.Done;
|
||||
double percent = (((double) (good)) / tasksCount) * 100.0;
|
||||
description = "Выполнено на " + ((int) percent) + "%\n" +
|
||||
"Всего задач: " + tasksCount + ", из них с ошибками " + bad;
|
||||
|
||||
@@ -130,7 +130,9 @@ public class SapforPackagesForm extends RDataSetControlForm<SapforPackage> {
|
||||
addSeparator();
|
||||
addPasses(PassCode.AbortSapforPackage);
|
||||
addSeparator();
|
||||
addPasses(PassCode.CompareSapforPackageToEthalon, PassCode.JoinSapforTestingVersionsToGroup);
|
||||
addPasses(PassCode.CompareSapforPackageToEthalon, PassCode.JoinSapforTestingVersionsToGroup
|
||||
// PassCode.RefreshSapforPackageResults
|
||||
);
|
||||
addSeparator();
|
||||
addPasses(PassCode.DeleteSapforPackage);
|
||||
}
|
||||
|
||||
@@ -242,14 +242,6 @@ public class SapforPackagesComparisonForm {
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
//теперь сравниваем задачи
|
||||
System.out.println("serial comparison");
|
||||
for (SapforTask task1 : package1.package_json.tasks) {
|
||||
SapforTask task2 = package2.package_json.getTaskByKey(task1.getUniqueKey());
|
||||
task1.checkMatch(task2);
|
||||
}
|
||||
System.out.println("DONE");
|
||||
/*
|
||||
ForkJoinPool commonPool = ForkJoinPool.commonPool();
|
||||
System.out.println("parallel comparison");
|
||||
commonPool.submit(() ->
|
||||
@@ -259,7 +251,7 @@ public class SapforPackagesComparisonForm {
|
||||
task1.checkMatch(task2);
|
||||
})
|
||||
).join();
|
||||
*/
|
||||
System.out.println("done");
|
||||
package1.package_json.buildComparisonTree(package1);
|
||||
package2.package_json.buildComparisonTree(package2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user