Fixes for #10, #24 and #25 (#30)

diff --git a/.gitignore b/.gitignore
index a35ea03..cacf376 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
 actionProxyLoop/proxy
 golang1.10/proxy
 openwhisk/_test/exec
+openwhisk/_test/exec.go
 openwhisk/_test/hi
 openwhisk/_test/hello_greeting
 openwhisk/_test/hello_message
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c29a74e..0f7f858 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,19 +1,19 @@
-[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
 <!--
 #
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-# license agreements.  See the NOTICE file distributed with this work for additional 
-# information regarding copyright ownership.  The ASF licenses this file to you
-# under the Apache License, Version 2.0 (the # "License"); you may not use this 
-# file except in compliance with the License.  You may obtain a copy of the License 
-# at:
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
 #
-# http://www.apache.org/licenses/LICENSE-2.0
+#     http://www.apache.org/licenses/LICENSE-2.0
 #
-# Unless required by applicable law or agreed to in writing, software distributed 
-# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
-# CONDITIONS OF ANY KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 -->
 
@@ -36,18 +36,18 @@
 [http://www.apache.org/licenses/#clas](http://www.apache.org/licenses/#clas)
 
 Once submitted, you will receive a confirmation email from the Apache Software Foundation (ASF) and be added to
-the following list: http://people.apache.org/unlistedclas.html. 
+the following list: http://people.apache.org/unlistedclas.html.
 
 Project committers will use this list to verify pull requests (PRs) come from contributors that have signed a CLA.
 
-We look forward to your contributions! 
+We look forward to your contributions!
 
 ## Raising issues
 
-Please raise any bug reports or enhancement requests on the respective project repository's GitHub issue tracker. Be sure to search the 
+Please raise any bug reports or enhancement requests on the respective project repository's GitHub issue tracker. Be sure to search the
 list to see if your issue has already been raised.
 
-A good bug report is one that make it easy for us to understand what you were trying to do and what went wrong. 
+A good bug report is one that make it easy for us to understand what you were trying to do and what went wrong.
 Provide as much context as possible so we can try to recreate the issue.
 
 A good enhancement request comes with an explanation of what you are trying to do and how that enhancement would help you.
diff --git a/LICENSE-filetype.txt b/LICENSE-filetype.txt
new file mode 100644
index 0000000..c03a05c
--- /dev/null
+++ b/LICENSE-filetype.txt
@@ -0,0 +1,25 @@
+The MIT License
+
+Copyright (c) Tomas Aparicio
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/LICENSE-testify.txt b/LICENSE-testify.txt
new file mode 100644
index 0000000..8b79c3f
--- /dev/null
+++ b/LICENSE-testify.txt
@@ -0,0 +1,22 @@
+Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell
+
+Please consider promoting this project if you find it useful.
+
+Permission is hereby granted, free of charge, to any person 
+obtaining a copy of this software and associated documentation 
+files (the "Software"), to deal in the Software without restriction, 
+including without limitation the rights to use, copy, modify, merge, 
+publish, distribute, sublicense, and/or sell copies of the Software, 
+and to permit persons to whom the Software is furnished to do so, 
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 
+OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
+OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
index a2fe52f..a5ecd91 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -200,3 +200,18 @@
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
+
+============
+MIT licenses
+============
+
+This distribution depends on the following components, which are available under an MIT License (https://opensource.org/licenses/MIT).
+
+Filetype 1.0.5 (https://github.com/h2non/filetype)
+  Licence included at LICENSE-filetype.txt or https://github.com/h2non/filetype/blob/v1.0.5/LICENSE 
+  Copyright (c) Tomas Aparicio
+
+Testify 1.2.1 (https://github.com/stretchr/testify)
+  Licence included at LICENSE-testify.txt orhttps://github.com/stretchr/testify/blob/v1.2.1/LICENSE
+  Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell
+
diff --git a/README.md b/README.md
index 6200abd..229cfa0 100644
--- a/README.md
+++ b/README.md
@@ -1,20 +1,22 @@
 <!--
 #
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-# license agreements.  See the NOTICE file distributed with this work for additional 
-# information regarding copyright ownership.  The ASF licenses this file to you
-# under the Apache License, Version 2.0 (the # "License"); you may not use this 
-# file except in compliance with the License.  You may obtain a copy of the License 
-# at:
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
 #
-# http://www.apache.org/licenses/LICENSE-2.0
+#     http://www.apache.org/licenses/LICENSE-2.0
 #
-# Unless required by applicable law or agreed to in writing, software distributed 
-# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
-# CONDITIONS OF ANY KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 -->
+
 # Apache OpenWhisk Runtime for Go (and Generic executables)
 
 :warning: Work in progress :warning:
@@ -22,27 +24,31 @@
 This is an OpenWhisk runtime for Golang and Generic executables.
 
 - [Building it](#building)
+- [Developing it](#development)
 - [Using it with Go Sources](#gosources)
 - [Precompiling Go Sources](#precompile)
 - [Using it with Generic executables](#generic)
 
 <a name="building"/>
 
-# How to Build
+# How to Build and Test
 
-You need a linux environment, with Java and Docker installed to build the sources.
+You need a Linux or an OSX environment, with Java and Docker installed to build the sources.
 
-Prerequisites for running build and tests:
+Prerequisites for running build and tests with gradle:
+
 - docker
 - jdk
-- go 1.10.2
-- bc (sudo apt-get install bc)
 
-To compile go proxy
+
+To compile go proxy *in amd64 architecture* for docker:
+
 ```
 ./gradlew build
 ```
-To build the docker images after compiling go proxy
+
+To build the docker images after compiling go proxy:
+
 ```
 ./gradlew distDocker
 ```
@@ -58,12 +64,32 @@
 ```
 ./gradlew test --info
 ```
+<a name="development"/>
+
+# Local Development
+
+If you want to develop the proxy and run tests natively, you can on Linux or OSX.
+Tested on Ubuntu Linux (14.04) and OSX 10.13. Probably other distributions work, maybe even Windows with WSL, but since it is not tested YMMMV.
+
+You need of course [go 1.10.2](https://golang.org/doc/install)
+
+Then you need a set of utilities used in tests:
+
+- bc
+- zip
+- realpath
+
+Linux: `apt-get install bc zip realpath`
+OSX: `brew install zip coreutils`
+
+**NOTE**: Because tests build and cache some binary files, perform a `git clean -fx` and **do not share folders between linux and osx** because binaries are in different format...
+
 
 <a name="gosources"/>
 
 # Using it with Go Sources
 
-The image can execute, compiling them on the fly, Golang OpenWhisk actions in source format. An action must be a Go source file, placed in the `action` package, implementing the `Main` function (or the function specified as `main`).  
+The image can execute, compiling them on the fly, Golang OpenWhisk actions in source format. An action must be a Go source file, placed in the `action` package, implementing the `Main` function (or the function specified as `main`).
 
 The expected signature is:
 
@@ -92,7 +118,7 @@
     name = "Stranger"
   }
   msg := map[string]string{"message": ("Hello, " + name + "!")}
-  // log in stdout or in stderr 
+  // log in stdout or in stderr
   log.Printf("name=%s\n", name)
   // encode the result back in json
   return json.Marshal(msg)
@@ -122,7 +148,7 @@
 
 # Using it with generic Binaries
 
-The `actionloop` image is designed to support generic linux executable in an efficient way. 
+The `actionloop` image is designed to support generic linux executable in an efficient way.
 
 As such it works with any executable that supports the following simple protocol:
 
diff --git a/build.gradle b/build.gradle
index 0f7bfec..05d7c31 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,6 +11,15 @@
     id 'com.github.blindpirate.gogradle' version '0.8.1'
 }
 
+dependencies {
+    golang {
+        build 'github.com/h2non/filetype@v1.0.5'
+        build 'github.com/apache/incubator-openwhisk-client-go#e452b524cd745f71c913c5acccf72a8daba6dc71'
+        test 'github.com/stretchr/testify@v1.2.1'
+    }
+}
+
+
 subprojects {
     apply plugin: 'scalafmt'
     scalafmt.configFilePath = gradle.scalafmt.config
diff --git a/common/gobuild.sh b/common/gobuild.sh
index 4aecf7b..ebb5758 100755
--- a/common/gobuild.sh
+++ b/common/gobuild.sh
@@ -1,15 +1,31 @@
 #!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 # executable, defaults to main
 exec="${1:-main}"
-# absolute path of taget dir or file
+# absolute path of target dir or file
 source="${2:-/src}"
-source="$(readlink -f $source)"
+source="$(realpath $source)"
 dest="${3:-/out}"
-dest="$(readlink -f $dest)"
+dest="$(realpath $dest)"
 # prepare a compilation dir
 compiledir="$(mktemp -d)"
 compilefile="$(mktemp)"
-mkdir -p "$compiledir/src/action" "$compiledir/src/main" 
+mkdir -p "$compiledir/src/action" "$compiledir/src/main"
 # capitalized main function name
 main="$(tr '[:lower:]' '[:upper:]' <<< ${exec:0:1})${exec:1}"
 # preparing for compilation
@@ -20,7 +36,7 @@
      cp "$source"/* "$compiledir/src/action/"
 # if we have a single file action, copy it
 else cp "$source" "$compiledir/src/action/action.go"
-fi 
+fi
 # prepare the main
 cat <<EOF >$compiledir/src/main/main.go
 package main
@@ -40,7 +56,7 @@
 cd "$compiledir"
 GOPATH="$GOPATH:$compiledir" go build -i action
 GOPATH="$GOPATH:$compiledir" go build -o "$compilefile" main
-# if output is a directory use executable name 
+# if output is a directory use executable name
 if test -d "$dest"
 then dest="$dest/$exec"
 fi
diff --git a/golang1.10/Dockerfile b/golang1.10/Dockerfile
index aef1102..f3a0877 100644
--- a/golang1.10/Dockerfile
+++ b/golang1.10/Dockerfile
@@ -3,6 +3,7 @@
     curl \
     jq \
     git \
+    realpath \
     && rm -rf /var/lib/apt/lists/*
 RUN mkdir /action /home/go
 WORKDIR /action
diff --git a/gradle/README.md b/gradle/README.md
index 5b83fdb..14842f1 100644
--- a/gradle/README.md
+++ b/gradle/README.md
@@ -1,18 +1,19 @@
 <!--
 #
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-# license agreements.  See the NOTICE file distributed with this work for additional 
-# information regarding copyright ownership.  The ASF licenses this file to you
-# under the Apache License, Version 2.0 (the # "License"); you may not use this 
-# file except in compliance with the License.  You may obtain a copy of the License 
-# at:
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
 #
-# http://www.apache.org/licenses/LICENSE-2.0
+#     http://www.apache.org/licenses/LICENSE-2.0
 #
-# Unless required by applicable law or agreed to in writing, software distributed 
-# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
-# CONDITIONS OF ANY KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 -->
 
diff --git a/gradlew.bat b/gradlew.bat
index e95643d..f955316 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,84 +1,84 @@
-@if "%DEBUG%" == "" @echo off

-@rem ##########################################################################

-@rem

-@rem  Gradle startup script for Windows

-@rem

-@rem ##########################################################################

-

-@rem Set local scope for the variables with windows NT shell

-if "%OS%"=="Windows_NT" setlocal

-

-set DIRNAME=%~dp0

-if "%DIRNAME%" == "" set DIRNAME=.

-set APP_BASE_NAME=%~n0

-set APP_HOME=%DIRNAME%

-

-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.

-set DEFAULT_JVM_OPTS=

-

-@rem Find java.exe

-if defined JAVA_HOME goto findJavaFromJavaHome

-

-set JAVA_EXE=java.exe

-%JAVA_EXE% -version >NUL 2>&1

-if "%ERRORLEVEL%" == "0" goto init

-

-echo.

-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

-echo.

-echo Please set the JAVA_HOME variable in your environment to match the

-echo location of your Java installation.

-

-goto fail

-

-:findJavaFromJavaHome

-set JAVA_HOME=%JAVA_HOME:"=%

-set JAVA_EXE=%JAVA_HOME%/bin/java.exe

-

-if exist "%JAVA_EXE%" goto init

-

-echo.

-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%

-echo.

-echo Please set the JAVA_HOME variable in your environment to match the

-echo location of your Java installation.

-

-goto fail

-

-:init

-@rem Get command-line arguments, handling Windows variants

-

-if not "%OS%" == "Windows_NT" goto win9xME_args

-

-:win9xME_args

-@rem Slurp the command line arguments.

-set CMD_LINE_ARGS=

-set _SKIP=2

-

-:win9xME_args_slurp

-if "x%~1" == "x" goto execute

-

-set CMD_LINE_ARGS=%*

-

-:execute

-@rem Setup the command line

-

-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

-

-@rem Execute Gradle

-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

-

-:end

-@rem End local scope for the variables with windows NT shell

-if "%ERRORLEVEL%"=="0" goto mainEnd

-

-:fail

-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of

-rem the _cmd.exe /c_ return code!

-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1

-exit /b 1

-

-:mainEnd

-if "%OS%"=="Windows_NT" endlocal

-

-:omega

+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/openwhisk/_test/bc.sh b/openwhisk/_test/bc.sh
index ff78878..64c4b53 100755
--- a/openwhisk/_test/bc.sh
+++ b/openwhisk/_test/bc.sh
@@ -1,3 +1,19 @@
 #!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 bc -q >&3
 
diff --git a/openwhisk/_test/build.sh b/openwhisk/_test/build.sh
index 1b40bd9..27a3a7d 100755
--- a/openwhisk/_test/build.sh
+++ b/openwhisk/_test/build.sh
@@ -19,30 +19,37 @@
 cd "$(dirname $0)"
 
 function build {
-  if ! test -e $1
-  then cp $1.src $1.go
-       GOARCH=amd64 GOOS=linux go build -a -o $1 $1.go
-       rm $1.go
-  fi
+   if test -e $1
+   then return
+   fi
+   cp $1.src $1.go
+   go build -a -o $1 $1.go
+   rm $1.go
 }
 
 function zipit {
-  if ! test -e $1
-  then
+    if test -e $1
+    then return
+    fi
     mkdir $$
     cp $2 $$/$3
     zip -q -j $1 $$/$3
     rm -rf $$
-  fi 
 }
 
+go get github.com/apache/incubator-openwhisk-runtime-go/openwhisk
+
 build exec
-test -e exec.zip || zip -q -r exec.zip exec etc dir
+rm exec.zip
+zip -q -r exec.zip exec etc dir
+
 build hi
 zipit hi.zip hi main
+
 build hello_message
 zipit hello_message.zip hello_message main
 zipit hello_message1.zip hello_message message
+
 build hello_greeting
 zipit hello_greeting.zip hello_greeting main
 zipit hello_greeting1.zip hello_greeting greeting
diff --git a/openwhisk/_test/exec.go b/openwhisk/_test/exec.go
deleted file mode 100644
index 35a2611..0000000
--- a/openwhisk/_test/exec.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-func main() {}
diff --git a/openwhisk/_test/hello.sh b/openwhisk/_test/hello.sh
index cc38507..214ce63 100755
--- a/openwhisk/_test/hello.sh
+++ b/openwhisk/_test/hello.sh
@@ -1,9 +1,25 @@
 #!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 while read line
 do
-   name="$(echo $line | jq -r .name)" 
+   name="$(echo $line | jq -r .name)"
    if [ "$name" == "*" ]
-   then echo "Goodbye!" >&2 
+   then echo "Goodbye!" >&2
         exit 0
    fi
    echo msg="hello $name"
diff --git a/openwhisk/_test/hi.src b/openwhisk/_test/hi.src
index 6a07be8..48147b3 100644
--- a/openwhisk/_test/hi.src
+++ b/openwhisk/_test/hi.src
@@ -17,8 +17,13 @@
 
 package main
 
-import "fmt"
+import (
+	"bufio"
+	"os"
+)
 
 func main() {
-	fmt.Println("hi")
+	f := bufio.NewWriter(os.Stdout)
+	defer f.Flush()
+	f.Write([]byte("hi\n"))
 }
diff --git a/openwhisk/_test/postcompile.sh b/openwhisk/_test/postcompile.sh
index 00415d0..85be6c7 100755
--- a/openwhisk/_test/postcompile.sh
+++ b/openwhisk/_test/postcompile.sh
@@ -1,6 +1,22 @@
 #!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 FILE=${1:?compiled file}
-file -i "$FILE"
+file --mime-type "$FILE"  | sed -e 's/x-mach-binary/x-executable/'
 echo '{"name":"Mike"}' | $FILE 3>/tmp/$$
 cat /tmp/$$
 rm /tmp/$$
diff --git a/openwhisk/_test/precompile.sh b/openwhisk/_test/precompile.sh
index 6e9c293..d2b5f01 100755
--- a/openwhisk/_test/precompile.sh
+++ b/openwhisk/_test/precompile.sh
@@ -1,4 +1,20 @@
 #!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 cd "$(dirname $0)"
 SRC=${1:?source}
 ID=${2:?numbe}
diff --git a/openwhisk/_test/zips.sh b/openwhisk/_test/zips.sh
index d212614..0c92e78 100755
--- a/openwhisk/_test/zips.sh
+++ b/openwhisk/_test/zips.sh
@@ -1,4 +1,20 @@
 #!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 cd "$(dirname $0)"
 rm action.zip 2>/dev/null
 zip -r -q action.zip action
diff --git a/openwhisk/actionProxy_linux_test.go b/openwhisk/actionProxy_linux_test.go
new file mode 100644
index 0000000..d131713
--- /dev/null
+++ b/openwhisk/actionProxy_linux_test.go
@@ -0,0 +1,71 @@
+// +build linux
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+This test depends on the fact the proxy can detect the termination
+of an executable that terminates before or after reading the output.
+On OSX command termination is not detected until some input is read.
+*/
+
+package openwhisk
+
+import (
+	"io/ioutil"
+	"os"
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestStartLatestAction(t *testing.T) {
+
+	// cleanup
+	os.RemoveAll("./action")
+	logf, _ := ioutil.TempFile("/tmp", "log")
+	ap := NewActionProxy("./action", "", logf)
+
+	// start an action that terminate immediately
+	buf := []byte("#!/bin/sh\ntrue\n")
+	ap.ExtractAction(&buf, "main")
+	ap.StartLatestAction("main")
+	assert.Nil(t, ap.theExecutor)
+
+	// start the action that emits 1
+	buf = []byte("#!/bin/sh\nwhile read a; do echo 1 >&3 ; done\n")
+	ap.ExtractAction(&buf, "main")
+	ap.StartLatestAction("main")
+	ap.theExecutor.io <- "x"
+	assert.Equal(t, <-ap.theExecutor.io, "1")
+
+	// now start an action that terminate immediately
+	buf = []byte("#!/bin/sh\ntrue\n")
+	ap.ExtractAction(&buf, "main")
+	ap.StartLatestAction("main")
+	ap.theExecutor.io <- "y"
+	assert.Equal(t, <-ap.theExecutor.io, "1")
+
+	// start the action that emits 2
+	buf = []byte("#!/bin/sh\nwhile read a; do echo 2 >&3 ; done\n")
+	ap.ExtractAction(&buf, "main")
+	ap.StartLatestAction("main")
+	ap.theExecutor.io <- "z"
+	assert.Equal(t, <-ap.theExecutor.io, "2")
+	/**/
+	ap.theExecutor.Stop()
+}
diff --git a/openwhisk/actionProxy_test.go b/openwhisk/actionProxy_test.go
index 047cced..e639edb 100644
--- a/openwhisk/actionProxy_test.go
+++ b/openwhisk/actionProxy_test.go
@@ -19,11 +19,6 @@
 
 import (
 	"fmt"
-	"io/ioutil"
-	"os"
-	"testing"
-
-	"github.com/stretchr/testify/assert"
 )
 
 func Example_startTestServer() {
@@ -43,40 +38,3 @@
 	// {"error":"no action defined yet"}
 	// {"error":"Error unmarshaling request: invalid character 'X' looking for beginning of value"}
 }
-
-func TestStartLatestAction(t *testing.T) {
-
-	// cleanup
-	os.RemoveAll("./action")
-	log, _ := ioutil.TempFile("", "log")
-	ap := NewActionProxy("./action", "", log)
-
-	// start an action that terminate immediately
-	buf := []byte("#!/bin/sh\ntrue\n")
-	ap.ExtractAction(&buf, "main")
-	ap.StartLatestAction("main")
-	assert.Nil(t, ap.theExecutor)
-
-	// start the action that emits 1
-	buf = []byte("#!/bin/sh\nwhile read a; do echo 1 >&3 ; done\n")
-	ap.ExtractAction(&buf, "main")
-	ap.StartLatestAction("main")
-	ap.theExecutor.io <- "x"
-	assert.Equal(t, <-ap.theExecutor.io, "1")
-
-	// now start an action that terminate immediately
-	buf = []byte("#!/bin/sh\ntrue\n")
-	ap.ExtractAction(&buf, "main")
-	ap.StartLatestAction("main")
-	ap.theExecutor.io <- "y"
-	assert.Equal(t, <-ap.theExecutor.io, "1")
-
-	// start the action that emits 2
-	buf = []byte("#!/bin/sh\nwhile read a; do echo 2 >&3 ; done\n")
-	ap.ExtractAction(&buf, "main")
-	ap.StartLatestAction("main")
-	ap.theExecutor.io <- "z"
-	assert.Equal(t, <-ap.theExecutor.io, "2")
-	/**/
-	ap.theExecutor.Stop()
-}
diff --git a/openwhisk/compiler.go b/openwhisk/compiler.go
index 49e30de..bd3e879 100644
--- a/openwhisk/compiler.go
+++ b/openwhisk/compiler.go
@@ -23,13 +23,22 @@
 	"log"
 	"os"
 	"os/exec"
+	"runtime"
 
 	"github.com/h2non/filetype"
 )
 
+// this is only to let test run on OSX
+// it only recognizes OSX Mach 64 bit executable
+// (magic number: facefeed + 64bit flag)
+var mach64Type = filetype.NewType("mach", "darwin/mach")
+
+func mach64Matcher(buf []byte) bool {
+	return len(buf) > 4 && buf[0] == 0xcf && buf[1] == 0xfa && buf[2] == 0xed && buf[3] == 0xfe
+}
+
 // check if the file is already compiled
 // if the file is a directoy look for a file with the given name
-
 func isCompiled(fileOrDir string, name string) bool {
 	fi, err := os.Stat(fileOrDir)
 	if err != nil {
@@ -41,13 +50,18 @@
 		file = fmt.Sprintf("%s/%s", fileOrDir, name)
 	}
 
-	log.Printf("isCompiled: %s", file)
 	buf, err := ioutil.ReadFile(file)
 	if err != nil {
 		log.Println(err)
 		return false
 	}
+	// if a mac add a matched for mac
+	if runtime.GOOS == "darwin" {
+		filetype.AddMatcher(mach64Type, mach64Matcher)
+	}
+
 	kind, err := filetype.Match(buf)
+	log.Printf("isCompiled: %s kind=%s", file, kind)
 	if err != nil {
 		log.Println(err)
 		return false
@@ -55,6 +69,9 @@
 	if kind.Extension == "elf" {
 		return true
 	}
+	if kind.Extension == "mach" {
+		return true
+	}
 	return false
 }
 
diff --git a/openwhisk/compiler_test.go b/openwhisk/compiler_test.go
index d6a0f7a..72ed95e 100644
--- a/openwhisk/compiler_test.go
+++ b/openwhisk/compiler_test.go
@@ -32,6 +32,27 @@
 	// exit status 1
 }*/
 
+/**
+
+Note to understand tests:
+- tests are run from the openwhisk as the current directory
+- compiler (../../common/gobuild.sh) takes 3 arguments:
+   <main> <source-dir-or-file> <target-dir>
+
+ You create a proxy (NewActionProxy) with the target dir
+ then invoke compilation with the source dir (implicit is 'main' as the function)
+
+ You can test if compilation works with
+
+   cd openwhisk
+   ../common/gobuild.sh main _test/compile/c/exe ./action/c
+
+   _test/precompile.sh simply copies files to test folder
+   _test/postcompile.sh simply checks if the file is compiled
+
+
+*/
+
 func Example_isCompiled() {
 	sys("_test/precompile.sh", "hello.src", "c")
 	file := abs("./_test/compile/c/exec")
@@ -66,7 +87,7 @@
 	sys("_test/postcompile.sh", "_test/compile/1/exec")
 	// Output:
 	// <nil>
-	// _test/compile/1/exec: application/x-executable; charset=binary
+	// _test/compile/1/exec: application/x-executable
 	// name=Mike
 	// {"message":"Hello, Mike!"}
 }
@@ -79,7 +100,7 @@
 	sys("_test/postcompile.sh", "_test/output/1a/main")
 	// Output:
 	// <nil>
-	// _test/output/1a/main: application/x-executable; charset=binary
+	// _test/output/1a/main: application/x-executable
 	// name=Mike
 	// {"message":"Hello, Mike!"}
 }
@@ -92,7 +113,7 @@
 	sys("_test/postcompile.sh", "_test/compile/2/exec")
 	// Output:
 	// <nil>
-	// _test/compile/2/exec: application/x-executable; charset=binary
+	// _test/compile/2/exec: application/x-executable
 	// name=Mike
 	// {"hello":"Hello, Mike!"}
 }
@@ -105,7 +126,7 @@
 	sys("_test/postcompile.sh", "_test/output/2a/hello")
 	// Output:
 	// <nil>
-	// _test/output/2a/hello: application/x-executable; charset=binary
+	// _test/output/2a/hello: application/x-executable
 	// name=Mike
 	// {"hello":"Hello, Mike!"}
 }
@@ -118,7 +139,7 @@
 	sys("_test/postcompile.sh", "_test/compile/3/main")
 	// Output:
 	// <nil>
-	// _test/compile/3/main: application/x-executable; charset=binary
+	// _test/compile/3/main: application/x-executable
 	// Main:
 	// Hello, Mike
 	// {"greetings":"Hello, Mike"}
@@ -132,7 +153,7 @@
 	sys("_test/postcompile.sh", "_test/output/3a/main")
 	// Output:
 	// <nil>
-	// _test/output/3a/main: application/x-executable; charset=binary
+	// _test/output/3a/main: application/x-executable
 	// Main:
 	// Hello, Mike
 	// {"greetings":"Hello, Mike"}
@@ -146,7 +167,7 @@
 	sys("_test/postcompile.sh", "_test/compile/4/hello")
 	// Output:
 	// <nil>
-	// _test/compile/4/hello: application/x-executable; charset=binary
+	// _test/compile/4/hello: application/x-executable
 	// Hello, Mike
 	// {"greetings":"Hello, Mike"}
 }
@@ -159,7 +180,7 @@
 	sys("_test/postcompile.sh", "_test/output/4a/hello")
 	// Output:
 	// <nil>
-	// _test/output/4a/hello: application/x-executable; charset=binary
+	// _test/output/4a/hello: application/x-executable
 	// Hello, Mike
 	// {"greetings":"Hello, Mike"}
 }
diff --git a/openwhisk/extractor_test.go b/openwhisk/extractor_test.go
index 6414120..9fc3476 100644
--- a/openwhisk/extractor_test.go
+++ b/openwhisk/extractor_test.go
@@ -18,45 +18,16 @@
 package openwhisk
 
 import (
-	"fmt"
 	"io/ioutil"
-	"log"
 	"os"
-	"os/exec"
 	"testing"
 
-	"github.com/h2non/filetype"
 	"github.com/stretchr/testify/assert"
 )
 
-func sys(cli string, args ...string) {
-	os.Chmod(cli, 0755)
-	cmd := exec.Command(cli, args...)
-	out, err := cmd.CombinedOutput()
-	if err != nil {
-		log.Print(err)
-	} else {
-		fmt.Print(string(out))
-	}
-}
-
-func exists(dir, filename string) error {
-	path := fmt.Sprintf("%s/%d/%s", dir, highestDir(dir), filename)
-	_, err := os.Stat(path)
-	return err
-}
-
-func detect(dir, filename string) string {
-	path := fmt.Sprintf("%s/%d/%s", dir, highestDir(dir), filename)
-	file, _ := ioutil.ReadFile(path)
-	kind, _ := filetype.Match(file)
-	return kind.Extension
-}
-
 func TestExtractActionTest_exec(t *testing.T) {
 	log, _ := ioutil.TempFile("", "log")
 	ap := NewActionProxy("./action/x1", "", log)
-	sys("_test/build.sh")
 	// cleanup
 	assert.Nil(t, os.RemoveAll("./action/x1"))
 	file, _ := ioutil.ReadFile("_test/exec")
@@ -67,7 +38,6 @@
 func TestExtractActionTest_exe(t *testing.T) {
 	log, _ := ioutil.TempFile("", "log")
 	ap := NewActionProxy("./action/x2", "", log)
-	sys("_test/build.sh")
 	// cleanup
 	assert.Nil(t, os.RemoveAll("./action/x2"))
 	// match  exe
@@ -78,7 +48,6 @@
 
 func TestExtractActionTest_zip(t *testing.T) {
 	log, _ := ioutil.TempFile("", "log")
-	sys("_test/build.sh")
 	ap := NewActionProxy("./action/x3", "", log)
 	// cleanup
 	assert.Nil(t, os.RemoveAll("./action/x3"))
diff --git a/openwhisk/initHandler_linux_test.go b/openwhisk/initHandler_linux_test.go
new file mode 100644
index 0000000..0d40a38
--- /dev/null
+++ b/openwhisk/initHandler_linux_test.go
@@ -0,0 +1,44 @@
+// +build linux
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+This test depends on the fact the proxy can detect the termination
+of an executable that terminates before or after reading the output.
+On OSX command termination is not detected until some input is read.
+*/
+package openwhisk
+
+func Example_badinit_nocompiler() {
+	ts, cur, log := startTestServer("")
+	doRun(ts, "")
+	doInit(ts, "{}")
+	//sys("ls", "_test/exec")
+	doInit(ts, initBinary("_test/exec", ""))      // empty
+	doInit(ts, initBinary("_test/hi", ""))        // say hi
+	doInit(ts, initBinary("_test/hello.src", "")) // source not excutable
+	doRun(ts, "")
+	stopTestServer(ts, cur, log)
+	// Output:
+	// 400 {"error":"no action defined yet"}
+	// 200 {"ok":true}
+	// 400 {"error":"cannot start action: command exited"}
+	// 400 {"error":"cannot start action: command exited"}
+	// 400 {"error":"cannot start action: command exited"}
+	// 400 {"error":"no action defined yet"}
+}
diff --git a/openwhisk/initHandler_test.go b/openwhisk/initHandler_test.go
index 0634dd4..aaf30db 100644
--- a/openwhisk/initHandler_test.go
+++ b/openwhisk/initHandler_test.go
@@ -17,32 +17,32 @@
 
 package openwhisk
 
-import "path/filepath"
+import (
+	"fmt"
+	"path/filepath"
+)
 
-func Example_badinit_nocompiler() {
-	ts, cur, log := startTestServer("")
-	sys("_test/build.sh")
-	doRun(ts, "")
-	doInit(ts, "{}")
-	//sys("ls", "_test/exec")
-	doInit(ts, initBinary("_test/exec", ""))      // empty
-	doInit(ts, initBinary("_test/hi", ""))        // say hi
-	doInit(ts, initBinary("_test/hello.src", "")) // source not excutable
-	doRun(ts, "")
-	stopTestServer(ts, cur, log)
+/**
+The _test/build.sh script builds some binaries that are used to actually run tests.
+Tests basically submit various binaries to the handler, simulating the init of the runtime.
+**/
+
+func Example_json_init() {
+	fmt.Println(initCode("", ""))
+	fmt.Println(initCode("_test/etc", ""))
+	fmt.Println(initCode("_test/etc", "world"))
+	fmt.Println(initBinary("_test/etc", ""))
+	fmt.Println(initBinary("_test/etc", "hello"))
 	// Output:
-	// 400 {"error":"no action defined yet"}
-	// 200 {"ok":true}
-	// 400 {"error":"cannot start action: command exited"}
-	// 400 {"error":"cannot start action: command exited"}
-	// 400 {"error":"cannot start action: command exited"}
-	// 400 {"error":"no action defined yet"}
-
+	// {"value":{}}
+	// {"value":{"code":"1\n"}}
+	// {"value":{"code":"1\n","main":"world"}}
+	// {"value":{"code":"MQo=","binary":true}}
+	// {"value":{"code":"MQo=","binary":true,"main":"hello"}}
 }
 
 func Example_bininit_nocompiler() {
 	ts, cur, log := startTestServer("")
-	sys("_test/build.sh")
 	doRun(ts, "")
 	doInit(ts, initBinary("_test/hello_message", ""))
 	doRun(ts, "")
@@ -65,7 +65,6 @@
 
 func Example_zipinit_nocompiler() {
 	ts, cur, log := startTestServer("")
-	sys("_test/build.sh")
 	doRun(ts, "")
 	doInit(ts, initBinary("_test/hello_greeting.zip", ""))
 	doRun(ts, "")
@@ -86,7 +85,7 @@
 	// XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX
 }
 
-/* commented out test for timing problems
+/* commented out test for timing problems*/
 func Example_shell_nocompiler() {
 	ts, cur, log := startTestServer("")
 	doRun(ts, "")
@@ -105,11 +104,10 @@
 	// XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX
 	// Goodbye!
 	// XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX
-}*/
+} /**/
 
 func Example_main_nocompiler() {
 	ts, cur, log := startTestServer("")
-	sys("_test/build.sh")
 	doRun(ts, "")
 	doInit(ts, initBinary("_test/hello_message", "message"))
 	doRun(ts, "")
@@ -132,7 +130,6 @@
 
 func Example_main_zipinit_nocompiler() {
 	ts, cur, log := startTestServer("")
-	sys("_test/build.sh")
 	doRun(ts, "")
 	doInit(ts, initBinary("_test/hello_greeting.zip", "greeting"))
 	doInit(ts, initBinary("_test/hello_greeting1.zip", "greeting"))
@@ -160,7 +157,6 @@
 func Example_compile_simple() {
 	comp, _ := filepath.Abs("../common/gobuild.sh")
 	ts, cur, log := startTestServer(comp)
-	sys("_test/build.sh")
 	doRun(ts, "")
 	doInit(ts, initCode("_test/hello.src", ""))
 	doRun(ts, "")
@@ -194,7 +190,6 @@
 }
 
 func Example_compile_withZipSrc() {
-	sys("_test/zips.sh")
 	comp, _ := filepath.Abs("../common/gobuild.sh")
 	ts, cur, log := startTestServer(comp)
 	doRun(ts, "")
diff --git a/openwhisk/util_test.go b/openwhisk/util_test.go
index 6eea7af..18110be 100644
--- a/openwhisk/util_test.go
+++ b/openwhisk/util_test.go
@@ -27,9 +27,13 @@
 	"net/http"
 	"net/http/httptest"
 	"os"
+	"os/exec"
 	"path/filepath"
 	"runtime"
+	"testing"
 	"time"
+
+	"github.com/h2non/filetype"
 )
 
 func startTestServer(compiler string) (*httptest.Server, string, *os.File) {
@@ -118,20 +122,6 @@
 	return out
 }
 
-func Example_json_init() {
-	fmt.Println(initCode("", ""))
-	fmt.Println(initCode("_test/etc", ""))
-	fmt.Println(initCode("_test/etc", "world"))
-	fmt.Println(initBinary("_test/etc", ""))
-	fmt.Println(initBinary("_test/etc", "hello"))
-	// Output:
-	// {"value":{}}
-	// {"value":{"code":"1\n"}}
-	// {"value":{"code":"1\n","main":"world"}}
-	// {"value":{"code":"MQo=","binary":true}}
-	// {"value":{"code":"MQo=","binary":true,"main":"hello"}}
-}
-
 func dump(file *os.File) {
 	//file.Read()
 	buf, _ := ioutil.ReadFile(file.Name())
@@ -139,3 +129,42 @@
 	//fmt.Print(file.ReadAll())
 	os.Remove(file.Name())
 }
+
+func sys(cli string, args ...string) {
+	os.Chmod(cli, 0755)
+	cmd := exec.Command(cli, args...)
+	out, err := cmd.CombinedOutput()
+	if err != nil {
+		log.Print(err)
+	} else {
+		fmt.Print(string(out))
+	}
+}
+
+func exists(dir, filename string) error {
+	path := fmt.Sprintf("%s/%d/%s", dir, highestDir(dir), filename)
+	_, err := os.Stat(path)
+	return err
+}
+
+// definig a type to recognizing also mac executables
+var pseudoElfForMacType = filetype.NewType("elf", "darwin/mach")
+
+func pseudoElfForMacMatcher(buf []byte) bool {
+	return len(buf) > 4 && buf[0] == 0xcf && buf[1] == 0xfa && buf[2] == 0xed && buf[3] == 0xfe
+}
+
+func detect(dir, filename string) string {
+	path := fmt.Sprintf("%s/%d/%s", dir, highestDir(dir), filename)
+	file, _ := ioutil.ReadFile(path)
+	filetype.AddMatcher(pseudoElfForMacType, pseudoElfForMacMatcher)
+	kind, _ := filetype.Match(file)
+	return kind.Extension
+}
+
+func TestMain(m *testing.M) {
+	sys("_test/build.sh")
+	sys("_test/zips.sh")
+	code := m.Run()
+	os.Exit(code)
+}
diff --git a/test/NOTES.md b/test/NOTES.md
index 462b814..4d57316 100644
--- a/test/NOTES.md
+++ b/test/NOTES.md
@@ -1,24 +1,25 @@
-
 <!--
 #
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-# license agreements.  See the NOTICE file distributed with this work for additional 
-# information regarding copyright ownership.  The ASF licenses this file to you
-# under the Apache License, Version 2.0 (the # "License"); you may not use this 
-# file except in compliance with the License.  You may obtain a copy of the License 
-# at:
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
 #
-# http://www.apache.org/licenses/LICENSE-2.0
+#     http://www.apache.org/licenses/LICENSE-2.0
 #
-# Unless required by applicable law or agreed to in writing, software distributed 
-# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
-# CONDITIONS OF ANY KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 -->
-This is an optional command line test kit. 
 
-It has been superseded by a go test suite and scalatests, 
+This is an optional command line test kit.
+
+It has been superseded by a go test suite and scalatests,
 but it is still around for debugging.
 
 
@@ -29,7 +30,7 @@
 
 also you can start directly the binary without the images with
 
-- `./start.sh` 
+- `./start.sh`
 - or `COMPILER=../common/gobuild.sh ./start.sh`
 
 If you start them,  images won't be started by the test.
diff --git a/test/etc/hello.sh b/test/etc/hello.sh
index 13771b8..dc4d760 100755
--- a/test/etc/hello.sh
+++ b/test/etc/hello.sh
@@ -21,7 +21,7 @@
    if test "$name" == ""
    then exit
    fi
-   echo "name=$name" 
+   echo "name=$name"
    hello="Hello, $name"
    echo '{"hello":"'$hello'"}' >&3
 done
diff --git a/test/start.sh b/test/start.sh
index 6f574ce..efbb953 100755
--- a/test/start.sh
+++ b/test/start.sh
@@ -19,14 +19,14 @@
 then exit 0
 fi
 cd "$(dirname $0)"
-bin/build.sh src/hello_greeting.go 
-bin/build.sh src/hello_message.go 
+bin/build.sh src/hello_greeting.go
+bin/build.sh src/hello_message.go
 bin/build.sh src/empty.go
 bin/build.sh src/hi.go
 zip -j zip/hello_message1.zip bin/hello_message
 rm -Rvf action
 mkdir action
 if test -n "$1"
-then docker run --name=goproxy -p 8080:8080 -d "$@" 
+then docker run --name=goproxy -p 8080:8080 -d "$@"
 else go run ../main/proxy.go -debug
 fi
diff --git a/tools/travis/setup.sh b/tools/travis/setup.sh
index b039213..17e7285 100755
--- a/tools/travis/setup.sh
+++ b/tools/travis/setup.sh
@@ -28,3 +28,5 @@
 cd $HOMEDIR
 git clone https://github.com/apache/incubator-openwhisk-utilities.git
 
+# add realpath
+sudo apt-get -y update && sudo apt-get -y install realpath