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 74d2b74f11059159a6ca5f78ad95bbd724fdf924..905e3a4eca3d0f48117d5d6877fb37617cc5b113 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 6caf3e3f57c55aa0f3c2d88f70e43dde7de355b8..31bf3c6632158ecc532566c8275fa00e07d28800 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 378ea8a52d01e15d595da2b91eb7a39a0feafcc7..33ff8ea18a19d84764061ff3aefbb259d1c185d2 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();