Make a host version of acc for testing.

Don't run the code we've compiled unless the -R option is present.
diff --git a/libacc/tests/Android.mk b/libacc/tests/Android.mk
index 2cff9d3..1e4d328 100644
--- a/libacc/tests/Android.mk
+++ b/libacc/tests/Android.mk
@@ -1,5 +1,9 @@
 LOCAL_PATH:= $(call my-dir)
+
+# Executable for host
+# ========================================================
 include $(CLEAR_VARS)
+LOCAL_MODULE:= acc
 
 LOCAL_SRC_FILES:= \
 	main.cpp
@@ -7,9 +11,22 @@
 LOCAL_SHARED_LIBRARIES := \
     libacc
 
+LOCAL_MODULE_TAGS := tests
+
+include $(BUILD_HOST_EXECUTABLE)
+
+# Executable for target
+# ========================================================
+include $(CLEAR_VARS)
 LOCAL_MODULE:= acc
 
+LOCAL_SRC_FILES:= \
+	main.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+    libacc
+
+
 LOCAL_MODULE_TAGS := tests
 
-include $(BUILD_EXECUTABLE)
-
+include $(BUILD_EXECUTABLE)
\ No newline at end of file
diff --git a/libacc/tests/data/returnval-ansi.c b/libacc/tests/data/returnval-ansi.c
index 42802c5..e386009 100644
--- a/libacc/tests/data/returnval-ansi.c
+++ b/libacc/tests/data/returnval-ansi.c
@@ -1,7 +1,10 @@
+#define VALUE (2*FOO)
+#define FOO 12
+
 int main(int argc, char** argv) {
   return f();
 }
 
 int f() {
-    return 10;
+    return VALUE;
 }
diff --git a/libacc/tests/main.cpp b/libacc/tests/main.cpp
index acee09d..d624cbb 100644
--- a/libacc/tests/main.cpp
+++ b/libacc/tests/main.cpp
@@ -32,6 +32,7 @@
 int main(int argc, char** argv) {
     const char* inFile = NULL;
     bool printListing;
+    bool runResults = false;
     FILE* in = stdin;
     int i;
     for (i = 1; i < argc; i++) {
@@ -41,6 +42,9 @@
                 case 'S':
                     printListing = true;
                     break;
+                case 'R':
+                    runResults = true;
+                    break;
             default:
                 fprintf(stderr, "Unrecognized flag %s\n", arg);
                 return 3;
@@ -108,7 +112,7 @@
     accGetScriptLabel(script, "main", (ACCvoid**) & mainPointer);
 
     result = accGetError(script);
-    if (result == ACC_NO_ERROR) {
+    if (result == ACC_NO_ERROR && runResults) {
         fprintf(stderr, "Executing compiled code:\n");
         int codeArgc = argc - i + 1;
         char** codeArgv = argv + i - 1;
diff --git a/libacc/tests/testarm b/libacc/tests/testarm
index 24fbc42..1d4b866 100755
--- a/libacc/tests/testarm
+++ b/libacc/tests/testarm
@@ -6,4 +6,4 @@
 mm -j8
 cd tests
 adb sync
-adb shell /system/bin/acc -S /system/bin/returnval-ansi.c
+adb shell /system/bin/acc -R -S /system/bin/returnval-ansi.c
diff --git a/libacc/tests/testlocal b/libacc/tests/testlocal
index ccabf7d..2989e11 100755
--- a/libacc/tests/testlocal
+++ b/libacc/tests/testlocal
@@ -1,17 +1,18 @@
-#!/bin/sh
-rm -f test-acc
-cd ..
-g++ -I../include acc.cpp disassem.cpp tests/main.cpp -g -ldl -o tests/test-acc
-cd tests
-if [ -x "test-acc" ]; then
-  ./test-acc -S data/returnval-ansi.c
+#!/bin/bash
 
-  if [ "$(uname)" = "Linux" ]; then
-    if [ "$(uname -m)" = "i686" ]; then
-      echo "Linux i686. Testing otcc-ansi.c"
-      ./test-acc data/otcc-ansi.c data/returnval.c
-      echo "Linux i686. Testing otcc-ansi.c data/otcc.c"
-      ./test-acc data/otcc-ansi.c data/otcc.c data/returnval.c
-    fi
-  fi
+SCRIPT_DIR=`dirname $BASH_SOURCE`
+DATA=$SCRIPT_DIR/data
+
+echo "Compiling returnval-ansi.c"
+acc -S $DATA/returnval-ansi.c
+
+echo "Compiling whole compiler."
+acc -S "$DATA/otcc-ansi.c"
+
+if (( "$(uname)" = "Linux" )) && (( "$(uname -m)" = "i686" )); then
+	echo "Linux i686. Testing otcc-ansi.c"
+	acc -R "$DATA/otcc-ansi.c" "$DATA/returnval.c"
+	acc -R $DATA/otcc-ansi.c $DATA/otcc.c $DATA/returnval.c
 fi
+
+echo "Done with tests."