summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-06-16 23:24:24 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-06-19 15:26:01 +0300
commit7aa5142f82e87fa25fd3652ea74e416e02a185f5 (patch)
tree36007555eed207a2cf3f6236d0f4c87c573378e9
parent282f432b16b1271257500e15b0f80c1a459045d8 (diff)
vsp-lib: Handle logging internally
Remove the need to pipe individual commands to the logger from the test scripts by moving all logging code internally to vsp-lib and vsp-runner. As an interesting side effect the removal of shell pipes from the test scripts avoids running functions in subshells. This makes it possible for the pipeline configuration functions to set variables that can be used later. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rwxr-xr-xscripts/vsp-lib.sh6
-rwxr-xr-xscripts/vsp-runner.sh22
-rwxr-xr-xtests/vsp-unit-test-0001.sh11
-rwxr-xr-xtests/vsp-unit-test-0002.sh11
-rwxr-xr-xtests/vsp-unit-test-0003.sh11
-rwxr-xr-xtests/vsp-unit-test-0004.sh15
-rwxr-xr-xtests/vsp-unit-test-0005.sh20
-rwxr-xr-xtests/vsp-unit-test-0006.sh16
-rwxr-xr-xtests/vsp-unit-test-0007.sh11
-rwxr-xr-xtests/vsp-unit-test-0008.sh11
10 files changed, 66 insertions, 68 deletions
diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh
index 7e06738..e4040f4 100755
--- a/scripts/vsp-lib.sh
+++ b/scripts/vsp-lib.sh
@@ -500,7 +500,7 @@ format_configure() {
#
test_init() {
- logfile=${1/sh/log}
+ export logfile=${1/sh/log}
local features=$2
local optional_features=$3
@@ -569,3 +569,7 @@ test_complete() {
rm -f frame-*.bin
rm -f histo-*.bin
}
+
+test_run() {
+ test_main | ./logger.sh error >> $logfile
+}
diff --git a/scripts/vsp-runner.sh b/scripts/vsp-runner.sh
index d944e74..c4745c3 100755
--- a/scripts/vsp-runner.sh
+++ b/scripts/vsp-runner.sh
@@ -61,31 +61,26 @@ parse() {
fi
mdev=$1
- dev=`$mediactl -d $mdev -p | grep 'bus info' | sed 's/.*platform://'`
-
- if [ -z $dev ] ; then
- echo "Error: Device $dev doesn't exist"
- syntax
- return 1
- fi
-
cmd=$2
case $cmd in
hgo)
options=$3
+ log=hgo
;;
input)
index=$3
infmt=$4
options=$5
+ log=input.$index
;;
output)
index=$3
outfmt=$4
options=$5
+ log=output.$index
;;
*)
@@ -99,6 +94,14 @@ parse() {
#
execute() {
+ dev=`$mediactl -d $mdev -p | grep 'bus info' | sed 's/.*platform://'`
+
+ if [ -z $dev ] ; then
+ echo "Error: Device $dev doesn't exist"
+ syntax
+ return 1
+ fi
+
case $cmd in
hgo)
if [ "x$options" = xinfinite ] ; then
@@ -142,4 +145,5 @@ execute() {
esac
}
-parse $* && execute
+parse $* || exit 1
+execute | ./logger.sh $log >> $logfile
diff --git a/tests/vsp-unit-test-0001.sh b/tests/vsp-unit-test-0001.sh
index 2cb0cb3..f0e41da 100755
--- a/tests/vsp-unit-test-0001.sh
+++ b/tests/vsp-unit-test-0001.sh
@@ -14,19 +14,18 @@ formats="RGB332 ARGB555 XRGB555 RGB565 BGR24 RGB24 ABGR32 ARGB32 XBGR32 XRGB32"
test_wpf_packing() {
test_start "WPF packing in $format"
- pipe_configure rpf-wpf 0 0 | ./logger.sh config >> $logfile
- format_configure rpf-wpf 0 0 \
- ARGB32 1024x768 $format | ./logger.sh config >> $logfile
+ pipe_configure rpf-wpf 0 0
+ format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
- $vsp_runner $mdev input 0 ARGB32 | ./logger.sh input.0 >> $logfile &
- $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile
+ $vsp_runner $mdev input 0 ARGB32 &
+ $vsp_runner $mdev output 0 $format
result=$(compare_frames exact reference $format 0)
test_complete $result
}
-test_run() {
+test_main() {
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 e2602d8..49c0d43 100755
--- a/tests/vsp-unit-test-0002.sh
+++ b/tests/vsp-unit-test-0002.sh
@@ -14,19 +14,18 @@ formats="NV12M NV16M NV21M NV61M UYVY VYUY YUV420M YUYV YVYU"
test_wpf_packing() {
test_start "WPF packing in $format"
- pipe_configure rpf-wpf 0 0 | ./logger.sh config >> $logfile
- format_configure rpf-wpf 0 0 \
- YUYV 1024x768 $format | ./logger.sh config >> $logfile
+ pipe_configure rpf-wpf 0 0
+ format_configure rpf-wpf 0 0 YUYV 1024x768 $format
- $vsp_runner $mdev input 0 YUYV | ./logger.sh input.0 >> $logfile &
- $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile
+ $vsp_runner $mdev input 0 YUYV &
+ $vsp_runner $mdev output 0 $format
result=$(compare_frames fuzzy reference $format 0)
test_complete $result
}
-test_run() {
+test_main() {
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 ff81509..c79cc8a 100755
--- a/tests/vsp-unit-test-0003.sh
+++ b/tests/vsp-unit-test-0003.sh
@@ -17,19 +17,18 @@ test_scale() {
test_start "scaling from $insize to $outsize in $format"
- pipe_configure rpf-uds | ./logger.sh config >> $logfile
- format_configure rpf-uds \
- $format $insize $format $outsize | ./logger.sh config >> $logfile
+ pipe_configure rpf-uds
+ format_configure rpf-uds $format $insize $format $outsize
- $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile &
- $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile
+ $vsp_runner $mdev input 0 $format &
+ $vsp_runner $mdev output 0 $format
result=$(compare_frames exact scaled $format 0)
test_complete $result
}
-test_run() {
+test_main() {
for format in $formats ; do
test_scale $format 1024x768 640x480
test_scale $format 640x480 1024x768
diff --git a/tests/vsp-unit-test-0004.sh b/tests/vsp-unit-test-0004.sh
index af5dfdb..fd49af1 100755
--- a/tests/vsp-unit-test-0004.sh
+++ b/tests/vsp-unit-test-0004.sh
@@ -13,21 +13,20 @@ formats="RGB24 UYVY"
test_histogram() {
test_start "histogram in $format"
- pipe_configure rpf-hgo | ./logger.sh config >> $logfile
- format_configure rpf-hgo \
- $format 1024x768 | ./logger.sh config >> $logfile
+ pipe_configure rpf-hgo
+ format_configure rpf-hgo $format 1024x768
- $vsp_runner $mdev m2m-hgo $format $format | ./logger.sh config >> $logfile
- $vsp_runner $mdev hgo | ./logger.sh hgo >> $logfile &
- $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile &
- $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile
+ $vsp_runner $mdev m2m-hgo $format $format
+ $vsp_runner $mdev hgo &
+ $vsp_runner $mdev input 0 $format &
+ $vsp_runner $mdev output 0 $format
result=$(compare_histograms $format 0)
test_complete $result
}
-test_run() {
+test_main() {
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 aeb0ca2..2ba11bf 100755
--- a/tests/vsp-unit-test-0005.sh
+++ b/tests/vsp-unit-test-0005.sh
@@ -15,12 +15,11 @@ test_rpf() {
test_start "RPF.$rpf"
- pipe_configure rpf-wpf $rpf 0 | ./logger.sh config >> $logfile
- format_configure rpf-wpf $rpf 0 \
- $format 1024x768 $format | ./logger.sh config >> $logfile
+ pipe_configure rpf-wpf $rpf 0
+ format_configure rpf-wpf $rpf 0 $format 1024x768 $format
- $vsp_runner $mdev input $rpf $format | ./logger.sh input.0 >> $logfile &
- $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile
+ $vsp_runner $mdev input $rpf $format &
+ $vsp_runner $mdev output 0 $format
result=$(compare_frames exact reference $format 0)
@@ -32,19 +31,18 @@ test_wpf() {
test_start "WPF.$wpf"
- pipe_configure rpf-wpf 0 $wpf | ./logger.sh config >> $logfile
- format_configure rpf-wpf 0 $wpf \
- $format 1024x768 $format | ./logger.sh config >> $logfile
+ pipe_configure rpf-wpf 0 $wpf
+ format_configure rpf-wpf 0 $wpf $format 1024x768 $format
- $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile &
- $vsp_runner $mdev output $wpf $format | ./logger.sh output.0 >> $logfile
+ $vsp_runner $mdev input 0 $format &
+ $vsp_runner $mdev output $wpf $format
result=$(compare_frames exact reference $format $wpf)
test_complete $result
}
-test_run() {
+test_main() {
num_rpfs=$(vsp1_count_rpfs)
num_wpfs=$(vsp1_count_wpfs)
diff --git a/tests/vsp-unit-test-0006.sh b/tests/vsp-unit-test-0006.sh
index 0ae4259..a7daad7 100755
--- a/tests/vsp-unit-test-0006.sh
+++ b/tests/vsp-unit-test-0006.sh
@@ -12,11 +12,10 @@ format=RGB24
test_no_rpf() {
test_start "invalid pipeline with no RPF"
- pipe_configure none | ./logger.sh config >> $logfile
- format_configure wpf \
- $format 1024x768 0 | ./logger.sh config >> $logfile
+ pipe_configure none
+ format_configure wpf $format 1024x768 0
- $vsp_runner $mdev output 0 $format | ./logger.sh input.0 >> $logfile
+ $vsp_runner $mdev output 0 $format
# The test always passes if the kernel doesn't crash
test_complete pass
@@ -25,17 +24,16 @@ test_no_rpf() {
test_no_wpf() {
test_start "invalid pipeline with no WPF"
- pipe_configure none | ./logger.sh config >> $logfile
- format_configure rpf \
- $format 1024x768 0 | ./logger.sh config >> $logfile
+ pipe_configure none
+ format_configure rpf $format 1024x768 0
- $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile
+ $vsp_runner $mdev input 0 $format
# The test always passes if the kernel doesn't crash
test_complete pass
}
-test_run() {
+test_main() {
test_no_rpf
test_no_wpf
}
diff --git a/tests/vsp-unit-test-0007.sh b/tests/vsp-unit-test-0007.sh
index c124c29..68bd838 100755
--- a/tests/vsp-unit-test-0007.sh
+++ b/tests/vsp-unit-test-0007.sh
@@ -15,21 +15,20 @@ test_bru() {
test_start "BRU in $format with $ninputs inputs"
- pipe_configure rpf-bru $ninputs | ./logger.sh config >> $logfile
- format_configure rpf-bru \
- $format 1024x768 $ninputs | ./logger.sh config >> $logfile
+ pipe_configure rpf-bru $ninputs
+ format_configure rpf-bru $format 1024x768 $ninputs
for input in `seq 0 1 $((ninputs-1))` ; do
- $vsp_runner $mdev input $input $format | ./logger.sh input.$input >> $logfile &
+ $vsp_runner $mdev input $input $format &
done
- $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile
+ $vsp_runner $mdev output 0 $format
result=$(compare_frames fuzzy composed-$ninputs $format 0)
test_complete $result
}
-test_run() {
+test_main() {
max_inputs=$(vsp1_count_bru_inputs)
for format in $formats ; do
diff --git a/tests/vsp-unit-test-0008.sh b/tests/vsp-unit-test-0008.sh
index b3b0510..be3db96 100755
--- a/tests/vsp-unit-test-0008.sh
+++ b/tests/vsp-unit-test-0008.sh
@@ -24,19 +24,18 @@ test_scale() {
test_start "scaling from $insize to $outsize in $format $order BRU"
- pipe_configure $pipe | ./logger.sh config >> $logfile
- format_configure $pipe \
- $format $insize $format $outsize | ./logger.sh config >> $logfile
+ pipe_configure $pipe
+ format_configure $pipe $format $insize $format $outsize
- $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile &
- $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile
+ $vsp_runner $mdev input 0 $format &
+ $vsp_runner $mdev output 0 $format
result=$(compare_frames exact scaled $format 0)
test_complete $result
}
-test_run() {
+test_main() {
for format in $formats ; do
test_scale $format 1024x768 640x480 before
test_scale $format 640x480 1024x768 before