This is an automated email from the ASF dual-hosted git repository.

baunsgaard pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/master by this push:
     new 4e7ad98  [MINOR] Fix settings for IntelliJ default test execution
4e7ad98 is described below

commit 4e7ad989107d98633b5dfdd8612a99b1b16053bd
Author: baunsgaard <[email protected]>
AuthorDate: Wed Dec 23 12:20:13 2020 +0100

    [MINOR] Fix settings for IntelliJ default test execution
    
    This commit change the default test settings such that they execute
    out of the box in the IntelliJ IDE without having to use custom
    configurations forcing IntelliJ to use maven.
---
 .../org/apache/sysds/test/AutomatedTestBase.java   | 34 +++++++++++++++-------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/sysds/test/AutomatedTestBase.java 
b/src/test/java/org/apache/sysds/test/AutomatedTestBase.java
index 9af4fcb..4d3e9d9 100644
--- a/src/test/java/org/apache/sysds/test/AutomatedTestBase.java
+++ b/src/test/java/org/apache/sysds/test/AutomatedTestBase.java
@@ -216,20 +216,34 @@ public abstract class AutomatedTestBase {
        private static boolean outputBuffering = false;
 
        static {
+               // Load configuration from setting file build by maven.
+               // If maven is not used as test setup, (as default in intellij 
for instance) default values are used.
+               // If one wants to use custom configurations, setup the IDE to 
build using maven, and set execution flags
+               // accordingly.
+               // Settings available can be found in the properties inside 
pom.xml.
+               // The custom configuration is required to run tests using GPU 
backend.
                java.io.InputStream inputStream = 
Thread.currentThread().getContextClassLoader()
                        .getResourceAsStream("my.properties");
                java.util.Properties properties = new Properties();
-               try {
-                       properties.load(inputStream);
-               }
-               catch(IOException e) {
-                       e.printStackTrace();
+               if(inputStream != null){
+                       try {
+                               properties.load(inputStream);
+                       }
+                       catch(IOException e) {
+                               e.printStackTrace();
+                       }
+                       outputBuffering = 
Boolean.parseBoolean(properties.getProperty("automatedtestbase.outputbuffering"));
+                       boolean gpu = 
Boolean.parseBoolean(properties.getProperty("enableGPU"));
+                       TEST_GPU = TEST_GPU || gpu;
+                       boolean stats = 
Boolean.parseBoolean(properties.getProperty("enableStats"));
+                       VERBOSE_STATS = VERBOSE_STATS || stats;
+               }
+               else{
+                       // If no properties file exists.
+                       outputBuffering = false;
+                       TEST_GPU = false;
+                       VERBOSE_STATS = false;
                }
-               outputBuffering = 
Boolean.parseBoolean(properties.getProperty("automatedtestbase.outputbuffering"));
-               boolean gpu = 
Boolean.parseBoolean(properties.getProperty("enableGPU"));
-               TEST_GPU = TEST_GPU || gpu;
-               boolean stats = 
Boolean.parseBoolean(properties.getProperty("enableStats"));
-               VERBOSE_STATS = VERBOSE_STATS || stats;
        }
 
        // Timestamp before test start.

Reply via email to