Improved logging of configuration of test runs.
This commit is contained in:
parent
5a327ff30b
commit
76dc1e7e21
|
@ -77,18 +77,29 @@ public class TestSuite {
|
|||
public static void logConfiguration() {
|
||||
log.info("Test Configuration:");
|
||||
log.info("===================");
|
||||
log.info("Sources:");
|
||||
log.info(" Sources:");
|
||||
for (String element : sources) {
|
||||
log.info(" "+element);
|
||||
}
|
||||
log.info("Libs:");
|
||||
log.info(" Libs:");
|
||||
for (String element : libs) {
|
||||
log.info(" "+element);
|
||||
}
|
||||
log.info("J2SE:" + WalaProperties.J2SE_DIR);
|
||||
}
|
||||
log.info(" J2SE directory: " + WalaProperties.J2SE_DIR);
|
||||
log.info(" Analysis depth: " + AnalysisUtil.getPropertyInteger(AnalysisUtil.CONFIG_ANALYSIS_DEPTH));
|
||||
log.info(" Main config file: " + AnalysisUtil.getPropertyString("MAIN_CONFIG"));
|
||||
log.info(" Print subgraphs: " + AnalysisUtil.getPropertyBoolean(AnalysisUtil.CONFIG_BOOLEAN_PRINT_SUBGRAPHS));
|
||||
log.info(" Dot path: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_DOT_PATH));
|
||||
log.info(" Remove empty nodes: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_DOT_REMOVE_EMPTY_NODES));
|
||||
log.info(" Analysis project: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ANALYSIS_PROJECT));
|
||||
log.info(" Entry class: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ENTRY_CLASS));
|
||||
log.info(" Entry method: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ENTRY_METHOD));
|
||||
log.info(" Sanitizer: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_SANITIZER));
|
||||
log.info(" Bad sources: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_BAD_SRC));
|
||||
log.info(" Exclusion file: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_EXCLUSION_FILE));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void initTestSG(String test) throws IllegalArgumentException, CancelException, IOException{
|
||||
List<String> entryPoints = new ArrayList<String>();
|
||||
if (null != test) {
|
||||
|
@ -108,6 +119,8 @@ public class TestSuite {
|
|||
superGraph = ICFGSupergraph.make(cg, ac);
|
||||
log.info("CG size: "+cg.getNumberOfNodes());
|
||||
log.info("SG size: "+superGraph.getNumberOfNodes());
|
||||
logConfiguration();
|
||||
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
|
|
|
@ -68,7 +68,7 @@ public class AnalysisUtil {
|
|||
/**
|
||||
* Relative path to the main configuration file
|
||||
*/
|
||||
public static final String PLUGIN_MAIN_CONFIG = "config/main.config";
|
||||
public static final String MAIN_CONFIG = "config/main.config";
|
||||
|
||||
/**
|
||||
* Relative path to the logging configuration file
|
||||
|
@ -216,30 +216,24 @@ public class AnalysisUtil {
|
|||
*/
|
||||
public static String getPropertyString(String name) {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("MAIN_CONFIG", MAIN_CONFIG);
|
||||
BufferedInputStream stream;
|
||||
try {
|
||||
Path path = new Path(PLUGIN_MAIN_CONFIG);
|
||||
InputStream in;
|
||||
File f = new File("config/main.config");
|
||||
in = new FileInputStream(f);
|
||||
|
||||
System.err.println("Reading configuration file: "+in);
|
||||
File f = new File(MAIN_CONFIG);
|
||||
in = new FileInputStream(f);
|
||||
System.err.println("Reading configuration file: "+f);
|
||||
stream = new BufferedInputStream(in);
|
||||
properties.load(stream);
|
||||
stream.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
System.err.println("no config file found");
|
||||
return "";
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println(" STD no config file found (null pointer)");
|
||||
System.err.println(" ERR no config file found (null pointer)");
|
||||
return "";
|
||||
log.warn("Warning: no config file found:", e);
|
||||
properties.setProperty("MAIN_CONFIG", MAIN_CONFIG + " (not found)");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
log.error("Failure reading no config file:", e);
|
||||
properties.setProperty("MAIN_CONFIG", MAIN_CONFIG + " (reading error)");
|
||||
}
|
||||
String value = properties.getProperty(name);
|
||||
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue