[pm-qa 01/10] factor out check_file function

Daniel Lezcano daniel.lezcano at linaro.org
Mon Oct 3 08:18:26 UTC 2011


Signed-off-by: Daniel Lezcano <daniel.lezcano at linaro.org
---
 include/functions.sh |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/functions.sh b/include/functions.sh
index 6702cb2..bff8e13 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -194,13 +194,20 @@ check() {
     return 0
 }
 
+check_file() {
+    local file=$1
+    local dir=$2
+
+    check "'$file' exists" "test -f" $dir/$file
+}
+
 check_cpufreq_files() {
 
     local dirpath=$CPU_PATH/$1/cpufreq
     shift 1
 
     for i in $@; do
-	check "$i exists" "test -f" $dirpath/$i  || return 1
+	check_file $i $dirpath || return 1
     done
 
     return 0
@@ -211,7 +218,7 @@ check_sched_mc_files() {
     local dirpath=$CPU_PATH
 
     for i in $@; do
-	check "$i exists" "test -f" $dirpath/$i  || return 1
+	check_file $i $dirpath || return 1
     done
 
     return 0
@@ -223,7 +230,7 @@ check_topology_files() {
     shift 1
 
     for i in $@; do
-	check "$i exists" "test -f" $dirpath/$i  || return 1
+	check_file $i $dirpath || return 1
     done
 
     return 0
-- 
1.7.1




More information about the linaro-dev mailing list