SLIDER-622 explicit tests for native binaries before attempts to set up clusters fail
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
index e67145e..c748600 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
@@ -28,6 +28,7 @@
 import org.apache.hadoop.fs.FileStatus
 import org.apache.hadoop.fs.FileSystem as HadoopFS
 import org.apache.hadoop.fs.Path
+import org.apache.hadoop.io.nativeio.NativeIO
 import org.apache.hadoop.util.Shell
 import org.apache.hadoop.yarn.api.records.ApplicationReport
 import org.apache.hadoop.yarn.conf.YarnConfiguration
@@ -190,6 +191,41 @@
   }
 
   /**
+   * Check for any needed libraries being present. On Unix none are needed;
+   * on windows they must be present
+   * @return true if all is well
+   */
+  public static boolean areRequiredLibrariesAvailable() {
+    
+    if (!Shell.WINDOWS) {
+      return true;
+    }
+    boolean available = true;
+    if (!NativeIO.available) {
+      log.warn("No native IO library")
+      available = false;
+    }
+    try {
+      def path = Shell.getQualifiedBinPath("winutils.exe");
+      log.debug("winutils is at $path")
+    } catch (IOException e) {
+      log.warn("No winutils: $e", e)
+      available = false;
+    }
+    return available;
+  }
+
+  /**
+   * Assert that any needed libraries being present. On Unix none are needed;
+   * on windows they must be present
+   */
+  public static void assertNativeLibrariesPresent() {
+    assertTrue("Required Native libraries and executables are not present." +
+               "Check your HADOOP_HOME and PATH environment variables",
+        areRequiredLibrariesAvailable())
+  }
+
+  /**
    * Wait for the cluster live; fail if it isn't within the (standard) timeout
    * @param sliderClient client
    * @return the app report of the live cluster
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
index 3241ec3..4d2cb3b 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
@@ -239,7 +239,7 @@
                                    int numLocalDirs,
                                    int numLogDirs,
                                    boolean startHDFS) {
-   
+    assertNativeLibrariesPresent();
     conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 64);
     conf.set(YarnConfiguration.RM_SCHEDULER, FIFO_SCHEDULER);
     SliderUtils.patchConfiguration(conf)
@@ -275,6 +275,8 @@
   public static MiniDFSCluster buildMiniHDFSCluster(
       String name,
       YarnConfiguration conf) {
+    assertNativeLibrariesPresent();
+
     File baseDir = new File("./target/hdfs/$name").absoluteFile;
     //use file: to rm it recursively
     FileUtil.fullyDelete(baseDir)