From 4ce7190905a968d7afa5e3e2ca2196a5f6c12702 Mon Sep 17 00:00:00 2001 From: 02090095 Date: Thu, 13 Mar 2025 17:11:05 +0300 Subject: [PATCH] =?UTF-8?q?++=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20=D0=BD=D0=B0=20=D0=B3?= =?UTF-8?q?=D0=B8=D1=82,=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BF=D1=80=D0=BE=D1=85=D0=BE=D0=B4?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8?= =?UTF-8?q?=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 5 +- properties | 2 +- src/_VisualDVM/Constants.java | 6 +- .../Passes/All/DownloadDvmRepository.java | 41 -------------- .../All/DownloadDvmTestsRepository.java | 22 ++++++++ .../Passes/All/DownloadSapforRepository.java | 37 ++---------- src/_VisualDVM/Passes/PassCode.java | 6 +- .../Repository/DownloadRepositoryPass.java | 56 +++++++++++++++++++ .../TestingSystem/Common/TestingServer.java | 27 +++++---- .../SAPFOR/SapforTestingPlanner.java | 14 ++--- 10 files changed, 110 insertions(+), 106 deletions(-) delete mode 100644 src/_VisualDVM/Passes/All/DownloadDvmRepository.java create mode 100644 src/_VisualDVM/Passes/All/DownloadDvmTestsRepository.java create mode 100644 src/_VisualDVM/Passes/Repository/DownloadRepositoryPass.java diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2f3cb9da..1e5d1fe6 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,12 +7,13 @@ + - + - + diff --git a/properties b/properties index 05e7df0e..7dd00382 100644 --- a/properties +++ b/properties @@ -4,7 +4,7 @@ "ServerUserPassword": "mprit_2011", "OfferRegistrationOnStart": true, "Workspace": "E:\\Tests", - "ProjectsSearchDirectory": "E:\\BUG", + "ProjectsSearchDirectory": "E:\\Tests\\Downloads", "DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system", "VisualiserPath": "C:\\Users\\misha\\Downloads", "Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F", diff --git a/src/_VisualDVM/Constants.java b/src/_VisualDVM/Constants.java index b28264fa..04bd82dc 100644 --- a/src/_VisualDVM/Constants.java +++ b/src/_VisualDVM/Constants.java @@ -3,7 +3,7 @@ import Common.Utils.Vector_; import java.util.Vector; public class Constants { - public static final int version = 1207; + public static final int version = 1208; public static final int planner_version = 15; public static final int testingMaxKernels = 64; //-- @@ -26,10 +26,8 @@ public class Constants { public static final String PerformanceAnalyzerDirectoryName = "PerformanceAnalyzer"; public static final String KeyDirectoryName = "Keys"; //-- - //SVN (пока оставить для тестов) - public static final String REPOSITORY_AUTHENTICATION = "--username dvmhuser --password dvmh2013 --non-interactive"; - public static final String DVM_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/dvm"; //GIT + public static final String DVM_TESTS_REPOSITORY = "https://dvmguest:dvmguest@dvm.keldysh.ru/dvm-system/dvm-auto-test"; public static final String SAPFOR_REPOSITORY = "http://dvmh-server.ddns.net:3000/Alexander_KS/SAPFOR.git"; public static final String SAPFOR_VERSION_URL = "http://dvmh-server.ddns.net:3000/Alexander_KS/SAPFOR/raw/branch/master/src/Utils/version.h"; //-вывод задач diff --git a/src/_VisualDVM/Passes/All/DownloadDvmRepository.java b/src/_VisualDVM/Passes/All/DownloadDvmRepository.java deleted file mode 100644 index 764aae2f..00000000 --- a/src/_VisualDVM/Passes/All/DownloadDvmRepository.java +++ /dev/null @@ -1,41 +0,0 @@ -package _VisualDVM.Passes.All; -import Common.CommonConstants; -import _VisualDVM.Constants; -import _VisualDVM.Global; -import _VisualDVM.Passes.ProcessPass; -import _VisualDVM.Utils; -import org.apache.commons.io.FileUtils; - -import java.io.File; -import java.nio.file.Paths; -public class DownloadDvmRepository extends ProcessPass { - /* - git clone https://dvmguest:dvmguest@dvm.keldysh.ru/dvm-system/dvm /home/testuser/Repo/DVM/ - git clone https://dvmguest:dvmguest@dvm.keldysh.ru/dvm-system/dvm-auto-test /home/testuser/Repo/DVM_AUTO_TEST/ - */ - File dvmHome; - @Override - protected boolean canStart(Object... args) throws Exception { - dvmHome = Paths.get(Global.RepoDirectory.getAbsolutePath(), - "dvm").toFile(); - return true; - } - private void synchronize(String src, File dst) throws Exception { - File loadedFile = Paths.get(dst.getAbsolutePath(), CommonConstants.LOADED).toFile(); - if (loadedFile.exists()) { - PerformScript("cd " + - dst.getAbsolutePath() + - "\nsvn update " + Constants.REPOSITORY_AUTHENTICATION + "\n"); - } else { - Utils.CleanDirectory(dst); - PerformScript("cd Repo\nsvn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export - FileUtils.write(loadedFile, ""); - } - } - @Override - protected void body() throws Exception { - ShowProgress(1, 0, true); - synchronize(Constants.DVM_REPOSITORY, dvmHome); - ShowProgress(1, 1, true); - } -} diff --git a/src/_VisualDVM/Passes/All/DownloadDvmTestsRepository.java b/src/_VisualDVM/Passes/All/DownloadDvmTestsRepository.java new file mode 100644 index 00000000..88730023 --- /dev/null +++ b/src/_VisualDVM/Passes/All/DownloadDvmTestsRepository.java @@ -0,0 +1,22 @@ +package _VisualDVM.Passes.All; +import Common.CommonConstants; +import Common.Utils.Utils_; +import _VisualDVM.Constants; +import _VisualDVM.Global; +import _VisualDVM.Passes.ProcessPass; +import _VisualDVM.Passes.Repository.DownloadRepositoryPass; +import _VisualDVM.Utils; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.nio.file.Paths; +public class DownloadDvmTestsRepository extends DownloadRepositoryPass { + /* + git clone https://dvmguest:dvmguest@dvm.keldysh.ru/dvm-system/dvm DST + git clone https://dvmguest:dvmguest@dvm.keldysh.ru/dvm-system/dvm-auto-test DST + */ + @Override + protected boolean canStart(Object... args) throws Exception { + return super.canStart(Constants.DVM_TESTS_REPOSITORY, "dvm-auto-test"); + } +} diff --git a/src/_VisualDVM/Passes/All/DownloadSapforRepository.java b/src/_VisualDVM/Passes/All/DownloadSapforRepository.java index d9531248..c903b170 100644 --- a/src/_VisualDVM/Passes/All/DownloadSapforRepository.java +++ b/src/_VisualDVM/Passes/All/DownloadSapforRepository.java @@ -4,46 +4,19 @@ import Common.Utils.Utils_; import _VisualDVM.Constants; import _VisualDVM.Global; import _VisualDVM.Passes.ProcessPass; +import _VisualDVM.Passes.Repository.DownloadRepositoryPass; import _VisualDVM.Utils; import org.apache.commons.io.FileUtils; import java.io.File; import java.nio.file.Paths; -public class DownloadSapforRepository extends ProcessPass { - File sapforHome; - @Override - public String getDescription() { - return "Загрузка репозитория"; - } +public class DownloadSapforRepository extends DownloadRepositoryPass { @Override protected boolean canStart(Object... args) throws Exception { - sapforHome = Paths.get(Global.RepoDirectory.getAbsolutePath(), - "SAPFOR").toFile(); - return true; - } - private void synchronize(String src, File dst) throws Exception { - File loadedFile = Paths.get(dst.getAbsolutePath(), CommonConstants.LOADED).toFile(); - if (loadedFile.exists()) { - PerformScript("cd " + dst.getAbsolutePath() + "\n" + - "git pull\n" + - "cd " + Utils_.DQuotes(sapforHome) + "\n" + - "GIT_SSL_NO_VERIFY=true git submodule update --init\n" - ); - } else { - Utils.CleanDirectory(dst); - PerformScript("cd Repo\n" + - "git clone " + - Utils_.DQuotes(src) + "\n" + - "cd " + Utils_.DQuotes(sapforHome) + "\n" + - "GIT_SSL_NO_VERIFY=true git submodule update --init\n" - ); //export - FileUtils.write(loadedFile, ""); - } + return super.canStart(Constants.SAPFOR_REPOSITORY, "SAPFOR"); } @Override - protected void body() throws Exception { - ShowProgress(1, 0, true); - synchronize(Constants.SAPFOR_REPOSITORY, sapforHome); - ShowProgress(1, 1, true); + protected boolean hasSubmodules() { + return true; } } diff --git a/src/_VisualDVM/Passes/PassCode.java b/src/_VisualDVM/Passes/PassCode.java index 944c5059..038185bf 100644 --- a/src/_VisualDVM/Passes/PassCode.java +++ b/src/_VisualDVM/Passes/PassCode.java @@ -132,7 +132,7 @@ public enum PassCode implements PassCode_ { UpdateComponent, BuildComponent, DownloadSapforRepository, - DownloadDvmRepository, + DownloadDvmTestsRepository, SaveGraph, ApplyBugReportSettings, DownloadBugReport, @@ -790,8 +790,8 @@ public enum PassCode implements PassCode_ { return "Сборка компонента"; case DownloadSapforRepository: return "Загрузка репозитория SAPFOR"; - case DownloadDvmRepository: - return "Загрузка репозитория DVM"; + case DownloadDvmTestsRepository: + return "Загрузка репозитория DVM тестов"; case SaveGraph: return "Сделать скриншот графа функций"; case ApplyBugReportSettings: diff --git a/src/_VisualDVM/Passes/Repository/DownloadRepositoryPass.java b/src/_VisualDVM/Passes/Repository/DownloadRepositoryPass.java new file mode 100644 index 00000000..e15642cb --- /dev/null +++ b/src/_VisualDVM/Passes/Repository/DownloadRepositoryPass.java @@ -0,0 +1,56 @@ +package _VisualDVM.Passes.Repository; +import Common.CommonConstants; +import Common.Utils.Utils_; +import _VisualDVM.Global; +import _VisualDVM.Passes.ProcessPass; +import _VisualDVM.Utils; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.nio.file.Paths; +import java.util.Vector; +public class DownloadRepositoryPass extends ProcessPass { + String url; + String dst_name; + File dst; + @Override + public String getDescription() { + return "Загрузка репозитория"; + } + @Override + protected boolean canStart(Object... args) throws Exception { + url = (String) args[0]; + dst_name = (String) args[1]; + dst = new File(Global.RepoDirectory, dst_name); + return true; + } + protected boolean hasSubmodules() { + return false; + } + @Override + protected void body() throws Exception { + ShowProgress(1, 0, true); + Vector scriptLines = new Vector<>(); + File loadedFile = Paths.get(dst.getAbsolutePath(), CommonConstants.LOADED).toFile(); + boolean pull = loadedFile.exists(); + if (pull){ + System.out.println("PULL"); + scriptLines.add("cd " + dst.getAbsolutePath()); + scriptLines.add("git pull"); + }else { + Utils.CleanDirectory(dst); + System.out.println("CLONE"); + scriptLines.add("cd " + Utils_.DQuotes(Global.RepoDirectory.getAbsolutePath())); + scriptLines.add("git clone " + Utils_.DQuotes(url)+" "+Utils_.DQuotes(dst.getAbsolutePath())); + } + if (hasSubmodules()) { + scriptLines.add("cd " + Utils_.DQuotes(dst)); + scriptLines.add("GIT_SSL_NO_VERIFY=true git submodule update --init"); + } + PerformScript(String.join("\n", scriptLines)); + if (!pull){ + FileUtils.write(loadedFile, ""); + } + ShowProgress(1, 1, true); + } +} diff --git a/src/_VisualDVM/TestingSystem/Common/TestingServer.java b/src/_VisualDVM/TestingSystem/Common/TestingServer.java index 6bb09a41..46bd2c0e 100644 --- a/src/_VisualDVM/TestingSystem/Common/TestingServer.java +++ b/src/_VisualDVM/TestingSystem/Common/TestingServer.java @@ -12,7 +12,7 @@ import _VisualDVM.ComponentsServer.UserAccount.UserAccount; import _VisualDVM.Constants; import _VisualDVM.Global; import _VisualDVM.GlobalData.Tasks.TaskState; -import _VisualDVM.Passes.All.DownloadDvmRepository; +import _VisualDVM.Passes.All.DownloadDvmTestsRepository; import _VisualDVM.Passes.All.ZipFolderPass; import _VisualDVM.Passes.PassCode; import _VisualDVM.ProjectData.Files.ProjectFile; @@ -295,14 +295,19 @@ public class TestingServer extends RepositoryServer { }).start(); } void PerformAutoSapforTesting() throws Exception { + int sapforId = Integer.parseInt(request.arg); + if (!db.serverSapfors.containsKey(sapforId)) { + throw new RepositoryRefuseException("Версия SAPFOR " + sapforId + " не существует."); + } + ServerSapfor sapfor = db.serverSapfors.get(sapforId); TextLog Log = new TextLog(); - SapforPackage autoPackage = tryAutoSapforTesting(Log); + SapforPackage autoPackage = tryAutoSapforTesting(sapfor,Log); EmailMessage message = Log.isEmpty() ? new EmailMessage( - "Запущено автоматическое тестирование версии " + request.arg + " системы SAPFOR", + "Запущено автоматическое тестирование версии " + sapfor.version + " системы SAPFOR", "Пакет " + Utils_.Brackets(autoPackage.id)) : new EmailMessage( - "Не удалось запустить автоматическое тестирование версии " + request.arg + " системы SAPFOR", + "Не удалось запустить автоматическое тестирование версии " + sapfor.version + " системы SAPFOR", Log.toString() ); for (String address : Constants.admins_mails) @@ -350,14 +355,14 @@ public class TestingServer extends RepositoryServer { void RefreshDVMTests() throws Exception { UserAccount account = new UserAccount("server", Constants.MailAddress); ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion(); - DownloadDvmRepository downloadRepository = new DownloadDvmRepository(); + DownloadDvmTestsRepository downloadRepository = new DownloadDvmTestsRepository(); if (!downloadRepository.Do()) throw new RepositoryRefuseException("Не удалось обновить репозиторий"); //-->> Vector>> groups = new Vector<>(); File testsSrc = Paths.get( Global.RepoDirectory.getAbsolutePath(), - "dvm", "tools", "tester", "trunk", "test-suite").toFile(); + "dvm-auto-test", "test-suite").toFile(); LanguageName[] supportedLanguages = new LanguageName[]{LanguageName.fortran, LanguageName.c}; for (LanguageName languageName : supportedLanguages) { for (TestType testType : TestType.values()) { @@ -606,21 +611,15 @@ public class TestingServer extends RepositoryServer { } response.object = serverSapfor; } - SapforPackage tryAutoSapforTesting(TextLog Log) throws Exception { + SapforPackage tryAutoSapforTesting(ServerSapfor sapfor, TextLog Log) throws Exception { //-- UserAccount account = new UserAccount(); account.name = "server"; account.email = Constants.MailAddress; account.role = AccountRole.Admin; //- - int sapforId = Integer.parseInt(request.arg); - if (!db.serverSapfors.containsKey(sapforId)) { - Log.Writeln_("Версия SAPFOR " + sapforId + " не существует."); - return null; - } - ServerSapfor sapfor = db.serverSapfors.get(sapforId); if (!sapfor.state.equals(ServerSapforState.Done)) { - Log.Writeln_("Выбранная версия SAPFOR " + sapforId + " не собрана!"); + Log.Writeln_("Выбранная версия SAPFOR " + sapfor.version + " не собрана!"); return null; } Vector configurations = db.sapforConfigurations.getAutoConfigurations(); diff --git a/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java b/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java index f59bd68f..91808c90 100644 --- a/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java +++ b/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java @@ -4,6 +4,7 @@ import Common.Utils.TextLog; import Common.Utils.Utils_; import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor; import _VisualDVM.*; +import _VisualDVM.Passes.All.DownloadSapforRepository; import _VisualDVM.ProjectData.LanguageName; import _VisualDVM.Repository.EmailMessage; import _VisualDVM.Repository.Server.ServerCode; @@ -233,14 +234,6 @@ public class SapforTestingPlanner extends TestingPlanner { sapfor.state = state_in; ServerCommand(ServerCode.EditObject, sapfor); } - void SyncronizeRepository() throws Exception { - UpdateSapforState(ServerSapforState.SAPFORRepositorySynchronization); - Utils.CleanDirectory(repo); - Utils.startScript(repo, repo, "git_clone", - "git clone " + Constants.SAPFOR_REPOSITORY + " " + Utils_.DQuotes(repo_sapfor) + " 1>spf_out.txt 2>spf_err.txt\n" + - "cd " + Utils_.DQuotes(repo_sapfor) + "\n"+ - "GIT_SSL_NO_VERIFY=true git submodule update --init\n").waitFor(); - } void CompileSapfor() throws Exception { UpdateSapforState(ServerSapforState.Compilation); //- @@ -263,7 +256,10 @@ public class SapforTestingPlanner extends TestingPlanner { max_version = CommonConstants.Nan; current_version = CommonConstants.Nan; //-- - SyncronizeRepository(); + UpdateSapforState(ServerSapforState.SAPFORRepositorySynchronization); + DownloadSapforRepository pass = new DownloadSapforRepository(); + pass.Do(); + //- max_version = (int) ServerCommand(ServerCode.GetMaxSapforVersion); current_version = Sapfor.readVersionFromCode(Paths.get(repo.getAbsolutePath(), "/SAPFOR/src/Utils/version.h").toFile());