no message

This commit is contained in:
2024-10-07 14:22:52 +03:00
parent 6b1576461d
commit 61fc37b574
173 changed files with 960 additions and 1526 deletions

View File

@@ -1,5 +1,5 @@
package TestingSystem.DVM.DVMPackage;
import Common_old.Constants;
import Common.CommonConstants;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -38,7 +38,7 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
Compiler compiler,
Vector<DVMConfiguration> configurations,
int neeedsEmail_in) {
id = Constants.Nan;
id = CommonConstants.Nan;
//-
sender_name = account.name;
sender_address = account.email;

View File

@@ -1,5 +1,5 @@
package TestingSystem.DVM.DVMTasks;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Test.Test;
import TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
@@ -36,9 +36,9 @@ public class DVMCompilationTask extends DVMTask {
public static String checkEnvironments(String environmentsSet_in) {
if (!environmentsSet_in.contains("DVMH_NO_DIRECT_COPY")) {
if (environmentsSet_in.isEmpty())
return "DVMH_NO_DIRECT_COPY=" + Utils.DQuotes("1");
return "DVMH_NO_DIRECT_COPY=" + CommonUtils.DQuotes("1");
else
return environmentsSet_in + " " + "DVMH_NO_DIRECT_COPY=" + Utils.DQuotes("1");
return environmentsSet_in + " " + "DVMH_NO_DIRECT_COPY=" + CommonUtils.DQuotes("1");
} else
return environmentsSet_in;
}

View File

@@ -1,4 +1,5 @@
package TestingSystem.DVM.DVMTasks;
import Common.CommonConstants;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -16,7 +17,7 @@ import java.nio.file.Paths;
import java.util.Vector;
public class DVMRunTask extends DVMTask {
@Expose
public int dvmcompilationtask_id = Constants.Nan;
public int dvmcompilationtask_id = CommonConstants.Nan;
@Expose
public String matrix = "";
@Expose

View File

@@ -1,4 +1,5 @@
package TestingSystem.DVM.DVMTasks;
import Common.CommonConstants;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.iDBObject;
@@ -17,13 +18,13 @@ import java.nio.file.Paths;
import java.util.Vector;
public class DVMTask extends iDBObject {
@Expose
public int dvm_package_id = Constants.Nan;
public int dvm_package_id = CommonConstants.Nan;
@Expose
public int group_id = Constants.Nan;
public int group_id = CommonConstants.Nan;
@Expose
public String group_description = "";
@Expose
public int test_id = Constants.Nan;
public int test_id = CommonConstants.Nan;
@Expose
public String test_description = "";
@Expose
@@ -85,7 +86,7 @@ public class DVMTask extends iDBObject {
}
public String getResultFile(File resultFile) {
String res = "";
if (dvm_package_id == Constants.Nan) res = "задача ещё не выполнялась";
if (dvm_package_id == CommonConstants.Nan) res = "задача ещё не выполнялась";
else {
if (resultFile.exists()) {
try {

View File

@@ -1,4 +1,5 @@
package TestingSystem.DVM;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Tasks.TaskState;
@@ -61,12 +62,12 @@ public abstract class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
int i = 1;
for (ProjectFile program : language_programs) {
//--
String object = Utils.DQuotes(language + "_" + i + ".o");
String object = CommonUtils.DQuotes(language + "_" + i + ".o");
module_objects.add(object);
module_body += object + ":\n" + "\t" + String.join(" ", Utils.MFVar(LANG_ + "COMMAND"), Utils.MFVar(LANG_ + "FLAGS"), program.getStyleOptions(), "-c", program.getQSourceName(), "-o", object + "\n\n");
++i;
}
titles.add(String.join("\n", LANG_ + "COMMAND=" + Utils.DQuotes(dvm_drv) + " " + language.getDVMCompile(), LANG_ + "FLAGS=" + flags, LANG_ + "OBJECTS=" + String.join(" ", module_objects), ""));
titles.add(String.join("\n", LANG_ + "COMMAND=" + CommonUtils.DQuotes(dvm_drv) + " " + language.getDVMCompile(), LANG_ + "FLAGS=" + flags, LANG_ + "OBJECTS=" + String.join(" ", module_objects), ""));
objects.add(Utils.MFVar(LANG_ + "OBJECTS"));
bodies.add(module_body);
}
@@ -77,13 +78,13 @@ public abstract class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
Vector<String> titles = new Vector<>();
Vector<String> objects = new Vector<>();
Vector<String> bodies = new Vector<>();
String binary = Utils.DQuotes("0");
String binary = CommonUtils.DQuotes("0");
//----->>
for (LanguageName languageName : programs.keySet()) {
generateForLanguage(dvm_drv, languageName, programs.get(languageName), titles, objects, bodies, flags);
}
//----->>
return String.join("\n", "LINK_COMMAND=" + Utils.DQuotes(dvm_drv) + " " + test_language.getDVMLink(), "LINK_FLAGS=" + flags + "\n", String.join("\n", titles), "all: " + binary, binary + " : " + String.join(" ", objects), "\t" + Utils.MFVar("LINK_COMMAND") + " " + Utils.MFVar("LINK_FLAGS") + " " + String.join(" ", objects) + " -o " + binary, String.join(" ", bodies));
return String.join("\n", "LINK_COMMAND=" + CommonUtils.DQuotes(dvm_drv) + " " + test_language.getDVMLink(), "LINK_FLAGS=" + flags + "\n", String.join("\n", titles), "all: " + binary, binary + " : " + String.join(" ", objects), "\t" + Utils.MFVar("LINK_COMMAND") + " " + Utils.MFVar("LINK_FLAGS") + " " + String.join(" ", objects) + " -o " + binary, String.join(" ", bodies));
}
public void getTasksInfo(List<? extends DVMTask> tasks, String file_name) throws Exception {
LinkedHashMap<Integer, DVMTask> sorted_tasks = new LinkedHashMap<>();
@@ -137,16 +138,16 @@ public abstract class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
public void perform() throws Exception {
Print("Проверка сервера...");
String currentServerName = (String) ServerCommand(ServerCode.GetServerName);
Print("имя текущего сервера " + Utils.Brackets(currentServerName));
Print("имя сервера, создавшего нить " + Utils.Brackets(serverName));
Print("имя текущего сервера " + CommonUtils.Brackets(currentServerName));
Print("имя сервера, создавшего нить " + CommonUtils.Brackets(serverName));
if (!serverName.equals(currentServerName)) {
Finalize("Несоответствующий сервер");
}
Print("Запрос активных пакетов для машины " + Utils.Brackets(machine.getURL()));
Print("Запрос активных пакетов для машины " + CommonUtils.Brackets(machine.getURL()));
testingPackage = null;
Vector<DVMPackage> activePackages = (Vector<DVMPackage>) ServerCommand(getActivePackagesCode(), machine.getURL(), null);
if (activePackages.isEmpty())
Finalize("Не найдено активных пакетов для машины " + Utils.Brackets(machine.getURL()));
Finalize("Не найдено активных пакетов для машины " + CommonUtils.Brackets(machine.getURL()));
for (DVMPackage activePackage : activePackages)
PerformPackage(activePackage);
}

View File

@@ -1,4 +1,5 @@
package TestingSystem.DVM;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
@@ -171,11 +172,11 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
@Override
protected void PackageStart() throws Exception {
String plannerStartCommand = String.join(" ",
Utils.DQuotes(getPlanner()),
Utils.DQuotes(user.workspace),
Utils.DQuotes(packageRemoteWorkspace.full_name),
Utils.DQuotes(testingPackage.kernels),
Utils.DQuotes(testingPackage.drv));
CommonUtils.DQuotes(getPlanner()),
CommonUtils.DQuotes(user.workspace),
CommonUtils.DQuotes(packageRemoteWorkspace.full_name),
CommonUtils.DQuotes(testingPackage.kernels),
CommonUtils.DQuotes(testingPackage.drv));
user.connection.startShellProcess(packageRemoteWorkspace, "planner_output",
"ulimit -s unlimited", plannerStartCommand);
//---
@@ -186,7 +187,7 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
}
testingPackage.PID = user.connection.readFromFile(PID).replace("\n", "").replace("\r", "");
//---
System.out.println("PID=" + Utils.Brackets(testingPackage.PID));
System.out.println("PID=" + CommonUtils.Brackets(testingPackage.PID));
RemoteFile STARTED = new RemoteFile(packageRemoteWorkspace, "STARTED");
while (!user.connection.Exists(STARTED)) {
Print("waiting for package start...");
@@ -233,7 +234,7 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
Utils.CheckDirectory(packageLocalWorkspace);
RemoteFile remote_results_archive = new RemoteFile(packageRemoteWorkspace, "results.zip");
File results_archive = new File(packageLocalWorkspace, "results.zip");
user.connection.performScript(packageRemoteWorkspace, "zip -r " + Utils.DQuotes("results.zip") + " " + Utils.DQuotes("results"));
user.connection.performScript(packageRemoteWorkspace, "zip -r " + CommonUtils.DQuotes("results.zip") + " " + CommonUtils.DQuotes("results"));
//---
if (user.connection.Exists(remote_results_archive)) {
user.connection.getSingleFile(remote_results_archive.full_name, results_archive.getAbsolutePath());

View File

@@ -1,4 +1,6 @@
package TestingSystem.DVM;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
@@ -118,7 +120,7 @@ public class UserConnection {
if ((maxSize == 0) || getFileKBSize(src.full_name) <= maxSize) {
getSingleFile(src.full_name, dst.getAbsolutePath());
} else {
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + Utils.Brackets(src.full_name));
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + CommonUtils.Brackets(src.full_name));
}
}
public void putSingleFile(File src, RemoteFile dst) throws Exception {
@@ -131,8 +133,8 @@ public class UserConnection {
//-
public void RMDIR(String dir) throws Exception {
if (!dir.isEmpty() && !dir.equals("/") && !dir.equals("\\") && !dir.equals("*")) {
Command("rm -rf " + Utils.DQuotes(dir));
} else throw new PassException("Недопустимый путь для удаления папки " + Utils.DQuotes(dir));
Command("rm -rf " + CommonUtils.DQuotes(dir));
} else throw new PassException("Недопустимый путь для удаления папки " + CommonUtils.DQuotes(dir));
}
//-
public void SynchronizeSubDirsR(File local_dir, RemoteFile remote_dir) throws Exception {
@@ -220,9 +222,9 @@ public class UserConnection {
sftpChannel.rm(file.full_name);
}
//--
writeToFile("cd " + Utils.DQuotes(directory.full_name) + "\n" + String.join("\n", commands), script_file);
writeToFile("cd " + CommonUtils.DQuotes(directory.full_name) + "\n" + String.join("\n", commands), script_file);
//--
Command(Utils.DQuotes(script_file.full_name) + " 1>" + Utils.DQuotes(out.full_name) + " 2>" + Utils.DQuotes(err.full_name));
Command(CommonUtils.DQuotes(script_file.full_name) + " 1>" + CommonUtils.DQuotes(out.full_name) + " 2>" + CommonUtils.DQuotes(err.full_name));
return new Pair<>(out, err);
}
public void putResource(RemoteFile dstDirectory, String resource_name) throws Exception {
@@ -232,7 +234,7 @@ public class UserConnection {
}
boolean compileModule(RemoteFile modulesDirectory, String module_name) throws Exception {
String flags = module_name.equals("planner") ? getAvailibleCPPStandard(modulesDirectory) : "";
String command = "g++ -O3 " + flags + " " + Utils.DQuotes(module_name + ".cpp") + " -o " + Utils.DQuotes(module_name);
String command = "g++ -O3 " + flags + " " + CommonUtils.DQuotes(module_name + ".cpp") + " -o " + CommonUtils.DQuotes(module_name);
RemoteFile binary = new RemoteFile(modulesDirectory, module_name);
//--
if (Exists(binary))
@@ -302,7 +304,7 @@ public class UserConnection {
getSingleFile(src.full_name, dst.getAbsolutePath());
return true;
} else {
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + Utils.Brackets(src.full_name));
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + CommonUtils.Brackets(src.full_name));
}
}
return false;
@@ -379,7 +381,7 @@ public class UserConnection {
BufferedReader in = new BufferedReader(new InputStreamReader(execChannel.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(Utils.Brackets(line));
System.out.println(CommonUtils.Brackets(line));
}
}
execChannel.disconnect();
@@ -466,10 +468,10 @@ public class UserConnection {
}
public String startShellProcess(RemoteFile directory, String outFileName, String... commands) throws Exception {
Vector<String> commands_ = new Vector<>();
commands_.add("cd " + Utils.DQuotes(directory.full_name));
commands_.add("cd " + CommonUtils.DQuotes(directory.full_name));
for (int i = 0; i < commands.length; ++i) {
if (i == commands.length - 1) {
commands_.add(commands[i] + " 1>" + Utils.DQuotes(outFileName));
commands_.add(commands[i] + " 1>" + CommonUtils.DQuotes(outFileName));
} else {
commands_.add(commands[i]);
}
@@ -478,7 +480,7 @@ public class UserConnection {
if (Exists(script_file))
sftpChannel.rm(script_file.full_name);
writeToFile(String.join("\n", commands_), script_file);
String start_command = Utils.DQuotes(script_file.full_name);
String start_command = CommonUtils.DQuotes(script_file.full_name);
//--
RemoteFile outFile = new RemoteFile(directory, outFileName);
if (Exists(outFile))
@@ -522,7 +524,7 @@ public class UserConnection {
public String CheckModulesVersion() throws Exception {
RemoteFile modulesDirectory = new RemoteFile(user.workspace, "modules");
RemoteFile version = new RemoteFile(modulesDirectory, "version.h");
int current_version = Constants.Nan;
int current_version = CommonConstants.Nan;
int actual_version = Constants.planner_version;
if (Exists(version)) {
try {