Исправление ключей у тестирования двм системы.
This commit is contained in:
@@ -3,6 +3,7 @@ import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import GlobalData.Tasks.TaskState;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
@@ -10,6 +11,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -28,6 +30,7 @@ import java.nio.file.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -1047,5 +1050,66 @@ public class Utils {
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
//--
|
||||
public static boolean isCrushedLine(String line) {
|
||||
return line.contains("RTS err")
|
||||
|| line.contains("RTS stack trace")
|
||||
|| line.contains("RTS fatal err")
|
||||
|| line.contains("SIGEGV")
|
||||
|| line.contains("There are not enough slots available in the system to satisfy the")
|
||||
|| line.contains("forrtl: severe")
|
||||
|| line.contains("invalid pointer")
|
||||
|| line.contains("forrtl: error");
|
||||
}
|
||||
public static boolean isCrushed(List<String> output_lines, List<String> errors_lines) {
|
||||
return output_lines.stream().anyMatch(Utils::isCrushedLine) || errors_lines.stream().anyMatch(Utils::isCrushedLine);
|
||||
}
|
||||
public static Pair<TaskState, Integer> analyzeCorrectness(List<String> lines) {
|
||||
int complete = 0;
|
||||
int errors = 0;
|
||||
int total = 0;
|
||||
for (String s : lines) {
|
||||
String line = s.toUpperCase();
|
||||
if (line.contains("COMPLETE")) {
|
||||
complete++;
|
||||
total++;
|
||||
} else if (line.contains("ERROR")) {
|
||||
errors++;
|
||||
total++;
|
||||
}
|
||||
}
|
||||
return new Pair<>(
|
||||
(errors > 0) ? TaskState.DoneWithErrors : ((complete > 0) ? TaskState.Done : TaskState.WrongTestFormat),
|
||||
(int) ((((double) complete) / total) * 100)
|
||||
);
|
||||
}
|
||||
public static Pair<TaskState, Integer> analyzePerformance(List<String> lines) {
|
||||
StringTemplate stringTemplate = new StringTemplate("Verification =", "");
|
||||
for (String line : lines) {
|
||||
String param = stringTemplate.check_and_get_param(line);
|
||||
if (param != null) {
|
||||
switch (param) {
|
||||
case "SUCCESSFUL":
|
||||
return new Pair<>(TaskState.Done, 100);
|
||||
case "UNSUCCESSFUL":
|
||||
return new Pair<>(TaskState.DoneWithErrors, 0);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Pair<>(TaskState.WrongTestFormat, 0);
|
||||
}
|
||||
public static double parseCleanTime(String output) {
|
||||
double res = 0.0;
|
||||
StringTemplate template = new StringTemplate("Time in seconds =", "");
|
||||
String p = template.check_and_get_param(output);
|
||||
try {
|
||||
if (p != null) res = Double.parseDouble(p);
|
||||
} catch (Exception ex) {
|
||||
Global.Log.PrintException(ex);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user