From c73b46f40a3e47ed9989cf1c9681901572b508be Mon Sep 17 00:00:00 2001
From: Yohei Yukawa <yukawa@google.com>
Date: Wed, 2 Apr 2014 19:46:05 +0900
Subject: [PATCH] Do not call exit 1 when loaded with source command

BUG: 13754552
Change-Id: I3d5e4c0786547521325405100c175dd1b21754df
---
 native/jni/run-tests.sh                   | 2 +-
 tools/dicttool/tests/etc/test-dicttool.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/native/jni/run-tests.sh b/native/jni/run-tests.sh
index 898ea1610d..5b60e0d65d 100755
--- a/native/jni/run-tests.sh
+++ b/native/jni/run-tests.sh
@@ -18,7 +18,7 @@ echo "Usage:" 1>&2
 echo "    source $0" 1>&2
 echo "  or" 1>&2
 echo "    . $0" 1>&2
-exit 1
+if [[ ${BASH_SOURCE[0]} != $0 ]]; then return; else exit 1; fi
 fi
 
 pushd $PWD > /dev/null
diff --git a/tools/dicttool/tests/etc/test-dicttool.sh b/tools/dicttool/tests/etc/test-dicttool.sh
index 5eb44fc855..f96db68167 100755
--- a/tools/dicttool/tests/etc/test-dicttool.sh
+++ b/tools/dicttool/tests/etc/test-dicttool.sh
@@ -18,7 +18,7 @@ echo "Usage:" 1>&2
 echo "    source $0" 1>&2
 echo "  or" 1>&2
 echo "    . $0" 1>&2
-exit 1
+if [[ ${BASH_SOURCE[0]} != $0 ]]; then return; else exit 1; fi
 fi
 
 find out -name "dicttool_aosp*" -exec rm -rf {} \; > /dev/null 2>&1
-- 
GitLab