конвертация стандартных тестов на стороне сервера. стало быстрее.
This commit is contained in:
@@ -1,20 +1,12 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class ConvertCorrectnessTests extends TestingSystemPass<File> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
@@ -26,10 +18,14 @@ public class ConvertCorrectnessTests extends TestingSystemPass<File> {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!Current.getAccount().isAdmin())
|
||||
if (!Current.getAccount().isAdmin()) {
|
||||
Log.Writeln_("Вы не являетесь администратором");
|
||||
else return UI.Warning("Загрузить полный пакет DVM тестов на корректность и производительность.");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
if (!Current.Check(Log, Current.ServerSapfor)){
|
||||
return false;
|
||||
}
|
||||
return UI.Warning("Загрузить полный пакет DVM тестов на корректность и производительность.");
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
@@ -47,38 +43,7 @@ public class ConvertCorrectnessTests extends TestingSystemPass<File> {
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.RefreshDVMTests, "", Current.getAccount()));
|
||||
LinkedHashMap<Group, Vector<Test>> ids = (LinkedHashMap<Group, Vector<Test>>) response.object;
|
||||
ShowMessage1("Определение размерности тестов");
|
||||
for (Group group : ids.keySet()) {
|
||||
Vector<Test> tests = ids.get(group);
|
||||
for (Test test : tests) {
|
||||
ShowMessage2(group.description+" : "+test.description);
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DownloadTest, String.valueOf(test.id)));
|
||||
File testArchive = Utils.getTempFileName(String.valueOf(test));
|
||||
response.Unpack(testArchive);
|
||||
File testProject = new File(Global.TempDirectory, String.valueOf(test.id));
|
||||
Utils.forceDeleteWithCheck(testProject);
|
||||
FileUtils.forceMkdir(testProject);
|
||||
passes.get(PassCode_2021.UnzipFolderPass).Do(testArchive.getAbsolutePath(), Global.TempDirectory.getAbsolutePath());
|
||||
//без создания бд!!
|
||||
File[] files = testProject.listFiles();
|
||||
if (files != null && files.length > 0) {
|
||||
db_project_info vizTestProject = new db_project_info(testProject, "", false);
|
||||
switch (group.language) {
|
||||
case fortran:
|
||||
test.max_dim = Current.getSapfor().getTextMaxDim(files[0], vizTestProject);
|
||||
System.out.println(test.max_dim);
|
||||
break;
|
||||
case c:
|
||||
test.max_dim = Utils.getCTestMaxDim(files[0]);
|
||||
System.out.println(test.max_dim);
|
||||
break;
|
||||
}
|
||||
}
|
||||
EditObject(test);
|
||||
}
|
||||
}
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.RefreshDVMTests, String.valueOf(Current.getServerSapfor().id), Current.getAccount()));
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
|
||||
@@ -135,13 +135,13 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
protected void body() throws Exception {
|
||||
ShowMessage1(dir.getName());
|
||||
//--
|
||||
db_project_info project = target.packCode(dir); //создание копии папки, и архивация.
|
||||
db_project_info project = target.packCode(dir, true); //создание копии папки, и архивация.
|
||||
//-- получить размерность консольным сапфором. папка уже отправлена и чистить ее не нужно!!
|
||||
ShowMessage2("Синтаксический анализ");
|
||||
if (Sapfor.parse(Sapfor.getTempCopy(), project.Home, Current.getSapfor().getConsoleFlags())
|
||||
if (Sapfor.parse(Sapfor.getTempCopy(Current.getSapfor().getFile()), project.Home, Current.getSapfor().getConsoleFlags())
|
||||
) {
|
||||
ShowMessage2("Определение размерности");
|
||||
if (Sapfor.analysis(Sapfor.getTempCopy(), project.Home,
|
||||
if (Sapfor.analysis(Sapfor.getTempCopy(Current.getSapfor().getFile()), project.Home,
|
||||
PassCode_2021.SPF_GetMaxMinBlockDistribution,
|
||||
Current.getSapfor().getConsoleFlags())) {
|
||||
for (String line : Sapfor.outputLines) {
|
||||
@@ -150,8 +150,9 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
String s = line.substring(prefix.length());
|
||||
System.out.println(Utils.Brackets(s));
|
||||
String[] data = s.split(" ");
|
||||
target.min_dim = Integer.parseInt(data[0]);
|
||||
target.max_dim = Integer.parseInt(data[1]);
|
||||
target.min_dim = Math.max(Integer.parseInt(data[0]),0);
|
||||
target.max_dim = Math.max(Integer.parseInt(data[1]),0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else Log.Writeln_("Не удалось определить размерность.проекта " + Utils.Brackets(dir.getName()));
|
||||
|
||||
Reference in New Issue
Block a user