1. 程式人生 > 其它 >檢測sd卡某個檔案,然後開啟自動化測試

檢測sd卡某個檔案,然後開啟自動化測試

1.判斷sd卡是否存在
2.若存在sd卡,只find一次,若存在,則進入測試,無,則退出指令碼測試。
3.若一直無sd卡,有個超時,自動退出。

參考指令碼如下:
`#!/bin/sh

find_file=0
time_cnt=0
while [ 1 ]; do
mountpoint /record
is_exist_sd=$?
if [ $is_exist_sd != 0 ];then
echo "wait mount"
else
find_file=$( find /record/.txt -name screen_test.txt | wc -l )
#echo $find_file
if [ $find_file -gt 0 ]
then
echo "find screen_test.txt"
break
fi
find_file=$( find /media/mmcblk0p1/

.txt -name screen_test.txt | wc -l )
#echo $find_file
if [ $find_file -gt 0 ]
then
echo "find screen_test.txt"
break
fi
echo "not find screen_test.txt"
exit
fi
sleep 1
time_cnt=expr $time_cnt + 1
if [ $time_cnt -gt 15 ]
then
echo "find screen_test.txt timeout"
exit
fi
done

while [ 1 ]; do
echo "red"
rtcmd run display_test --out 1280 720 --fps 100 --color 75 86 253
sleep 2
rtcmd exit display_test
sleep 1
echo "green"
rtcmd run display_test --out 1280 720 --fps 100 --color 150 44 21
sleep 2
rtcmd exit display_test
sleep 1
echo "blue"
rtcmd run display_test --out 1280 720 --fps 100 --color 29 254 107
sleep 2
rtcmd exit display_test
sleep 1

done`