diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2016-09-13 16:10:12 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2016-09-13 20:17:22 +0300 |
commit | 792e1bc143a84b1a0707e1f2f91a20cef6f43e31 (patch) | |
tree | 720abd78d5e46ba400c983b3283ba598195b384e | |
parent | 2c5aec7c218cdaaad6d63064943b738cd4a4d6ed (diff) |
tests: Make local variables local
Avoid interfering with the vsp-lib namespace by making local variables
local.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rwxr-xr-x | tests/vsp-unit-test-0001.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0002.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0003.sh | 10 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0004.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0005.sh | 7 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0007.sh | 11 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0008.sh | 13 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0009.sh | 7 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0010.sh | 16 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0011.sh | 8 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0012.sh | 3 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0013.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0014.sh | 4 |
13 files changed, 61 insertions, 34 deletions
diff --git a/tests/vsp-unit-test-0001.sh b/tests/vsp-unit-test-0001.sh index 1357363..727ead7 100755 --- a/tests/vsp-unit-test-0001.sh +++ b/tests/vsp-unit-test-0001.sh @@ -20,12 +20,14 @@ test_wpf_packing() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { + local format + for format in $formats ; do test_wpf_packing $format done diff --git a/tests/vsp-unit-test-0002.sh b/tests/vsp-unit-test-0002.sh index bc82b3c..b2f2bce 100755 --- a/tests/vsp-unit-test-0002.sh +++ b/tests/vsp-unit-test-0002.sh @@ -20,12 +20,14 @@ test_wpf_packing() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { + local format + for format in $formats ; do test_wpf_packing $format done diff --git a/tests/vsp-unit-test-0003.sh b/tests/vsp-unit-test-0003.sh index 8fb875d..ff1cf30 100755 --- a/tests/vsp-unit-test-0003.sh +++ b/tests/vsp-unit-test-0003.sh @@ -11,9 +11,9 @@ features="rpf.0 uds wpf.0" formats="RGB24 YUV444M" test_scale() { - format=$1 - insize=$2 - outsize=$3 + local format=$1 + local insize=$2 + local outsize=$3 test_start "scaling from $insize to $outsize in $format" @@ -23,12 +23,14 @@ test_scale() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { + local format + for format in $formats ; do test_scale $format 640x640 640x480 test_scale $format 1024x768 640x480 diff --git a/tests/vsp-unit-test-0004.sh b/tests/vsp-unit-test-0004.sh index 396e053..7dc5613 100755 --- a/tests/vsp-unit-test-0004.sh +++ b/tests/vsp-unit-test-0004.sh @@ -20,12 +20,14 @@ test_histogram() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_histograms) + local result=$(compare_histograms) test_complete $result } test_main() { + local format + for format in $formats ; do test_histogram $format done diff --git a/tests/vsp-unit-test-0005.sh b/tests/vsp-unit-test-0005.sh index 9cb46c6..66c26b4 100755 --- a/tests/vsp-unit-test-0005.sh +++ b/tests/vsp-unit-test-0005.sh @@ -12,7 +12,7 @@ optional_features="rpf.2 rpf.3 rpf.4" format=RGB24 test_rpf() { - rpf=$1 + local rpf=$1 test_start "RPF.$rpf" @@ -22,13 +22,14 @@ test_rpf() { vsp_runner rpf.$rpf & vsp_runner wpf.0 - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { - num_rpfs=$(vsp1_count_rpfs) + local num_rpfs=$(vsp1_count_rpfs) + local rpf for rpf in `seq 0 1 $((num_rpfs-1))` ; do test_rpf $rpf diff --git a/tests/vsp-unit-test-0007.sh b/tests/vsp-unit-test-0007.sh index 3f769ab..3e96513 100755 --- a/tests/vsp-unit-test-0007.sh +++ b/tests/vsp-unit-test-0007.sh @@ -10,26 +10,29 @@ features="rpf.0 rpf.1 bru wpf.0" formats="RGB24 YUV444M" test_bru() { - format=$1 - ninputs=$2 + local format=$1 + local ninputs=$2 test_start "BRU in $format with $ninputs inputs" pipe_configure rpf-bru $ninputs format_configure rpf-bru $format 1024x768 $ninputs + local input for input in `seq 0 1 $((ninputs-1))` ; do vsp_runner rpf.$input & done vsp_runner wpf.0 - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { - max_inputs=$(vsp1_count_bru_inputs) + local max_inputs=$(vsp1_count_bru_inputs) + local format + local ninputs for format in $formats ; do for ninputs in `seq $max_inputs` ; do diff --git a/tests/vsp-unit-test-0008.sh b/tests/vsp-unit-test-0008.sh index fb29b8d..3c752c6 100755 --- a/tests/vsp-unit-test-0008.sh +++ b/tests/vsp-unit-test-0008.sh @@ -11,10 +11,11 @@ features="bru rpf.0 uds wpf.0" formats="RGB24 YUV444M" test_scale() { - format=$1 - insize=$2 - outsize=$3 - order=$4 + local format=$1 + local insize=$2 + local outsize=$3 + local order=$4 + local pipe if [ $order = 'after' ] ; then pipe=rpf-bru-uds @@ -30,12 +31,14 @@ test_scale() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { + local format + for format in $formats ; do test_scale $format 1024x768 640x480 before test_scale $format 640x480 1024x768 before diff --git a/tests/vsp-unit-test-0009.sh b/tests/vsp-unit-test-0009.sh index 395e660..dbc2ec5 100755 --- a/tests/vsp-unit-test-0009.sh +++ b/tests/vsp-unit-test-0009.sh @@ -12,7 +12,7 @@ optional_features="wpf.1 wpf.2 wpf.3" format=RGB24 test_wpf() { - wpf=$1 + local wpf=$1 test_start "WPF.$wpf" @@ -22,13 +22,14 @@ test_wpf() { vsp_runner rpf.0 & vsp_runner wpf.$wpf - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { - num_wpfs=$(vsp1_count_wpfs) + local num_wpfs=$(vsp1_count_wpfs) + local wpf for wpf in `seq 0 1 $((num_wpfs-1))` ; do test_wpf $wpf diff --git a/tests/vsp-unit-test-0010.sh b/tests/vsp-unit-test-0010.sh index fc6ded6..07fd478 100755 --- a/tests/vsp-unit-test-0010.sh +++ b/tests/vsp-unit-test-0010.sh @@ -19,13 +19,13 @@ clu_configs="zero identity wave" lut_configs="zero identity gamma" test_lut() { - lut_type=$1 - format=$2 - config=$3 + local lut_type=$1 + local format=$2 + local config=$3 test_start "$(echo $lut_type | tr [:lower:] [:upper:]) in $format with $config configuration" - config_file=frames/${lut_type}-${config}.bin + local config_file=frames/${lut_type}-${config}.bin pipe_configure rpf-${lut_type} format_configure rpf-${lut_type} $format 1024x768 @@ -35,14 +35,18 @@ test_lut() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_frames $lut_type=$config_file) + local result=$(compare_frames $lut_type=$config_file) test_complete $result } test_main() { + local lut + local format + local config + for lut in $lut_types ; do - configs=$(eval echo \$${lut}_configs) + local configs=$(eval echo \$${lut}_configs) for format in $formats ; do for config in $configs ; do test_lut $lut $format $config diff --git a/tests/vsp-unit-test-0011.sh b/tests/vsp-unit-test-0011.sh index 17f8405..9d7b4e9 100755 --- a/tests/vsp-unit-test-0011.sh +++ b/tests/vsp-unit-test-0011.sh @@ -82,12 +82,14 @@ test_flipping() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_frames $label) + local result=$(compare_frames $label) test_complete $result } test_main() { + local direction + for direction in $directions ; do $(vsp1_has_feature "wpf.0[control:'$(get_var $direction control)']") && { set_var $direction index 0 @@ -100,12 +102,12 @@ test_main() { while true ; do # Update all controls - label= + local label= for direction in $supported_directions ; do local index=$(get_var $direction index) local values=$(get_var $direction values) local value=$(get_array_value "$values" $index) - local label="$label $(get_var $direction label)=$value" + label="$label $(get_var $direction label)=$value" dir_set_flipping_control $direction done diff --git a/tests/vsp-unit-test-0012.sh b/tests/vsp-unit-test-0012.sh index 21b14bb..0275d56 100755 --- a/tests/vsp-unit-test-0012.sh +++ b/tests/vsp-unit-test-0012.sh @@ -51,7 +51,7 @@ test_flipping() { vsp_runner wpf.0 --count=6 --skip=0 --buffers=1 --pause=3 & vsp_runner_wait wpf.0 - result=$(compare_frames $label=0) + local result=$(compare_frames $label=0) [ $result = fail ] && { test_complete $result ; @@ -71,6 +71,7 @@ test_flipping() { test_main() { # Check the supported directions and reset the associated controls local supported_directions + local direction for direction in $directions ; do $(vsp1_has_feature "wpf.0[control:'$(get_var $direction control)']") && { diff --git a/tests/vsp-unit-test-0013.sh b/tests/vsp-unit-test-0013.sh index 0578339..143f847 100755 --- a/tests/vsp-unit-test-0013.sh +++ b/tests/vsp-unit-test-0013.sh @@ -20,12 +20,14 @@ test_rpf_unpacking() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { + local format + for format in $formats ; do test_rpf_unpacking $format done diff --git a/tests/vsp-unit-test-0014.sh b/tests/vsp-unit-test-0014.sh index 3958373..b9e8e7c 100755 --- a/tests/vsp-unit-test-0014.sh +++ b/tests/vsp-unit-test-0014.sh @@ -20,12 +20,14 @@ test_rpf_unpacking() { vsp_runner rpf.0 & vsp_runner wpf.0 - result=$(compare_frames) + local result=$(compare_frames) test_complete $result } test_main() { + local format + for format in $formats ; do test_rpf_unpacking $format done |