Reduce the fragility of the Sanity Test by not trying to access anything outside... 83/1783/2
authorMoiz Raja <moraja@cisco.com>
Wed, 9 Oct 2013 20:28:39 +0000 (13:28 -0700)
committerMoiz Raja <moraja@cisco.com>
Wed, 9 Oct 2013 21:08:39 +0000 (14:08 -0700)
Change-Id: I4f563ae82becde73ff412aeddc159cf7c7051433
Signed-off-by: Moiz Raja <moraja@cisco.com>
opendaylight/distribution/opendaylight/pom.xml
opendaylight/distribution/opendaylight/src/main/resources/run.sh
opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/distribution/Sanity.java

index 74d2b74..905e3a4 100644 (file)
             <executable>java</executable>
             <arguments>
                 <argument>-cp</argument>
-                <argument>../sanitytest/target/classes</argument>
+                <argument>./target/dependency/*</argument>
                 <argument>org.opendaylight.controller.distribution.Sanity</argument>
             </arguments>
-            <workingDirectory>${exec.workingdir}/../../sanitytest</workingDirectory>
           </configuration>
       </plugin>
     </plugins>
index 6caf3e3..31bf3c6 100755 (executable)
@@ -10,6 +10,9 @@ fi
 
 if [[ $platform == 'linux' ]]; then
    fullpath=`readlink -f $0`
+
+   [[ -z ${JAVA_HOME} ]] && [[ -x "/usr/lib/jvm/java-1.7.0" ]] && export JAVA_HOME=`/usr/lib/jvm/java-1.7.0`;
+
 elif [[ $platform == 'osx' ]]; then
    TARGET_FILE=$0
    cd `dirname $TARGET_FILE`
index 378ea8a..33ff8ea 100644 (file)
@@ -1,6 +1,5 @@
 package org.opendaylight.controller.distribution;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -20,19 +19,16 @@ public class Sanity {
 
         System.out.println("Current working directory = " + cwd);
 
-        // We assume that the program is being run from the sanitytest directory
-        // We need to specify the opendaylight directory as the working directory for the shell/batch scripts
-        File processWorkingDir = new File(cwd, "../opendaylight");
-
         String os = System.getProperty("os.name").toLowerCase();
         String script = "./run.sh";
 
         if(os.contains("windows")){
-            script = "run.bat";
+            System.out.println("Sorry no sanity testing on Windows yet");
+            System.exit(0);
+            return;
         }
 
         ProcessBuilder processBuilder = new ProcessBuilder();
-        processBuilder.directory(processWorkingDir.getCanonicalFile());
         processBuilder.command(script);
         Process p = processBuilder.start();