убрал наличие бд в тестах.
This commit is contained in:
14
.idea/workspace.xml
generated
14
.idea/workspace.xml
generated
@@ -6,7 +6,19 @@
|
||||
</artifacts-to-build>
|
||||
</component>
|
||||
<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 beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/Files/DBProjectFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Files/DBProjectFile.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ProjectData/Files/ProjectFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Files/ProjectFile.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/Repository/Component/Sapfor/Sapfor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Component/Sapfor/Sapfor.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/Group/Group.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/Group/Group.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/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ConvertCorrectnessTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ConvertCorrectnessTests.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestFromDirectory.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestFromDirectory.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
|
||||
@@ -108,6 +108,10 @@ public class Utils {
|
||||
int di = fn.lastIndexOf(".");
|
||||
return (di >= 0) ? fn.substring(di + 1).toLowerCase() : "";
|
||||
}
|
||||
public static String getExtensionByName(String fn) {;
|
||||
int di = fn.lastIndexOf(".");
|
||||
return (di >= 0) ? fn.substring(di + 1).toLowerCase() : "";
|
||||
}
|
||||
public static String getFileNameWithoutExtension(File file) {
|
||||
return getNameWithoutExtension(file.getName());
|
||||
}
|
||||
@@ -958,11 +962,11 @@ public class Utils {
|
||||
case "for":
|
||||
case "f77":
|
||||
case "f90":
|
||||
// case "fh":
|
||||
// case "fh":
|
||||
case "c":
|
||||
case "cdv":
|
||||
case "cpp":
|
||||
// case "h":
|
||||
// case "h":
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1124,5 +1128,11 @@ public class Utils {
|
||||
if (!last_dir_home.isEmpty())
|
||||
directoryChooser.SetCurrentDirectory(last_dir_home);
|
||||
}
|
||||
public static void ClearProjectData(File project_home) throws Exception {
|
||||
Utils.deleteFilesByExtensions(project_home, "dep", "proj");
|
||||
File project_data = new File(project_home, Constants.data);
|
||||
if (project_data.exists())
|
||||
FileUtils.forceDelete(project_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,11 +122,9 @@ public class DBProjectFile extends ProjectFile {
|
||||
//для совместимости пусть палки будут от винды всегда.
|
||||
name = path.substring(father.Home.getAbsolutePath().length() + 1).replace('/', '\\');
|
||||
}
|
||||
|
||||
public boolean isMakefile() {
|
||||
return file.getName().equalsIgnoreCase("makefile");
|
||||
}
|
||||
|
||||
public boolean isActiveProgram() {
|
||||
return fileType.equals(FileType.program)
|
||||
&& languageName.equals(father.languageName) && !state.equals(FileState.Excluded);
|
||||
@@ -393,9 +391,7 @@ public class DBProjectFile extends ProjectFile {
|
||||
public String getQObjectName() {
|
||||
return Utils.DQuotes(getUnixName() + ".o");
|
||||
}
|
||||
public String getQSourceName() {
|
||||
return Utils.DQuotes(getUnixName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
@@ -473,18 +469,5 @@ public class DBProjectFile extends ProjectFile {
|
||||
return res;
|
||||
}
|
||||
//---
|
||||
public String getStyleOptions() {
|
||||
if (languageName == LanguageName.fortran) {
|
||||
switch (style) {
|
||||
case fixed:
|
||||
case extended:
|
||||
return "-FI";
|
||||
case free:
|
||||
return "-f90";
|
||||
case none:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,10 @@ public class ProjectFile extends DBObject {
|
||||
public Object getPK() {
|
||||
return file.getName();
|
||||
}
|
||||
public void AutoDetectProperties() {
|
||||
public void AutoDetectProperties(){
|
||||
AutoDetectProperties(file.getName());
|
||||
}
|
||||
public void AutoDetectProperties(String name_in) {
|
||||
//проверка запретных имен.
|
||||
String[] forbiddenNames = new String[]{
|
||||
Constants.INTERRUPT,
|
||||
@@ -39,13 +42,13 @@ public class ProjectFile extends DBObject {
|
||||
"Makefile"
|
||||
};
|
||||
for (String forbidden : forbiddenNames) {
|
||||
if (file.getName().equalsIgnoreCase(forbidden)) {
|
||||
if (name_in.equalsIgnoreCase(forbidden)) {
|
||||
fileType = FileType.forbidden;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//-
|
||||
switch (Utils.getExtension(file)) {
|
||||
switch (Utils.getExtensionByName(name_in)) {
|
||||
case "f":
|
||||
case "fdv":
|
||||
case "for":
|
||||
@@ -84,7 +87,7 @@ public class ProjectFile extends DBObject {
|
||||
fileType = FileType.forbidden;
|
||||
break;
|
||||
case "":
|
||||
if (Utils.isDigit(file.getName())) {
|
||||
if (Utils.isDigit(name_in)) {
|
||||
fileType = FileType.forbidden;
|
||||
} else {
|
||||
state = FileState.Excluded;
|
||||
@@ -133,4 +136,21 @@ public class ProjectFile extends DBObject {
|
||||
public String toString() {
|
||||
return file.getName();
|
||||
}
|
||||
public String getQSourceName() {
|
||||
return Utils.DQuotes(getUnixName());
|
||||
}
|
||||
public String getStyleOptions() {
|
||||
if (languageName == LanguageName.fortran) {
|
||||
switch (style) {
|
||||
case fixed:
|
||||
case extended:
|
||||
return "-FI";
|
||||
case free:
|
||||
return "-f90";
|
||||
case none:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ import ProjectData.SapforData.Regions.RegionsSet;
|
||||
import ProjectData.SapforData.Variants.ParallelVariant;
|
||||
import ProjectData.SapforData.Variants.VariantsSet;
|
||||
import TestingSystem.Common.Test.ProjectFiles_json;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import com.mxgraph.swing.mxGraphComponent;
|
||||
@@ -210,26 +209,6 @@ public class db_project_info extends DBObject {
|
||||
ExtractStoredInfo(stored_info);
|
||||
db.Disconnect();
|
||||
}
|
||||
//для запуска тестов.
|
||||
public db_project_info(Test test) throws Exception {
|
||||
Home = test.getServerPath();
|
||||
//-
|
||||
CheckVisualiserDirectories();
|
||||
db = new ProjectDatabase(this);
|
||||
db.Connect();
|
||||
db.CreateAllTables();
|
||||
db.prepareTablesStatements();
|
||||
db.Synchronize(); //Отличие от обычного. тут сразу же и синхрон файлов.
|
||||
db_project_info stored_info = db.LoadOnlyProjectInfo();
|
||||
if (stored_info == null) {
|
||||
name = Home.getName();
|
||||
description = "";
|
||||
creationDate = Utils.getDateNumber(); //----------------------------------------------------------------------------->>>
|
||||
db.Insert(this);
|
||||
} else
|
||||
ExtractStoredInfo(stored_info);
|
||||
db.Disconnect();
|
||||
}
|
||||
//-
|
||||
public void Open() throws Exception {
|
||||
db.Connect();
|
||||
@@ -1557,16 +1536,4 @@ public class db_project_info extends DBObject {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void clearData() throws Exception {
|
||||
File project_data = new File(Home, Constants.data);
|
||||
File[] files = project_data.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
System.out.println(file.getAbsolutePath());
|
||||
if (!file.getName().equalsIgnoreCase("new_project_base.sqlite")) {
|
||||
Utils.forceDeleteWithCheck(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Files.LanguageStyle;
|
||||
import Repository.Component.OSDComponent;
|
||||
import Repository.Component.Visualizer_2;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
@@ -423,17 +424,16 @@ public abstract class Sapfor extends OSDComponent {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//---
|
||||
public static Vector<String> outputLines = null;
|
||||
public static Vector<String> errorsLines = null;
|
||||
//---
|
||||
//--
|
||||
public static boolean performScript(String name, //имя скрипта
|
||||
File sapfor_drv, //путь к сапфору
|
||||
File workspace, //проект
|
||||
String command, //проход
|
||||
String flags, //флаги
|
||||
String outName,
|
||||
String errName) throws Exception {
|
||||
String errName,
|
||||
Vector<String> resultLines
|
||||
) throws Exception {
|
||||
Process process = null;
|
||||
int exit_code = Constants.Nan;
|
||||
//---
|
||||
@@ -441,13 +441,10 @@ public abstract class Sapfor extends OSDComponent {
|
||||
Utils.CheckDirectory(data_workspace);
|
||||
File outputFile = new File(data_workspace, outName);
|
||||
File errorsFile = new File(data_workspace, errName);
|
||||
outputLines = null;
|
||||
errorsLines = null;
|
||||
Utils.delete_with_check(outputFile);
|
||||
Utils.delete_with_check(errorsFile);
|
||||
//---
|
||||
File file = new File(data_workspace, name + (Global.isWindows ? ".bat" : ".sh"));
|
||||
System.out.println(file.getAbsolutePath());
|
||||
FileUtils.write(file,
|
||||
Utils.DQuotes(sapfor_drv)
|
||||
+ (flags.isEmpty() ? "" : (" " + flags))
|
||||
@@ -477,12 +474,25 @@ public abstract class Sapfor extends OSDComponent {
|
||||
while (!flag);
|
||||
process = null;
|
||||
//---
|
||||
outputLines = new Vector<>(FileUtils.readLines(outputFile));
|
||||
errorsLines = new Vector<>(FileUtils.readLines(errorsFile));
|
||||
Vector<String> outputLines = new Vector<>(FileUtils.readLines(outputFile));
|
||||
Vector<String> errorsLines = new Vector<>(FileUtils.readLines(errorsFile));
|
||||
if (resultLines != null) {
|
||||
resultLines.addAll(outputLines);
|
||||
}
|
||||
return (exit_code == 0) &&
|
||||
checkLines(outputLines) &&
|
||||
checkLines(errorsLines);
|
||||
}
|
||||
public static boolean performScript(String name, //имя скрипта
|
||||
File sapfor_drv, //путь к сапфору
|
||||
File workspace, //проект
|
||||
String command, //проход
|
||||
String flags, //флаги
|
||||
String outName,
|
||||
String errName
|
||||
) throws Exception {
|
||||
return performScript(name, sapfor_drv, workspace, command, flags, outName, errName, null);
|
||||
}
|
||||
public static boolean parse(File sapfor_drv, File workspace, String flags) throws Exception {
|
||||
return performScript(
|
||||
"parse",
|
||||
@@ -494,14 +504,16 @@ public abstract class Sapfor extends OSDComponent {
|
||||
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 {
|
||||
public static boolean analysis(File sapfor_drv, File workspace, PassCode_2021 code, String flags, Vector<String> result_lines) throws Exception {
|
||||
return performScript("analysis",
|
||||
sapfor_drv,
|
||||
workspace,
|
||||
code.getTestingCommand(),
|
||||
flags,
|
||||
Constants.out_file,
|
||||
Constants.err_file);
|
||||
Constants.err_file,
|
||||
result_lines
|
||||
);
|
||||
}
|
||||
public static File temp_copy = null;
|
||||
public static File getTempCopy(File src) throws Exception {
|
||||
@@ -512,4 +524,27 @@ public abstract class Sapfor extends OSDComponent {
|
||||
}
|
||||
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_2021.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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ import Common.Database.riDBObject;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Files.ProjectFile;
|
||||
import ProjectData.LanguageName;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import TestingSystem.Common.Test.TestType;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Group extends riDBObject {
|
||||
//-
|
||||
public static void generateForLanguage(
|
||||
String dvm_drv,
|
||||
LinkedHashMap<LanguageName, Vector<DBProjectFile>> programs,
|
||||
LinkedHashMap<LanguageName, Vector<ProjectFile>> programs,
|
||||
LanguageName language,
|
||||
Vector<String> titles,
|
||||
Vector<String> objects,
|
||||
@@ -63,10 +63,9 @@ public class Group extends riDBObject {
|
||||
Vector<String> module_objects = new Vector<>();
|
||||
String module_body = "";
|
||||
int i = 1;
|
||||
for (DBProjectFile program : programs.get(language)) {
|
||||
for (ProjectFile program : programs.get(language)) {
|
||||
//--
|
||||
program.last_assembly_name = language + "_" + i + ".o";
|
||||
String object = Utils.DQuotes(program.last_assembly_name);
|
||||
String object = Utils.DQuotes(language + "_" + i + ".o");
|
||||
module_objects.add(object);
|
||||
module_body +=
|
||||
object + ":\n" +
|
||||
@@ -93,9 +92,9 @@ public class Group extends riDBObject {
|
||||
bodies.add(module_body);
|
||||
}
|
||||
}
|
||||
public String GenerateMakefile(db_project_info project, String dvm_drv, String flags_in) {
|
||||
public String GenerateMakefile(Test test, String dvm_drv, String flags_in) {
|
||||
//----->>
|
||||
LinkedHashMap<LanguageName, Vector<DBProjectFile>> programs = project.getPrograms();
|
||||
LinkedHashMap<LanguageName, Vector<ProjectFile>> programs = test.getPrograms();
|
||||
Vector<String> titles = new Vector<>();
|
||||
Vector<String> objects = new Vector<>();
|
||||
Vector<String> bodies = new Vector<>();
|
||||
|
||||
@@ -6,7 +6,10 @@ import Common.Database.riDBObject;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import ProjectData.Files.FileState;
|
||||
import ProjectData.Files.FileType;
|
||||
import ProjectData.Files.ProjectFile;
|
||||
import ProjectData.LanguageName;
|
||||
import Repository.RepositoryRefuseException;
|
||||
import Visual_DVM_2021.Passes.All.UnzipFolderPass;
|
||||
import Visual_DVM_2021.Passes.All.ZipFolderPass;
|
||||
@@ -15,6 +18,8 @@ import com.sun.org.glassfish.gmbal.Description;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class Test extends riDBObject {
|
||||
@Description("DEFAULT 1")
|
||||
public int min_dim = 1; //мин размерность теста.
|
||||
@@ -76,7 +81,7 @@ public class Test extends riDBObject {
|
||||
return new File(Global.TempDirectory, temp_project_name);
|
||||
}
|
||||
//--
|
||||
public db_project_info packCode(File dir, boolean create_archive) throws Exception {
|
||||
public File packCode(File dir, boolean create_archive) throws Exception {
|
||||
temp_project_name = Utils.getDateName("test");
|
||||
//-
|
||||
File tempProject = getTempProject();
|
||||
@@ -85,12 +90,7 @@ public class Test extends riDBObject {
|
||||
FileUtils.forceMkdir(tempProject);
|
||||
FileUtils.copyDirectory(dir, tempProject);
|
||||
//---
|
||||
db_project_info project = new db_project_info(tempProject);
|
||||
project.Open();
|
||||
project.Close();
|
||||
// UI.Info("clear data for "+project.Home.getAbsolutePath());
|
||||
project.clearData();
|
||||
// UI.Info("DONE");
|
||||
Utils.ClearProjectData(tempProject);
|
||||
//--
|
||||
if (create_archive) {
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
@@ -98,7 +98,7 @@ public class Test extends riDBObject {
|
||||
project_archive_bytes = Utils.packFile(tempArchive);
|
||||
} else throw new PassException("Не удалось создать архив папки с кодом.");
|
||||
}
|
||||
return project;
|
||||
return tempProject;
|
||||
}
|
||||
public boolean unpackProjectOnServer() throws Exception {
|
||||
File tmpArchive = new File(Global.TempDirectory, temp_project_name + ".zip");
|
||||
@@ -134,4 +134,24 @@ public class Test extends riDBObject {
|
||||
public String getFilesForTable() {
|
||||
return files.replace("\n", ";");
|
||||
}
|
||||
|
||||
public LinkedHashMap<LanguageName, Vector<ProjectFile>> getPrograms(){
|
||||
LinkedHashMap<LanguageName, Vector<ProjectFile>> res = new LinkedHashMap<>();
|
||||
//--
|
||||
res.put(LanguageName.fortran, new Vector<>());
|
||||
res.put(LanguageName.c, new Vector<>());
|
||||
res.put(LanguageName.cpp, new Vector<>());
|
||||
//--
|
||||
String[] files_names = files.split("\n");
|
||||
for (String file_name: files_names){
|
||||
ProjectFile file = new ProjectFile(new File(file_name));
|
||||
//--
|
||||
if (!file.state.equals(FileState.Excluded) &&
|
||||
file.fileType.equals(FileType.program) &&
|
||||
(!file.languageName.equals(LanguageName.n)))
|
||||
res.get(file.languageName).add(file);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import GlobalData.Settings.SettingName;
|
||||
import GlobalData.Tasks.TaskState;
|
||||
import GlobalData.User.User;
|
||||
import ProjectData.LanguageName;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Repository.Component.Sapfor.Sapfor;
|
||||
import Repository.EmailMessage;
|
||||
import Repository.RepositoryRefuseException;
|
||||
@@ -390,7 +389,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
case RefreshDVMTests:
|
||||
Print("Синхронизировать репозиторий тестов ");
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = RefreshDVMTests((Account) request.object, Integer.parseInt(request.arg));
|
||||
RefreshDVMTests((Account) request.object, Integer.parseInt(request.arg));
|
||||
break;
|
||||
//--
|
||||
default:
|
||||
@@ -423,7 +422,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
//->>
|
||||
return new Pair<>(object, groupFiles);
|
||||
}
|
||||
public LinkedHashMap<Group, Vector<Test>> RefreshDVMTests(Account account, int sapfor_id) throws Exception {
|
||||
public void RefreshDVMTests(Account account, int sapfor_id) throws Exception {
|
||||
ServerSapfor sapfor = null;
|
||||
if (!db.serverSapfors.containsKey(sapfor_id))
|
||||
throw new RepositoryRefuseException("Версия SAPFOR с ключом " + sapfor_id + " не найдена.");
|
||||
@@ -489,45 +488,34 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
test.sender_name = account.name;
|
||||
test.sender_address = account.email;
|
||||
test.group_id = group.id;
|
||||
test.files=file.getName();
|
||||
db.Insert(test);
|
||||
testsIds.add(test);
|
||||
//->>
|
||||
File testProject = new File(Global.TestsDirectory, String.valueOf(test.id));
|
||||
Utils.CheckAndCleanDirectory(testProject);
|
||||
File testFile = Paths.get(testProject.getAbsolutePath(), file.getName()).toFile();
|
||||
File testDirectory = new File(Global.TestsDirectory, String.valueOf(test.id));
|
||||
Utils.CheckAndCleanDirectory(testDirectory);
|
||||
File testFile = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
|
||||
FileUtils.copyFile(file, testFile);
|
||||
//----
|
||||
//архивация.
|
||||
File archive = test.getArchive();
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
zip.Do(testProject.getAbsolutePath(), archive.getAbsolutePath());
|
||||
zip.Do(testDirectory.getAbsolutePath(), archive.getAbsolutePath());
|
||||
//---
|
||||
//Определение размерности
|
||||
switch (group.language) {
|
||||
case fortran:
|
||||
if (Sapfor.parse(Sapfor.getTempCopy(new File(sapfor.call_command)), testProject, "-noLogo")
|
||||
) {
|
||||
if (Sapfor.analysis(Sapfor.getTempCopy(new File(sapfor.call_command)), testProject,
|
||||
PassCode_2021.SPF_GetMaxMinBlockDistribution,
|
||||
"-noLogo"
|
||||
)) {
|
||||
for (String line : Sapfor.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);
|
||||
db.Update(test);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
throw new RepositoryRefuseException("Не удалось определить размерность.проекта " + Utils.Brackets(test.description));
|
||||
} else {
|
||||
throw new RepositoryRefuseException("Не удалось выполнить синтаксический анализ проекта " + Utils.Brackets(test.description));
|
||||
}
|
||||
break;
|
||||
// временная папка для анализа. чтобы не засорять нормальную.
|
||||
File tempProject = Utils.getTempFileName("test");
|
||||
FileUtils.forceMkdir(tempProject);
|
||||
FileUtils.copyDirectory(testDirectory, tempProject);
|
||||
//--
|
||||
if (Sapfor.getMinMaxDim(Sapfor.getTempCopy(new File(sapfor.call_command)), tempProject, test)) {
|
||||
db.Update(test);
|
||||
}
|
||||
else
|
||||
throw new RepositoryRefuseException("Не удалось определить размерность теста " + Utils.Brackets(test.description));
|
||||
break;
|
||||
case c:
|
||||
test.max_dim = Utils.getCTestMaxDim(testFile);
|
||||
db.Update(test);
|
||||
@@ -536,7 +524,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------->>>
|
||||
@Override
|
||||
@@ -570,7 +557,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
for (int test_id : group_tasks.keySet()) {
|
||||
if (db.tests.containsKey(test_id)) {
|
||||
Test test = db.tests.get(test_id);
|
||||
db_project_info project = new db_project_info(test);//Открытие бд проекта и ее синхронизация. неизбежно.
|
||||
//---
|
||||
for (TestCompilationTask task : group_tasks.get(test_id)) {
|
||||
Print("принять задачу на компиляцию " + group_id + ":" + test_id + ":" + task.flags);
|
||||
@@ -578,7 +564,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
task.state = TaskState.Waiting;
|
||||
task.id = db.IncKey(SettingName.TaskMaxId);
|
||||
task.taskspackage_id = tasksPackage.id;
|
||||
task.makefile_text = group.GenerateMakefile(project, tasksPackage.dvm_drv, task.flags);
|
||||
task.makefile_text = group.GenerateMakefile(test, tasksPackage.dvm_drv, task.flags);
|
||||
task.test_home = tasksPackage.user_workspace + "/projects/" + test_id;
|
||||
//-->>
|
||||
task.remote_workspace =
|
||||
|
||||
@@ -17,6 +17,10 @@ public class ConvertCorrectnessTests extends TestingSystemPass<File> {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected int getTimeout() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!Current.getAccount().isAdmin()) {
|
||||
Log.Writeln_("Вы не являетесь администратором");
|
||||
|
||||
@@ -5,7 +5,7 @@ import Common.Utils.Files.VDirectoryChooser;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import ProjectData.Files.ProjectFile;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import ProjectData.LanguageName;
|
||||
import Repository.Component.Sapfor.Sapfor;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
@@ -116,7 +116,9 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
return false;
|
||||
}
|
||||
if (other_project_files > 0) {
|
||||
Log.Writeln_("Папка содержит файлы, не являющиеся программами на языке FORTRAN, или заголовочными.");
|
||||
Log.Writeln_("Папка содержит файлы, не являющиеся программами на языке " +
|
||||
group.language.getDescription() +
|
||||
", или заголовочными.");
|
||||
return false;
|
||||
}
|
||||
//-----
|
||||
@@ -135,30 +137,11 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
protected void body() throws Exception {
|
||||
ShowMessage1(dir.getName());
|
||||
//--
|
||||
db_project_info project = target.packCode(dir, true); //создание копии папки, и архивация.
|
||||
File tempProject = target.packCode(dir, true); //создание копии папки, и архивация.
|
||||
//-- получить размерность консольным сапфором. папка уже отправлена и чистить ее не нужно!!
|
||||
ShowMessage2("Синтаксический анализ");
|
||||
if (Sapfor.parse(Sapfor.getTempCopy(Current.getSapfor().getFile()), project.Home, Current.getSapfor().getConsoleFlags())
|
||||
) {
|
||||
ShowMessage2("Определение размерности");
|
||||
if (Sapfor.analysis(Sapfor.getTempCopy(Current.getSapfor().getFile()), project.Home,
|
||||
PassCode_2021.SPF_GetMaxMinBlockDistribution,
|
||||
Current.getSapfor().getConsoleFlags())) {
|
||||
for (String line : Sapfor.outputLines) {
|
||||
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
|
||||
if (line.startsWith(prefix)) {
|
||||
String s = line.substring(prefix.length());
|
||||
System.out.println(Utils.Brackets(s));
|
||||
String[] data = s.split(" ");
|
||||
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()));
|
||||
} else {
|
||||
Log.Writeln_("Не удалось выполнить синтаксический анализ проекта " + Utils.Brackets(dir.getName()));
|
||||
}
|
||||
ShowMessage2("Синтаксический анализ и определение размерности");
|
||||
if (group.language.equals(LanguageName.fortran)&&!Sapfor.getMinMaxDim(Sapfor.getTempCopy(Current.getSapfor().getFile()), tempProject, target))
|
||||
Log.Writeln_("Не удалось определить размерность теста " + Utils.Brackets(tempProject.getName()));
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
|
||||
Reference in New Issue
Block a user