Compare commits
11 Commits
1f8ebdc9a2
...
15a179d8e9
| Author | SHA1 | Date | |
|---|---|---|---|
| 15a179d8e9 | |||
| a6a29e913a | |||
| f6bf044060 | |||
| c1d3d9208e | |||
| c21c7c2e10 | |||
| 5f076f14f4 | |||
| 11fae0bc4e | |||
| 3f9ba0feb3 | |||
| 7b28d1a84d | |||
| c37f3d9e70 | |||
| 163552d74f |
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
@@ -8,14 +8,7 @@
|
||||
<component name="ChangeListManager">
|
||||
<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/GlobalData/Tasks/TaskState.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GlobalData/Tasks/TaskState.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/TestingSystem/DVM/TestsSupervisor_2022.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/TestsSupervisor_2022.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/RemoteInitialiseUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/RemoteInitialiseUser.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/files/Planner/Planner.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/files/Planner/Planner.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/files/Planner/RunTask.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/files/Planner/RunTask.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/files/Planner/Supervisor.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/files/Planner/Supervisor.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/files/Planner/Task.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/files/Planner/Task.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"InstructionPath": "",
|
||||
"PerformanceAnalyzerPath": "",
|
||||
"ComponentsBackUpsCount": 10,
|
||||
"TestingKernels": 16,
|
||||
"TestingKernels": 28,
|
||||
"AutoCheckTesting": false,
|
||||
"CheckTestingIntervalSeconds": 10,
|
||||
"EmailOnTestingProgress": true
|
||||
|
||||
@@ -3,6 +3,6 @@ import Common.UI.Menus_2023.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class TasksPackagesMenuBar extends DataMenuBar {
|
||||
public TasksPackagesMenuBar() {
|
||||
super("пакеты задач", PassCode_2021.AbortTaskPackage);
|
||||
super("пакеты задач", PassCode_2021.AbortTaskPackage, PassCode_2021.DeleteTasksPackage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public class TestRunTasksMenuBar extends DataMenuBar {
|
||||
filters= addMenus(cFilterMenu, rFilterMenu);
|
||||
}
|
||||
public TestRunTasksMenuBar() {
|
||||
super("задачи", PassCode_2021.DownloadTaskTest);
|
||||
super("задачи",
|
||||
PassCode_2021.DownloadTaskTest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,8 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
public PassCode_2021 getSynchronizePassCode() {
|
||||
return null;
|
||||
}
|
||||
public void SaveCredentials() throws Exception {
|
||||
public void SaveCredentials(){
|
||||
try {
|
||||
Credentials credentials = (Credentials) Current.get(Current.Credentials);
|
||||
if (Current.HasMachine())
|
||||
credentials.machine_id = Current.getMachine().id;
|
||||
@@ -122,6 +123,10 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
credentials.runconfiguration_id = Current.getRunConfiguration().id;
|
||||
Update(credentials);
|
||||
}
|
||||
catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void UpdateCredentials() {
|
||||
try {
|
||||
Global.db.Update((DBObject) Current.get(Current.Credentials));
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RemoteCompilationSupervisor extends RemoteTaskSupervisor<Compilatio
|
||||
}
|
||||
@Override
|
||||
protected void ValidateTaskResults() throws Exception {
|
||||
if (pass.Exists(getRemoteProject().full_name, getBinary().name)) {
|
||||
if (pass.Exists(getBinary())) {
|
||||
RemoteFile renamed_binary = new RemoteFile(getRemoteProject().full_name, Utils.getDateName("spf_" + getBinary().name));
|
||||
pass.sftpChannel.rename(getBinary().full_name, renamed_binary.full_name);
|
||||
task.binary_name = renamed_binary.name;
|
||||
|
||||
@@ -42,15 +42,17 @@ public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSuperviso
|
||||
}
|
||||
@Override
|
||||
protected void CheckTask() throws Exception {
|
||||
if (pass.Exists(getRemoteProject().full_name, Constants.DONE))
|
||||
RemoteFile DONE = new RemoteFile(getRemoteProject(), Constants.DONE);
|
||||
RemoteFile TIMEOUT = new RemoteFile(getRemoteProject(), Constants.TIMEOUT);
|
||||
if (pass.Exists(DONE))
|
||||
task.state = TaskState.Finished;
|
||||
else if (pass.Exists(getRemoteProject().full_name, Constants.TIMEOUT))
|
||||
else if (pass.Exists(TIMEOUT))
|
||||
task.state = TaskState.AbortedByTimeout;
|
||||
}
|
||||
@Override
|
||||
protected void AchieveResults() throws Exception {
|
||||
pass.tryGetSingleFile(getRemoteOutput(), task.getOutputFile(), 10240);
|
||||
pass.tryGetSingleFile(getRemoteErrors(), task.getErrorsFile(), 10240);
|
||||
pass.tryGetSingleFileWithMaxSize(getRemoteOutput(), task.getOutputFile(), 10240);
|
||||
pass.tryGetSingleFileWithMaxSize(getRemoteErrors(), task.getErrorsFile(), 10240);
|
||||
}
|
||||
@Override
|
||||
protected void AbortTask() throws Exception {
|
||||
@@ -58,7 +60,7 @@ public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSuperviso
|
||||
}
|
||||
@Override
|
||||
protected void CalculatePerformanceTime() throws Exception {
|
||||
if (pass.tryGetSingleFile(getRemoteTime(), task.getTimeFile(), 0))
|
||||
if (pass.tryGetSingleFileWithMaxSize(getRemoteTime(), task.getTimeFile(), 0))
|
||||
task.RefreshTime();
|
||||
}
|
||||
protected String getStartCommand() {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ServerRunSupervisor extends RemoteTaskSupervisor<RunTask> {
|
||||
}
|
||||
if (!task.last_sts_name.isEmpty()) {
|
||||
RemoteFile remote_sts = new RemoteFile(getRemoteProject().full_name, task.last_sts_name);
|
||||
task.hasDvmSts = pass.tryGetSingleFile(remote_sts, task.getLocalStsFile(), 10240);
|
||||
task.hasDvmSts = pass.tryGetSingleFileWithMaxSize(remote_sts, task.getLocalStsFile(), 10240);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,13 @@ import GlobalData.User.User;
|
||||
import Repository.EmailMessage;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.DVM.UserConnection;
|
||||
import TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
|
||||
import TestingSystem.SAPFOR.SapforTasksPackageSupervisor.SapforTasksPackageSupervisor;
|
||||
import TestingSystem.DVM.Tasks.TestCompilationTask;
|
||||
import TestingSystem.DVM.Tasks.TestTask;
|
||||
import TestingSystem.DVM.TasksPackage.TasksPackage;
|
||||
import TestingSystem.DVM.TasksPackage.TasksPackageState;
|
||||
import TestingSystem.DVM.TestsSupervisor_2022;
|
||||
import TestingSystem.DVM.UserConnection;
|
||||
import TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
|
||||
import TestingSystem.SAPFOR.SapforTasksPackageSupervisor.SapforTasksPackageSupervisor;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
|
||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||
@@ -39,10 +38,6 @@ public class TestingPlanner {
|
||||
//----------
|
||||
SapforTasksPackage sapforTasksPackage = null;
|
||||
//----------
|
||||
public void UpdateTask(TestTask task_in) throws Exception {
|
||||
task_in.ChangeDate = new Date().getTime();
|
||||
ServerCommand(ServerCode.EditAccountObject, task_in);
|
||||
}
|
||||
public void UpdatePackage() throws Exception {
|
||||
tasksPackage.ChangeDate = new Date().getTime();
|
||||
ServerCommand(ServerCode.EditAccountObject, tasksPackage);
|
||||
@@ -177,8 +172,10 @@ public class TestingPlanner {
|
||||
supervisor = new TestsSupervisor_2022(this, user.connection, tasksPackage, new Vector<>(packageTasks.values()));
|
||||
supervisor.Perform();
|
||||
} catch (Exception ex) {
|
||||
Print("Ошибка сеанса, соединение будет разорвано.");
|
||||
Print("Ошибка сеанса.");
|
||||
Print(ex.getMessage());
|
||||
}
|
||||
finally {
|
||||
if (user.connection != null) {
|
||||
user.connection.Disconnect();
|
||||
user.connection = null;
|
||||
|
||||
@@ -4,8 +4,12 @@ import Common.UI.StatusEnum;
|
||||
import Common.UI.Themes.VisualiserFonts;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
public enum TasksPackageState implements StatusEnum {
|
||||
Queued,
|
||||
//--
|
||||
TestsSynchronize, //оставить.
|
||||
PackageWorkspaceCreation,
|
||||
PackageStart,
|
||||
@@ -19,7 +23,6 @@ public enum TasksPackageState implements StatusEnum {
|
||||
RunningExecution,
|
||||
//--
|
||||
RunningEnd, //скачка архива
|
||||
Cleaning, //todo удаление папки пакета на удаленной машине. пока отладки ради не делать.
|
||||
//---------------------------------------
|
||||
Analysis,
|
||||
Done,
|
||||
@@ -77,12 +80,15 @@ public enum TasksPackageState implements StatusEnum {
|
||||
return "загрузка результатов";
|
||||
case Analysis:
|
||||
return "анализ результатов";
|
||||
case Cleaning:
|
||||
return "очистка";
|
||||
case Done:
|
||||
return "завершен";
|
||||
default:
|
||||
return StatusEnum.super.getDescription();
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<TasksPackageState> getHigherStates(){
|
||||
return Arrays.stream(values()).filter(state -> state.ordinal() > this.ordinal()).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,17 +13,13 @@ import TestingSystem.DVM.Tasks.TestTask;
|
||||
import TestingSystem.DVM.TasksPackage.TasksPackage;
|
||||
import TestingSystem.DVM.TasksPackage.TasksPackageState;
|
||||
import Visual_DVM_2021.Passes.All.UnzipFolderPass;
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.*;
|
||||
public class TestsSupervisor_2022 {
|
||||
protected TestingPlanner planner; //планировщик.
|
||||
protected UserConnection connection;
|
||||
@@ -140,60 +136,88 @@ public class TestsSupervisor_2022 {
|
||||
);
|
||||
connection.ShellCommand(plannerStartCommand);
|
||||
RemoteFile PID = new RemoteFile(packageRemoteWorkspace, "PID");
|
||||
while (!connection.Exists(packageRemoteWorkspace.full_name, "STARTED")) {
|
||||
RemoteFile STARTED = new RemoteFile(packageRemoteWorkspace, "STARTED");
|
||||
while (!connection.Exists(STARTED)) {
|
||||
System.out.println("waiting for package start...");
|
||||
Utils.sleep(1000);
|
||||
}
|
||||
if (connection.Exists(packageRemoteWorkspace.full_name, "PID")) {
|
||||
if (connection.Exists(PID)) {
|
||||
tasksPackage.pid = connection.readFromFile(PID);
|
||||
}
|
||||
}
|
||||
public void checkNextState() throws Exception {
|
||||
TasksPackageState oldState = tasksPackage.state;
|
||||
Vector<ChannelSftp.LsEntry> files_ = connection.sftpChannel.ls(packageRemoteWorkspace.full_name + "/state");
|
||||
Vector<ChannelSftp.LsEntry> files = new Vector<>();
|
||||
for (ChannelSftp.LsEntry file : files_) {
|
||||
try {
|
||||
TasksPackageState.valueOf(file.getFilename());
|
||||
files.add(file);
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
files.sort(Comparator.comparingInt(o -> o.getAttrs().getMTime()));
|
||||
if (!files.isEmpty()) {
|
||||
String fileName = files.get(files.size() - 1).getFilename();
|
||||
System.out.println(fileName + " last file");
|
||||
tasksPackage.state = TasksPackageState.valueOf(files.get(files.size() - 1).getFilename());
|
||||
if (tasksPackage.state != oldState)
|
||||
RemoteFile stateDir = new RemoteFile(packageRemoteWorkspace, "state");
|
||||
//состояния пакета могут меняться только по возрастанию. ищем, появилось ли такое.
|
||||
Vector<TasksPackageState> higherStates = tasksPackage.state.getHigherStates();
|
||||
Collections.reverse(higherStates); //берем в обратном порядке, чтобы быстрее найти высшее.
|
||||
for (TasksPackageState state : higherStates) {
|
||||
RemoteFile file = new RemoteFile(stateDir, state.toString());
|
||||
if (connection.Exists(file)) {
|
||||
System.out.println("found new state: " + file.name);
|
||||
tasksPackage.state = state;
|
||||
planner.UpdatePackage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DownloadResults() throws Exception {
|
||||
Utils.CheckDirectory(packageLocalWorkspace);
|
||||
RemoteFile remote_results_archive = new RemoteFile(packageRemoteWorkspace.full_name, "results.zip");
|
||||
RemoteFile remote_results = new RemoteFile(packageRemoteWorkspace, "results");
|
||||
RemoteFile remote_results_archive = new RemoteFile(packageRemoteWorkspace, "results.zip");
|
||||
File results_archive = new File(packageLocalWorkspace, "results.zip");
|
||||
if (connection.Exists(packageRemoteWorkspace.full_name, "results.zip")) {
|
||||
connection.getSingleFile(remote_results_archive, results_archive, 0);
|
||||
connection.performScript(packageRemoteWorkspace, "zip -r " + Utils.DQuotes("results.zip") + " " + Utils.DQuotes("results"));
|
||||
//---
|
||||
if (connection.Exists(remote_results_archive)) {
|
||||
connection.getSingleFile(remote_results_archive.full_name, results_archive.getAbsolutePath());
|
||||
UnzipFolderPass unzipFolderPass = new UnzipFolderPass();
|
||||
unzipFolderPass.Do(results_archive.getAbsolutePath(), packageLocalWorkspace.getAbsolutePath(), false);
|
||||
}
|
||||
}
|
||||
public void getTasksInfo(Vector<? extends TestTask> tasks, String file_name) throws Exception {
|
||||
LinkedHashMap<Long, TestTask> sorted_tasks = new LinkedHashMap<>();
|
||||
for (TestTask task : tasks)
|
||||
sorted_tasks.put(task.id, task);
|
||||
//--
|
||||
File info_file = Paths.get(packageLocalWorkspace.getAbsolutePath(), "results", file_name).toFile();
|
||||
List<String> lines = FileUtils.readLines(info_file, Charset.defaultCharset());
|
||||
for (String packed : lines) {
|
||||
if (!packed.isEmpty()) {
|
||||
String[] data = packed.split(" ");
|
||||
long id = Long.parseLong(data[0]);
|
||||
TaskState state = TaskState.valueOf(data[1]);
|
||||
double time = Double.parseDouble(data[2]);
|
||||
//--
|
||||
TestTask task = sorted_tasks.get(id);
|
||||
task.state = state;
|
||||
task.Time = time;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void AnalyseResults() throws Exception {
|
||||
System.out.println("analysing results");
|
||||
Vector<TestRunTask> runTasks = new Vector<>();
|
||||
for (TestCompilationTask compilationTask : compilationTasks)
|
||||
runTasks.addAll(compilationTask.runTasks);
|
||||
//----
|
||||
getTasksInfo(compilationTasks, "CompilationInfo.txt");
|
||||
getTasksInfo(runTasks, "RunningInfo.txt");
|
||||
//--
|
||||
int ct_count = 0;
|
||||
int rt_count = 0;
|
||||
//--
|
||||
for (TestCompilationTask testCompilationTask : compilationTasks) {
|
||||
ct_count++;
|
||||
if (CheckTask(testCompilationTask)) {
|
||||
if (readTask(testCompilationTask)) {
|
||||
for (TestRunTask testRunTask : testCompilationTask.runTasks) {
|
||||
rt_count++;
|
||||
testRunTask.compilation_state = testCompilationTask.state;
|
||||
testRunTask.compilation_output = testCompilationTask.output;
|
||||
testRunTask.compilation_errors = testCompilationTask.errors;
|
||||
testRunTask.compilation_time = testCompilationTask.Time;
|
||||
if (testCompilationTask.state == TaskState.DoneWithErrors) {
|
||||
testRunTask.state = TaskState.Canceled;
|
||||
} else {
|
||||
CheckTask(testRunTask);
|
||||
readTask(testRunTask);
|
||||
}
|
||||
if (testRunTask.state.equals(TaskState.Finished)) {
|
||||
//анализ задачи на запуск.
|
||||
@@ -226,29 +250,21 @@ public class TestsSupervisor_2022 {
|
||||
//теперь обновить их единым списком, и удалить задачи на компиляцию.
|
||||
planner.ServerCommand(ServerCode.UpdateTestTasks, compilationTasks);
|
||||
}
|
||||
public boolean CheckTask(TestTask testTask) throws Exception {
|
||||
public boolean readTask(TestTask testTask) throws Exception {
|
||||
File taskWorkspace = Paths.get(packageLocalWorkspace.getAbsolutePath(), "results", String.valueOf(testTask.id)).toFile();
|
||||
if (taskWorkspace.exists()) {
|
||||
System.out.println("id=" + testTask.id + ": path=" + taskWorkspace.getAbsolutePath());
|
||||
File stateFile = new File(taskWorkspace, "TaskState");
|
||||
File outFile = new File(taskWorkspace, Constants.out_file);
|
||||
File errFile = new File(taskWorkspace.getAbsolutePath(), Constants.err_file);
|
||||
File timeFile = new File(taskWorkspace.getAbsolutePath(), Constants.time_file);
|
||||
File stsFile = new File(taskWorkspace.getAbsolutePath(), "statistic.txt");
|
||||
if (outFile.exists())
|
||||
testTask.output = FileUtils.readFileToString(outFile);
|
||||
if (errFile.exists())
|
||||
testTask.errors = FileUtils.readFileToString(errFile);
|
||||
if (timeFile.exists())
|
||||
testTask.Time = Double.parseDouble(Utils.ReadAllText(timeFile));
|
||||
if ((testTask instanceof TestRunTask) && stsFile.exists()) {
|
||||
TestRunTask testRunTask = (TestRunTask) testTask;
|
||||
testRunTask.statistic = FileUtils.readFileToString(stsFile);
|
||||
}
|
||||
if (stateFile.exists()) {
|
||||
String stateText = FileUtils.readFileToString(stateFile, Charset.defaultCharset()).replace("\n", "");
|
||||
testTask.state = TaskState.valueOf(stateText);
|
||||
} else testTask.state = TaskState.InternalError; //поменять на то что состояние не найдено. ?
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -7,10 +7,8 @@ import GlobalData.Machine.Machine;
|
||||
import GlobalData.RemoteFile.RemoteFile;
|
||||
import GlobalData.User.User;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import com.jcraft.jsch.ChannelShell;
|
||||
import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.Session;
|
||||
import com.jcraft.jsch.*;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -108,33 +106,16 @@ public class UserConnection {
|
||||
System.gc();
|
||||
}
|
||||
//--
|
||||
|
||||
//из за мусора результатом пользоваться в общем случае невозможно.
|
||||
//todo из за мусора результатом пользоваться в общем случае невозможно.
|
||||
//следует перенаправлять вывод в какой нибудь временный файл на сервере.
|
||||
public String ShellCommand(String command) throws Exception {
|
||||
StringBuilder result = new StringBuilder();
|
||||
// System.out.println("command=" + Utils.Brackets(command));
|
||||
pin.write((command + "\r\n").getBytes());
|
||||
ShellParser.ReadInvitation(fromServer); //первое приглашение после эхо. возможен мусор.
|
||||
result.append(ShellParser.getCommandResult(fromServer)); //возможный результат и второе приглашение.
|
||||
// System.out.println("answer=" + Utils.Brackets(result));
|
||||
//в реалиях визуалиазтора нас интересует только ПОСЛЕДНЯЯ СТРОКА ОТВЕТА.
|
||||
String[] data = result.toString().split("\n");
|
||||
// System.out.println("res="+Utils.Brackets(res));
|
||||
return (data.length > 0) ? data[data.length - 1] : result.toString();
|
||||
}
|
||||
//--
|
||||
//тут имя файла короткое.
|
||||
public boolean Exists(String folder, String name) throws Exception {
|
||||
Vector<ChannelSftp.LsEntry> files = sftpChannel.ls(folder);
|
||||
for (ChannelSftp.LsEntry file : files) {
|
||||
file.getAttrs().getSize();
|
||||
if (file.getFilename().equals(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
public void getSingleFile(String src, String dst) throws Exception {
|
||||
sftpChannel.get(src, dst);
|
||||
}
|
||||
@@ -142,23 +123,19 @@ public class UserConnection {
|
||||
long size = sftpChannel.lstat(path).getSize();
|
||||
return size / 1024;
|
||||
}
|
||||
public boolean getSingleFile(RemoteFile src, File dst, int maxSize) throws Exception {
|
||||
if (Exists(src.parent, src.name)) {
|
||||
public void getSingleFileWithMaxSize(RemoteFile src, File dst, int maxSize) throws Exception {
|
||||
if ((maxSize == 0) || getFileKBSize(src.full_name) <= maxSize) {
|
||||
getSingleFile(src.full_name, dst.getAbsolutePath());
|
||||
return true;
|
||||
} else {
|
||||
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + Utils.Brackets(src.full_name));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void putSingleFile(File src, RemoteFile dst) throws Exception {
|
||||
sftpChannel.put(src.getAbsolutePath(), dst.full_name);
|
||||
}
|
||||
//-
|
||||
public void MKDIR(RemoteFile dir) throws Exception {
|
||||
if (!Exists(dir.parent, dir.name)) sftpChannel.mkdir(dir.full_name);
|
||||
if (!Exists(dir)) sftpChannel.mkdir(dir.full_name);
|
||||
}
|
||||
//-
|
||||
public void RMDIR(String dir) throws Exception {
|
||||
@@ -210,12 +187,6 @@ public class UserConnection {
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
public void copy(RemoteFile src, RemoteFile dst) throws Exception {
|
||||
ShellCommand("cp " + Utils.DQuotes(src.full_name) + " " + Utils.DQuotes(dst.full_name));
|
||||
}
|
||||
*/
|
||||
//-------
|
||||
public void writeToFile(String text, RemoteFile dst) throws Exception {
|
||||
sftpChannel.put(new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)), dst.full_name);
|
||||
sftpChannel.chmod(0777, dst.full_name);
|
||||
@@ -225,4 +196,42 @@ public class UserConnection {
|
||||
sftpChannel.get(src.full_name, outputStream);
|
||||
return outputStream.toString(StandardCharsets.UTF_8.name());
|
||||
}
|
||||
//--
|
||||
public boolean Exists(String file_full_name) throws Exception {
|
||||
try {
|
||||
sftpChannel.lstat(file_full_name);
|
||||
return true;
|
||||
} catch (SftpException e) {
|
||||
if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
|
||||
// file doesn't exist
|
||||
return false;
|
||||
} else {
|
||||
// something else went wrong
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean Exists(RemoteFile file) throws Exception {
|
||||
return Exists(file.full_name);
|
||||
}
|
||||
//--
|
||||
public Pair<RemoteFile, RemoteFile> performScript(RemoteFile directory, String... commands) throws Exception {
|
||||
RemoteFile script_file = new RemoteFile(directory, Constants.script);
|
||||
RemoteFile out = new RemoteFile(directory, Constants.out_file);
|
||||
RemoteFile err = new RemoteFile(directory, Constants.err_file);
|
||||
//
|
||||
Vector<RemoteFile> files = new Vector<>();
|
||||
files.add(script_file);
|
||||
files.add(out);
|
||||
files.add(err);
|
||||
for (RemoteFile file : files) {
|
||||
if (Exists(file))
|
||||
sftpChannel.rm(file.full_name);
|
||||
}
|
||||
//--
|
||||
writeToFile("cd " + Utils.DQuotes(directory.full_name)+"\n"+ String.join("\n", commands), script_file);
|
||||
//--
|
||||
ShellCommand(script_file.full_name + " 1>" + Utils.DQuotes(out.full_name) + " 2>" + Utils.DQuotes(err.full_name));
|
||||
return new Pair<>(out, err);
|
||||
}
|
||||
}
|
||||
|
||||
25
src/Visual_DVM_2021/Passes/All/DeleteTasksPackage.java
Normal file
25
src/Visual_DVM_2021/Passes/All/DeleteTasksPackage.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.UI.UI;
|
||||
import TestingSystem.DVM.TasksPackage.TasksPackage;
|
||||
import TestingSystem.DVM.TasksPackage.TasksPackageState;
|
||||
import Visual_DVM_2021.Passes.Server.DeleteServerAccountObject;
|
||||
public class DeleteTasksPackage extends DeleteServerAccountObject<TasksPackage> {
|
||||
public DeleteTasksPackage() {
|
||||
super(TasksPackage.class);
|
||||
}
|
||||
public boolean checkActivity() {
|
||||
if (!target.state.equals(TasksPackageState.Done) && !target.state.equals(TasksPackageState.Aborted)) {
|
||||
Log.Writeln_("Нельзя удалить активный пакет!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart(args) && checkActivity();
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
UI.getMainWindow().getTestingWindow().DropTestRunTasksComparison();
|
||||
}
|
||||
}
|
||||
@@ -59,11 +59,12 @@ public class InstallServerSapfor extends ConnectionPass<Object> {
|
||||
ShowMessage1("Сборка SAPFOR...");
|
||||
//-
|
||||
RemoteFile repo_bin = new RemoteFile(repoSapforHome.full_name, "Sapfor_F");
|
||||
if (Exists(repoSapforHome.full_name, repo_bin.name))
|
||||
if (Exists(repo_bin))
|
||||
sftpChannel.rm(repo_bin.full_name);
|
||||
//--
|
||||
performScript(repoSapforHome, "cmake ../", "make -j 4");
|
||||
result = Exists(repoSapforHome.full_name, "Sapfor_F");
|
||||
RemoteFile repoSapfor = new RemoteFile(repoSapforHome, "Sapfor_F");
|
||||
result = Exists(repoSapfor);
|
||||
if (result) {
|
||||
RemoteFile sapforsDirectory = new RemoteFile(testingSystemHome.full_name, "Sapfors", true);
|
||||
//создать папку. Для того чтобы скопировать из репозитория.
|
||||
@@ -116,6 +117,5 @@ public class InstallServerSapfor extends ConnectionPass<Object> {
|
||||
protected void performDone() throws Exception {
|
||||
passes.get(PassCode_2021.PublishServerSapfor).Do(serverSapfor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -303,12 +303,15 @@ public enum PassCode_2021 {
|
||||
CreateTestFromFile,
|
||||
CreateTestsFromFiles,
|
||||
CreateGroupFromFiles,
|
||||
DeleteTasksPackage,
|
||||
//->
|
||||
TestPass;
|
||||
public String getDescription() {
|
||||
switch (this) {
|
||||
case Undefined:
|
||||
return "?";
|
||||
case DeleteTasksPackage:
|
||||
return "Удалить пакет задач";
|
||||
case CreateGroupFromFiles:
|
||||
return "Создать группу из файлов в папке";
|
||||
case CreateTestsFromFiles:
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
|
||||
isConnected = true; // теперь можно прерывать метод.
|
||||
if (needsInitialize()) {
|
||||
RemoteFile userWorkspace = new RemoteFile(user.workspace, true);
|
||||
if (!Exists(sftpChannel.getHome(), userWorkspace.name))
|
||||
if (!Exists(userWorkspace))
|
||||
throw new WorkspaceNotFoundException(
|
||||
"Рабочее пространство пользователя " + Utils.Brackets(user.login)
|
||||
+ " на машине " + Utils.Brackets(machine.getURL())
|
||||
@@ -171,8 +171,8 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
|
||||
sftpChannel.get(src, dst);
|
||||
}
|
||||
//с проверкой.
|
||||
public boolean tryGetSingleFile(RemoteFile src, File dst, int maxSize) throws Exception {
|
||||
if (Exists(src.parent, src.name)) {
|
||||
public boolean tryGetSingleFileWithMaxSize(RemoteFile src, File dst, int maxSize) throws Exception {
|
||||
if (Exists(src)) {
|
||||
if ((maxSize == 0) || (getFileKBSize(src.full_name) <= maxSize)) {
|
||||
getSingleFile(src.full_name, dst.getAbsolutePath());
|
||||
return true;
|
||||
@@ -186,19 +186,11 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
|
||||
sftpChannel.put(src.getAbsolutePath(), dst.full_name);
|
||||
}
|
||||
public void tryMKDir(RemoteFile dir) throws Exception {
|
||||
// System.out.print("try mkdir: '" + dir.full_name);
|
||||
if (!Exists(dir.parent, dir.name)) sftpChannel.mkdir(dir.full_name);
|
||||
// System.out.println("..done");
|
||||
if (!Exists(dir)) sftpChannel.mkdir(dir.full_name);
|
||||
}
|
||||
public void tryRM(RemoteFile file) throws Exception {
|
||||
// System.out.print("try remove: '" + file.full_name);
|
||||
if (Exists(file.parent, file.name)) {
|
||||
// System.out.print("' :exists.needs remove..");
|
||||
if (Exists(file))
|
||||
sftpChannel.rm(file.full_name);
|
||||
// System.out.println(" +");
|
||||
} else {
|
||||
// System.out.println("no such file");
|
||||
}
|
||||
}
|
||||
public void putSingleFile(String src, String dst) throws Exception {
|
||||
sftpChannel.put(src, dst);
|
||||
@@ -213,16 +205,6 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
|
||||
}
|
||||
protected void ServerAction() throws Exception {
|
||||
}
|
||||
//тут имя файла короткое.
|
||||
public boolean Exists(String folder, String name) throws Exception {
|
||||
Vector<ChannelSftp.LsEntry> files = sftpChannel.ls(folder);
|
||||
for (ChannelSftp.LsEntry file : files) {
|
||||
if (file.getFilename().equals(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//https://losst.ru/komanda-find-v-linux#%D0%9E%D1%81%D0%BD%D0%BE%D0%B2%D0%BD%D1%8B%D0%B5_%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B_%D0%BA%D0%BE%D0%BC%D0%B0%D0%BD%D0%B4%D1%8B_find
|
||||
public String getStarter() {
|
||||
return String.join("/", user.workspace, modules, starter);
|
||||
@@ -385,7 +367,7 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
|
||||
//скорее всего,временные методы. они есть в UserConnection, при удаленном запуске тестирования
|
||||
//--------------------------------------------------------------------------------
|
||||
public void MKDIR(RemoteFile dir) throws Exception {
|
||||
if (!Exists(dir.parent, dir.name)) sftpChannel.mkdir(dir.full_name);
|
||||
if (!Exists(dir)) sftpChannel.mkdir(dir.full_name);
|
||||
}
|
||||
//--
|
||||
public Pair<RemoteFile, RemoteFile> performScript(RemoteFile directory, String... commands) throws Exception {
|
||||
@@ -398,7 +380,7 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
|
||||
files.add(out);
|
||||
files.add(err);
|
||||
for (RemoteFile file : files) {
|
||||
if (Exists(directory.full_name, file.name))
|
||||
if (Exists(file))
|
||||
sftpChannel.rm(file.full_name);
|
||||
}
|
||||
//--
|
||||
@@ -406,9 +388,27 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
|
||||
//--
|
||||
ShellCommand("cd " + Utils.DQuotes(directory.full_name),
|
||||
script_file.full_name + " 1>" + Constants.out_file + " 2>" + Constants.err_file);
|
||||
|
||||
return new Pair<>(out, err);
|
||||
}
|
||||
//--
|
||||
//--
|
||||
public boolean Exists(String file_full_name) throws Exception {
|
||||
try {
|
||||
sftpChannel.stat(file_full_name);
|
||||
return true;
|
||||
} catch (SftpException e) {
|
||||
if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
|
||||
// file doesn't exist
|
||||
return false;
|
||||
} else {
|
||||
// something else went wrong
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean Exists(RemoteFile file) throws Exception {
|
||||
return Exists(file.full_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,15 +37,6 @@ public class DebugForm implements DebugWindow, FormWithSplitters {
|
||||
return content;
|
||||
}
|
||||
@Override
|
||||
public void SaveSplitters() {
|
||||
FormWithSplitters.super.SaveSplitters();
|
||||
try {
|
||||
Global.db.SaveCredentials();
|
||||
} catch (Exception ex) {
|
||||
Global.Log.PrintException(ex);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void DropRunTasksComparison() {
|
||||
singleRunTaskMaster.RemoveObject();
|
||||
singleRunTaskSlave.RemoveObject();
|
||||
|
||||
@@ -62,6 +62,8 @@ public class MainForm extends Form implements MainWindow {
|
||||
if (UI.debugWindow != null)
|
||||
((FormWithSplitters) UI.debugWindow).SaveSplitters();
|
||||
//--
|
||||
Global.db.SaveCredentials();
|
||||
//--
|
||||
Global.FinishApplication();
|
||||
}
|
||||
public MainForm() {
|
||||
|
||||
@@ -31,8 +31,7 @@ public:
|
||||
File makeFileFile = File(makeFilePath, this->makefile_text);
|
||||
String tests = userWorkspace + "/projects";
|
||||
String testPath = tests + "/" + test_id;
|
||||
String copyCommand = "cp -r " + String::DQuotes(testPath + "/.") + " " + String::DQuotes(workspace);
|
||||
system(copyCommand.getCharArray());
|
||||
Utils::CopyDirectory(testPath, workspace);
|
||||
}
|
||||
virtual String getLaunchScriptText() {
|
||||
String modules = userWorkspace + "/modules";
|
||||
@@ -45,6 +44,7 @@ public:
|
||||
"make -j -f Makefile";
|
||||
}
|
||||
virtual void analyseResults() {
|
||||
Task::analyseResults();
|
||||
String binary = workspace + "/0";
|
||||
state = Utils::Exists(binary) ? Done : DoneWithErrors;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
}
|
||||
File(const String& name, const String& text) {
|
||||
ptr = fopen(name.getCharArray(), "w");
|
||||
fprintf(ptr, "%s\n", text.getCharArray());
|
||||
fprintf(ptr, "%s", text.getCharArray());
|
||||
}
|
||||
~File() {
|
||||
Close();
|
||||
|
||||
@@ -115,7 +115,7 @@ int main(int argc, char ** argv)
|
||||
#endif
|
||||
|
||||
printf("PID=%d\n", pid);
|
||||
File pidFile("PID", String(pid));
|
||||
File pidFile("PID", String(pid)+"\n");
|
||||
pidFile.Close();
|
||||
//---
|
||||
File startFile("STARTED", "+");
|
||||
|
||||
@@ -22,14 +22,4 @@ public:
|
||||
virtual String getStatePrefix() {
|
||||
return String("Running");
|
||||
}
|
||||
|
||||
/*
|
||||
virtual void Finalize(){
|
||||
this->state = Archivation;
|
||||
saveState();
|
||||
printf("Archivation started\n");
|
||||
Utils::ZipFolder(String("./"),String("archive.zip"));
|
||||
printf("Archivation ended\n");
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
@@ -96,8 +96,10 @@ public:
|
||||
virtual String copyResults(const String& pathRes) {
|
||||
String resultPath = Task::copyResults(pathRes);
|
||||
if (Utils::Exists(workspace + "/sts.gz+")) {
|
||||
String dvm_start = String::DQuotes(dvm_drv) + " pa " + String::DQuotes(String(getId()) + "/sts.gz+") + " " + String::DQuotes(resultPath + "/statistic.txt");
|
||||
String stsPath(resultPath + "/statistic.txt");
|
||||
String dvm_start = String::DQuotes(dvm_drv) + " pa " + String::DQuotes(String(getId()) + "/sts.gz+") + " " + String::DQuotes(stsPath);
|
||||
system(dvm_start.getCharArray());
|
||||
while (!Utils::Exists(stsPath));
|
||||
}
|
||||
return resultPath;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ enum SupervisorState {
|
||||
WorkspacesCreation, //0
|
||||
Preparation, //1
|
||||
Execution, //2
|
||||
Archivation, //3
|
||||
End //4
|
||||
End //3
|
||||
};
|
||||
|
||||
template <class T>
|
||||
@@ -32,8 +31,6 @@ public:
|
||||
return String("Preparation");
|
||||
case Execution:
|
||||
return String("Execution");
|
||||
case Archivation:
|
||||
return String("Archivation");
|
||||
case End:
|
||||
return String("End");
|
||||
default:
|
||||
@@ -71,7 +68,6 @@ public:
|
||||
saveState();
|
||||
break;
|
||||
case Execution:
|
||||
Finalize();
|
||||
this->state = End;
|
||||
saveState();
|
||||
break;
|
||||
@@ -126,7 +122,7 @@ public:
|
||||
|
||||
String pathRes("results");
|
||||
Utils::Mkdir(pathRes);
|
||||
//string buf;
|
||||
string buf;
|
||||
|
||||
while (activeTasks) {
|
||||
long oldActiveTasks = activeTasks;
|
||||
@@ -174,7 +170,7 @@ public:
|
||||
busyKernels -= task->getKernels();
|
||||
printf(" done task with %d kernels and id %ld\n", task->getKernels(), task->getId());
|
||||
|
||||
//buf += to_string(task->getId()) + " " + string(task->printState().getCharArray()) + " " + to_string(task->getTotalTime()) + "\n";
|
||||
buf += to_string(task->getId()) + " " + string(task->printState().getCharArray()) + " " + to_string(task->getTotalTime()) + "\n";
|
||||
task->copyResults(pathRes);
|
||||
continue;
|
||||
}
|
||||
@@ -187,18 +183,12 @@ public:
|
||||
|
||||
changeState();
|
||||
|
||||
//String outFile(pathRes + "/info.txt");
|
||||
//File tmp(outFile, String(buf.c_str()));
|
||||
|
||||
Utils::ZipFolder(pathRes, pathRes + ".zip");
|
||||
String outFile(pathRes + "/"+getStatePrefix()+"Info.txt");
|
||||
File tmp(outFile, String(buf.c_str()));
|
||||
}
|
||||
|
||||
virtual void Finalize() { }
|
||||
|
||||
void saveState() {
|
||||
Utils::Sleep(1); //чтобы не было одинаковых по дате файлов.
|
||||
String stateFile = packageWorkspace + "/state/" + getStatePrefix() + printState();
|
||||
//printf("stateFile=<%s>\n", stateFile.getCharArray());
|
||||
File tmp(stateFile, Utils::getDate());
|
||||
}
|
||||
};
|
||||
@@ -173,15 +173,10 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state != Running) {
|
||||
//-
|
||||
busyKernels = Utils::min(busyKernels - kernels, maxKernels);
|
||||
freeKernels = Utils::max(0, maxKernels - busyKernels);
|
||||
//-
|
||||
saveState();
|
||||
}
|
||||
|
||||
return (state != Running);
|
||||
}
|
||||
|
||||
@@ -192,19 +187,11 @@ public:
|
||||
printf("%ld done with time %f\n", id, total_time);
|
||||
state = Finished;
|
||||
}
|
||||
|
||||
virtual void saveState() {
|
||||
String stateFile = workspace + "/TaskState";
|
||||
File tmp(stateFile, printState());
|
||||
}
|
||||
|
||||
virtual String copyResults(const String& pathRes) {
|
||||
String resultPath(packageWorkspace + "/" + pathRes + "/" + getId());
|
||||
Utils::Mkdir(resultPath);
|
||||
Utils::Copy(workspace + "/TaskState", resultPath + "/TaskState");
|
||||
Utils::Copy(workspace + "/out.txt", resultPath + "/out.txt");
|
||||
Utils::Copy(workspace + "/err.txt", resultPath + "/err.txt");
|
||||
Utils::Copy(workspace + "/total_time", resultPath + "/total_time");
|
||||
return resultPath;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,8 +31,13 @@ public:
|
||||
|
||||
//https://stackoverflow.com/questions/4568681/using-chmod-in-a-c-program
|
||||
static void Chmod(const String& path) {
|
||||
#if __cplusplus >= 201703L
|
||||
std::filesystem::permissions(path.getCharArray(), std::filesystem::perms::all);
|
||||
#else
|
||||
String command = "chmod 777 " + String::DQuotes(path);
|
||||
system(command.getCharArray());
|
||||
int i=system(command.getCharArray());
|
||||
printf("chmod 777 '%s' return code = %d\n", path.getCharArray(), i);
|
||||
#endif
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/questions/230062/whats-the-best-way-to-check-if-a-file-exists-in-c
|
||||
@@ -47,8 +52,22 @@ public:
|
||||
std::this_thread::sleep_for(timespan);
|
||||
}
|
||||
static void Copy(const String& src, const String& dst) {
|
||||
#if __cplusplus >= 201703L
|
||||
std::filesystem::copy(src.getCharArray(), dst.getCharArray());
|
||||
#else
|
||||
String command = "cp " + String::DQuotes(src) + " " + String::DQuotes(dst);
|
||||
system(command.getCharArray());
|
||||
int i = system(command.getCharArray());
|
||||
printf("cp '%s' return code = %d\n",src.getCharArray(), i);
|
||||
#endif
|
||||
}
|
||||
static void CopyDirectory(const String& src, const String& dst) {
|
||||
#if __cplusplus >= 201703L
|
||||
std::filesystem::copy((src+ "/.").getCharArray(), dst.getCharArray(), std::filesystem::copy_options::recursive);
|
||||
#else
|
||||
String command = "cp -r " + String::DQuotes(src + "/.") + " " + String::DQuotes(dst);
|
||||
int i = system(command.getCharArray());
|
||||
printf("cp -r '%s' return code = %d\n",src.getCharArray(),i);
|
||||
#endif
|
||||
}
|
||||
static time_t getAbsoluteTime() {
|
||||
return time(NULL);
|
||||
@@ -58,8 +77,4 @@ public:
|
||||
String res(ctime(&ttime));
|
||||
return res;
|
||||
}
|
||||
static void ZipFolder(const String& src, const String& dst) {
|
||||
String command = "zip -r " + String::DQuotes(dst) + " " + String::DQuotes(src);
|
||||
system(command.getCharArray());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user