убрал наличие бд в тестах.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user