перевод тестов на гит, рефакторинг проходов загрузки репозитория
This commit is contained in:
2025-03-13 17:11:05 +03:00
parent dc68667b20
commit 4ce7190905
10 changed files with 110 additions and 106 deletions

5
.idea/workspace.xml generated
View File

@@ -7,12 +7,13 @@
</component> </component>
<component name="ChangeListManager"> <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 afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/Repository/DownloadRepositoryPass.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" /> <change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/Visual/Editor/BaseEditor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Visual/Editor/BaseEditor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadDvmRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadDvmTestsRepository.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadSapforRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadSapforRepository.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadSapforRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadSapforRepository.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Files/UI/Editor/SPFEditor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Files/UI/Editor/SPFEditor.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/PassCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/PassCode.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java" afterDir="false" />
</list> </list>

View File

@@ -4,7 +4,7 @@
"ServerUserPassword": "mprit_2011", "ServerUserPassword": "mprit_2011",
"OfferRegistrationOnStart": true, "OfferRegistrationOnStart": true,
"Workspace": "E:\\Tests", "Workspace": "E:\\Tests",
"ProjectsSearchDirectory": "E:\\BUG", "ProjectsSearchDirectory": "E:\\Tests\\Downloads",
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system", "DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
"VisualiserPath": "C:\\Users\\misha\\Downloads", "VisualiserPath": "C:\\Users\\misha\\Downloads",
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F", "Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",

View File

@@ -3,7 +3,7 @@ import Common.Utils.Vector_;
import java.util.Vector; import java.util.Vector;
public class Constants { 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 planner_version = 15;
public static final int testingMaxKernels = 64; public static final int testingMaxKernels = 64;
//-- //--
@@ -26,10 +26,8 @@ public class Constants {
public static final String PerformanceAnalyzerDirectoryName = "PerformanceAnalyzer"; public static final String PerformanceAnalyzerDirectoryName = "PerformanceAnalyzer";
public static final String KeyDirectoryName = "Keys"; 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 //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_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"; public static final String SAPFOR_VERSION_URL = "http://dvmh-server.ddns.net:3000/Alexander_KS/SAPFOR/raw/branch/master/src/Utils/version.h";
//-вывод задач //-вывод задач

View File

@@ -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);
}
}

View File

@@ -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");
}
}

View File

@@ -4,46 +4,19 @@ import Common.Utils.Utils_;
import _VisualDVM.Constants; import _VisualDVM.Constants;
import _VisualDVM.Global; import _VisualDVM.Global;
import _VisualDVM.Passes.ProcessPass; import _VisualDVM.Passes.ProcessPass;
import _VisualDVM.Passes.Repository.DownloadRepositoryPass;
import _VisualDVM.Utils; import _VisualDVM.Utils;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import java.io.File; import java.io.File;
import java.nio.file.Paths; import java.nio.file.Paths;
public class DownloadSapforRepository extends ProcessPass { public class DownloadSapforRepository extends DownloadRepositoryPass {
File sapforHome;
@Override
public String getDescription() {
return "Загрузка репозитория";
}
@Override @Override
protected boolean canStart(Object... args) throws Exception { protected boolean canStart(Object... args) throws Exception {
sapforHome = Paths.get(Global.RepoDirectory.getAbsolutePath(), return super.canStart(Constants.SAPFOR_REPOSITORY, "SAPFOR");
"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, "");
}
} }
@Override @Override
protected void body() throws Exception { protected boolean hasSubmodules() {
ShowProgress(1, 0, true); return true;
synchronize(Constants.SAPFOR_REPOSITORY, sapforHome);
ShowProgress(1, 1, true);
} }
} }

View File

@@ -132,7 +132,7 @@ public enum PassCode implements PassCode_ {
UpdateComponent, UpdateComponent,
BuildComponent, BuildComponent,
DownloadSapforRepository, DownloadSapforRepository,
DownloadDvmRepository, DownloadDvmTestsRepository,
SaveGraph, SaveGraph,
ApplyBugReportSettings, ApplyBugReportSettings,
DownloadBugReport, DownloadBugReport,
@@ -790,8 +790,8 @@ public enum PassCode implements PassCode_ {
return "Сборка компонента"; return "Сборка компонента";
case DownloadSapforRepository: case DownloadSapforRepository:
return "Загрузка репозитория SAPFOR"; return "Загрузка репозитория SAPFOR";
case DownloadDvmRepository: case DownloadDvmTestsRepository:
return "Загрузка репозитория DVM"; return "Загрузка репозитория DVM тестов";
case SaveGraph: case SaveGraph:
return "Сделать скриншот графа функций"; return "Сделать скриншот графа функций";
case ApplyBugReportSettings: case ApplyBugReportSettings:

View File

@@ -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<String> 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);
}
}

View File

@@ -12,7 +12,7 @@ import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
import _VisualDVM.Constants; import _VisualDVM.Constants;
import _VisualDVM.Global; import _VisualDVM.Global;
import _VisualDVM.GlobalData.Tasks.TaskState; import _VisualDVM.GlobalData.Tasks.TaskState;
import _VisualDVM.Passes.All.DownloadDvmRepository; import _VisualDVM.Passes.All.DownloadDvmTestsRepository;
import _VisualDVM.Passes.All.ZipFolderPass; import _VisualDVM.Passes.All.ZipFolderPass;
import _VisualDVM.Passes.PassCode; import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.Files.ProjectFile; import _VisualDVM.ProjectData.Files.ProjectFile;
@@ -295,14 +295,19 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
}).start(); }).start();
} }
void PerformAutoSapforTesting() throws Exception { 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(); TextLog Log = new TextLog();
SapforPackage autoPackage = tryAutoSapforTesting(Log); SapforPackage autoPackage = tryAutoSapforTesting(sapfor,Log);
EmailMessage message = Log.isEmpty() ? EmailMessage message = Log.isEmpty() ?
new EmailMessage( new EmailMessage(
"Запущено автоматическое тестирование версии " + request.arg + " системы SAPFOR", "Запущено автоматическое тестирование версии " + sapfor.version + " системы SAPFOR",
"Пакет " + Utils_.Brackets(autoPackage.id)) : "Пакет " + Utils_.Brackets(autoPackage.id)) :
new EmailMessage( new EmailMessage(
"Не удалось запустить автоматическое тестирование версии " + request.arg + " системы SAPFOR", "Не удалось запустить автоматическое тестирование версии " + sapfor.version + " системы SAPFOR",
Log.toString() Log.toString()
); );
for (String address : Constants.admins_mails) for (String address : Constants.admins_mails)
@@ -350,14 +355,14 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
void RefreshDVMTests() throws Exception { void RefreshDVMTests() throws Exception {
UserAccount account = new UserAccount("server", Constants.MailAddress); UserAccount account = new UserAccount("server", Constants.MailAddress);
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion(); ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
DownloadDvmRepository downloadRepository = new DownloadDvmRepository(); DownloadDvmTestsRepository downloadRepository = new DownloadDvmTestsRepository();
if (!downloadRepository.Do()) if (!downloadRepository.Do())
throw new RepositoryRefuseException("Не удалось обновить репозиторий"); throw new RepositoryRefuseException("Не удалось обновить репозиторий");
//-->> //-->>
Vector<Pair<Group, Vector<File>>> groups = new Vector<>(); Vector<Pair<Group, Vector<File>>> groups = new Vector<>();
File testsSrc = Paths.get( File testsSrc = Paths.get(
Global.RepoDirectory.getAbsolutePath(), Global.RepoDirectory.getAbsolutePath(),
"dvm", "tools", "tester", "trunk", "test-suite").toFile(); "dvm-auto-test", "test-suite").toFile();
LanguageName[] supportedLanguages = new LanguageName[]{LanguageName.fortran, LanguageName.c}; LanguageName[] supportedLanguages = new LanguageName[]{LanguageName.fortran, LanguageName.c};
for (LanguageName languageName : supportedLanguages) { for (LanguageName languageName : supportedLanguages) {
for (TestType testType : TestType.values()) { for (TestType testType : TestType.values()) {
@@ -606,21 +611,15 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
} }
response.object = serverSapfor; response.object = serverSapfor;
} }
SapforPackage tryAutoSapforTesting(TextLog Log) throws Exception { SapforPackage tryAutoSapforTesting(ServerSapfor sapfor, TextLog Log) throws Exception {
//-- //--
UserAccount account = new UserAccount(); UserAccount account = new UserAccount();
account.name = "server"; account.name = "server";
account.email = Constants.MailAddress; account.email = Constants.MailAddress;
account.role = AccountRole.Admin; 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)) { if (!sapfor.state.equals(ServerSapforState.Done)) {
Log.Writeln_("Выбранная версия SAPFOR " + sapforId + " не собрана!"); Log.Writeln_("Выбранная версия SAPFOR " + sapfor.version + " не собрана!");
return null; return null;
} }
Vector<SapforConfiguration> configurations = db.sapforConfigurations.getAutoConfigurations(); Vector<SapforConfiguration> configurations = db.sapforConfigurations.getAutoConfigurations();

View File

@@ -4,6 +4,7 @@ import Common.Utils.TextLog;
import Common.Utils.Utils_; import Common.Utils.Utils_;
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor; import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
import _VisualDVM.*; import _VisualDVM.*;
import _VisualDVM.Passes.All.DownloadSapforRepository;
import _VisualDVM.ProjectData.LanguageName; import _VisualDVM.ProjectData.LanguageName;
import _VisualDVM.Repository.EmailMessage; import _VisualDVM.Repository.EmailMessage;
import _VisualDVM.Repository.Server.ServerCode; import _VisualDVM.Repository.Server.ServerCode;
@@ -233,14 +234,6 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
sapfor.state = state_in; sapfor.state = state_in;
ServerCommand(ServerCode.EditObject, sapfor); 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 { void CompileSapfor() throws Exception {
UpdateSapforState(ServerSapforState.Compilation); UpdateSapforState(ServerSapforState.Compilation);
//- //-
@@ -263,7 +256,10 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
max_version = CommonConstants.Nan; max_version = CommonConstants.Nan;
current_version = CommonConstants.Nan; current_version = CommonConstants.Nan;
//-- //--
SyncronizeRepository(); UpdateSapforState(ServerSapforState.SAPFORRepositorySynchronization);
DownloadSapforRepository pass = new DownloadSapforRepository();
pass.Do();
//-
max_version = (int) ServerCommand(ServerCode.GetMaxSapforVersion); max_version = (int) ServerCommand(ServerCode.GetMaxSapforVersion);
current_version = Sapfor.readVersionFromCode(Paths.get(repo.getAbsolutePath(), current_version = Sapfor.readVersionFromCode(Paths.get(repo.getAbsolutePath(),
"/SAPFOR/src/Utils/version.h").toFile()); "/SAPFOR/src/Utils/version.h").toFile());