From 0d525fc060e9ff3b053d48ae970df2fc01d12325 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Fri, 9 Jan 2015 15:34:47 +0530 Subject: protect against multiple inclusion of scripts Signed-off-by: Viresh Kumar --- cpu.sh | 7 +++++++ cpufreq.sh | 7 +++++++ governor.sh | 7 +++++++ runme.sh | 7 +++++++ special-tests.sh | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/cpu.sh b/cpu.sh index b5b0620..ad8ed48 100755 --- a/cpu.sh +++ b/cpu.sh @@ -2,6 +2,13 @@ # # CPU helpers +# protect against multiple inclusion +if [ $FILE_CPU ]; then + return 0 +else + FILE_CPU=DONE +fi + source cpufreq.sh offline_cpu() diff --git a/cpufreq.sh b/cpufreq.sh index 2bb3f4e..e89e317 100755 --- a/cpufreq.sh +++ b/cpufreq.sh @@ -1,5 +1,12 @@ #!/bin/bash +# protect against multiple inclusion +if [ $FILE_CPUFREQ ]; then + return 0 +else + FILE_CPUFREQ=DONE +fi + source cpu.sh # GLOBALS diff --git a/governor.sh b/governor.sh index 1c56426..a82a6d5 100755 --- a/governor.sh +++ b/governor.sh @@ -2,6 +2,13 @@ # # Test governors +# protect against multiple inclusion +if [ $FILE_GOVERNOR ]; then + return 0 +else + FILE_GOVERNOR=DONE +fi + source cpu.sh source cpufreq.sh diff --git a/runme.sh b/runme.sh index b4889a6..accad17 100755 --- a/runme.sh +++ b/runme.sh @@ -3,6 +3,13 @@ # parameters: # - $1: Name of the output file with all the logs, dump.txt by default. +# protect against multiple inclusion +if [ $FILE_RUNME ]; then + return 0 +else + FILE_RUNME=DONE +fi + source cpu.sh source governor.sh source special-tests.sh diff --git a/special-tests.sh b/special-tests.sh index b29f644..292e3d8 100755 --- a/special-tests.sh +++ b/special-tests.sh @@ -4,6 +4,13 @@ # Testcase 1: Reported here: http://marc.info/?l=linux-pm&m=140618592709858&w=2 +# protect against multiple inclusion +if [ $FILE_SPECIAL ]; then + return 0 +else + FILE_SPECIAL=DONE +fi + source cpu.sh source cpufreq.sh source governor.sh -- cgit v1.2.3