From 3ea4d56ed4fa59a3c3c5c30a2cca2df623b6a560 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <enh@google.com>
Date: Wed, 8 Oct 2014 14:56:27 -0700
Subject: [PATCH] Use ln(1) rather than cp(1) to set up host /system for
 testing.

The trouble with cp is that if you're running a command directly (because
you're using gdb, say), you need to make sure you've copied the linker
and shell again if you've done a rebuild that caused a change there.

Change-Id: I312da30c0f92b515967e854e0faba272c961ecc7
---
 tests/Android.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/Android.mk b/tests/Android.mk
index 13d90381c..f30a4a8f8 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -401,8 +401,8 @@ bionic-unit-tests-run-on-host: bionic-unit-tests $(TARGET_OUT_EXECUTABLES)/$(LIN
 	  sudo mkdir -p -m 0777 /system/bin; \
 	fi
 	mkdir -p $(TARGET_OUT_DATA)/local/tmp
-	cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin
-	cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
+	ln -fs `realpath $(TARGET_OUT_EXECUTABLES)/$(LINKER)` /system/bin
+	ln -fs `realpath $(TARGET_OUT_EXECUTABLES)/sh` /system/bin
 	ANDROID_DATA=$(TARGET_OUT_DATA) \
 	ANDROID_ROOT=$(TARGET_OUT) \
 	LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \
@@ -417,8 +417,8 @@ bionic-unit-tests-run-on-host32: bionic-unit-tests_32 $(TARGET_OUT_EXECUTABLES)/
 	  sudo mkdir -p -m 0777 /system/bin; \
 	fi
 	mkdir -p $(TARGET_OUT_DATA)/local/tmp
-	cp $(TARGET_OUT_EXECUTABLES)/linker /system/bin
-	cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
+	ln -fs `realpath $(TARGET_OUT_EXECUTABLES)/linker` /system/bin
+	ln -fs `realpath $(TARGET_OUT_EXECUTABLES)/sh` /system/bin
 	ANDROID_DATA=$(TARGET_OUT_DATA) \
 	ANDROID_ROOT=$(TARGET_OUT) \
 	LD_LIBRARY_PATH=$(2ND_TARGET_OUT_SHARED_LIBRARIES) \