OSDN Git Service

Fix darwin run-test problems
authorBrian Carlstrom <bdc@google.com>
Tue, 9 Sep 2014 04:37:39 +0000 (21:37 -0700)
committerBrian Carlstrom <bdc@google.com>
Tue, 9 Sep 2014 04:39:36 +0000 (21:39 -0700)
Bug: 17428908
Change-Id: Id74a0383fdae6753558e27cd447c1ca349819c91

test/etc/host-run-test-jar
test/run-test

index 2241f85..96344dd 100755 (executable)
@@ -164,7 +164,9 @@ if [ "$RELOCATE" = "y" ]; then
   # since we are relocating. Get the total size of the /system/framework directory
   # in 512 byte blocks and set it as the ulimit. This should be more than enough
   # room.
-  ulimit -S $(du -c -B512 ${ANDROID_ROOT}/framework | tail -1 | cut -f1) || exit 1
+  if [ ! `uname` = "Darwin" ]; then  # TODO: Darwin doesn't support "du -B..."
+    ulimit -S $(du -c -B512 ${ANDROID_ROOT}/framework | tail -1 | cut -f1) || exit 1
+  fi
 else
   FLAGS="${FLAGS} -Xnorelocate"
   COMPILER_FLAGS="${COMPILER_FLAGS} --runtime-arg -Xnorelocate --no-include-patch-information"
index 02b62b0..5d3cbac 100755 (executable)
@@ -200,9 +200,9 @@ done
 #
 # Cannot use realpath, as it does not exist on Mac.
 # Cannot us a simple "cd", as the path might not be created yet.
-# Use -m option of readlink: canonicalizes, but allows non-existing components.
-tmp_dir="`cd $oldwd ; readlink -m $tmp_dir`"
-
+# Cannot use readlink -m, as it does not exist on Mac.
+# Fallback to nuclear option:
+tmp_dir="`cd $oldwd ; python -c "import os; print os.path.realpath('$tmp_dir')"`"
 mkdir -p $tmp_dir
 
 if [ "$trace" = "true" ]; then