Skip to content
This repository was archived by the owner on Jun 25, 2023. It is now read-only.

Commit 7472ff8

Browse files
committed
Add -r option to rm, prevents prompt when deleting temporary files;
Modify to support ubuntu
1 parent 15be0b2 commit 7472ff8

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

sss_valgrind_android.sh

+13-14
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ install_valgrind() {
2121
fi
2222
echo "DEVICE_CPU_TYPE: $DEVICE_CPU_TYPE"
2323

24-
rm -r ./Inst
24+
rm -rf ./Inst
2525
echo "Unzip valgrind package..."
2626
case $DEVICE_CPU_TYPE in
2727
"ARMv7")
@@ -32,7 +32,7 @@ install_valgrind() {
3232
;;
3333
esac
3434
if [[ $? -ne 0 ]]; then
35-
rm -r ./Inst
35+
rm -rf ./Inst
3636
echo "FAIL! Can not unzip valgrind package."
3737
exit 1
3838
fi
@@ -43,18 +43,18 @@ install_valgrind() {
4343
echo "You can try to move the `pwd`/Inst/data/local/Inst to /data/local manually."
4444
exit 1
4545
else
46-
rm -r ./Inst
46+
rm -rf ./Inst
4747
fi
4848

4949
echo "DONE, install valgrind success!"
5050
}
5151

5252
input_parameter() {
5353
if [[ ! -e .sss_last_input ]]; then
54-
PACKAGE_NAME="com.sunshushu.test"
55-
APP_MAIN_ACTIVITY="MainActivity"
56-
SYMBOLIZED_LIB_PATH="`pwd`/valgrind_test/app/build/intermediates/cmake/debug/obj/armeabi-v7a"
57-
echo -e "${PACKAGE_NAME}\n${APP_MAIN_ACTIVITY}\n${SYMBOLIZED_LIB_PATH}" > .sss_last_input
54+
PACKAGE_NAME="com.sunshushu.test"
55+
APP_MAIN_ACTIVITY="MainActivity"
56+
SYMBOLIZED_LIB_PATH="`pwd`/valgrind_test/app/build/intermediates/cmake/debug/obj/armeabi-v7a"
57+
echo -e "${PACKAGE_NAME}\n${APP_MAIN_ACTIVITY}\n${SYMBOLIZED_LIB_PATH}" > .sss_last_input
5858
fi
5959

6060
echo "Type valgrind parameter, nullable."
@@ -82,7 +82,7 @@ input_parameter() {
8282
echo "Ensure adb is installed and device is pluged!"
8383
continue
8484
fi
85-
echo "$ALL_PACKAGES" | grep -q "package:${PACKAGE_NAME}\r"
85+
echo "$ALL_PACKAGES" | grep -q "package:${PACKAGE_NAME}"
8686
if [[ $? -ne 0 ]]; then
8787
echo "There is no specified app on the device, try again."
8888
continue
@@ -130,11 +130,11 @@ exec /data/local/Inst/bin/valgrind \$VGPARAMS \$* "
130130

131131
adb push start_valgrind.sh /data/local/
132132
if [ $? -ne 0 ]; then
133-
rm ./start_valgrind.sh
133+
rm -f ./start_valgrind.sh
134134
echo "FAIL! Ensure adb is installed and device is pluged!"
135135
exit 1
136136
fi
137-
rm ./start_valgrind.sh
137+
rm -f ./start_valgrind.sh
138138

139139
adb shell chmod 777 /data/local/start_valgrind.sh
140140
if [ $? -ne 0 ]; then
@@ -159,7 +159,7 @@ launch_valgrind() {
159159
adb root
160160
echo -e "setprop wrap.$PACKAGE_NAME \"$LOG_WRAPPER\"\n exit" > .temp
161161
adb shell < .temp
162-
rm ./.temp
162+
rm -f ./.temp
163163
GETPROP=`adb shell getprop wrap.$PACKAGE_NAME | tr -d "\r"`
164164
if [[ $LOG_WRAPPER != $GETPROP ]]; then
165165
echo -e "FAIL! Can not set device system property. Ensure the device can execute \"adb shell setprop\"."
@@ -189,7 +189,7 @@ wait_and_terminate_app() {
189189
else
190190
echo -e "setprop wrap.$PACKAGE_NAME \"\"\n exit" > .temp
191191
adb shell < .temp
192-
rm ./.temp
192+
rm -f ./.temp
193193
break
194194
fi
195195
done
@@ -212,11 +212,10 @@ pull_logs() {
212212
fi
213213
done
214214

215-
adb shell rm /sdcard/valgrind.*.log
215+
adb shell rm -f /sdcard/valgrind.*.log
216216
echo "DONE. Check the log(s) in `pwd`"
217217
}
218218

219-
220219
if [[ $# -eq 0 ]]; then
221220
input_parameter
222221
else

0 commit comments

Comments
 (0)