From 62f0b16f639a9ecb116a79819655bdf44e269443 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 16 May 2016 21:55:52 +0300 Subject: Initial commit Signed-off-by: Laurent Pinchart --- tests/Makefile | 8 ++++++ tests/vsp-unit-test-0001.sh | 36 ++++++++++++++++++++++++++ tests/vsp-unit-test-0002.sh | 36 ++++++++++++++++++++++++++ tests/vsp-unit-test-0003.sh | 40 +++++++++++++++++++++++++++++ tests/vsp-unit-test-0004.sh | 37 +++++++++++++++++++++++++++ tests/vsp-unit-test-0005.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++ tests/vsp-unit-test-0006.sh | 44 ++++++++++++++++++++++++++++++++ tests/vsp-unit-test-0007.sh | 43 +++++++++++++++++++++++++++++++ tests/vsp-unit-test-0008.sh | 49 +++++++++++++++++++++++++++++++++++ 9 files changed, 355 insertions(+) create mode 100644 tests/Makefile create mode 100755 tests/vsp-unit-test-0001.sh create mode 100755 tests/vsp-unit-test-0002.sh create mode 100755 tests/vsp-unit-test-0003.sh create mode 100755 tests/vsp-unit-test-0004.sh create mode 100755 tests/vsp-unit-test-0005.sh create mode 100755 tests/vsp-unit-test-0006.sh create mode 100755 tests/vsp-unit-test-0007.sh create mode 100755 tests/vsp-unit-test-0008.sh (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..6586b29 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,8 @@ +SCRIPTS=$(wildcard *.sh) + +all: + +clean: + +install: + cp $(SCRIPTS) $(INSTALL_DIR)/ diff --git a/tests/vsp-unit-test-0001.sh b/tests/vsp-unit-test-0001.sh new file mode 100755 index 0000000..2cb0cb3 --- /dev/null +++ b/tests/vsp-unit-test-0001.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# +# Test WPF packing in RGB mode. Use a RPF -> WPF pipeline with a fixed ARGB32 +# format on the input and capture output frames in all RGB formats supported +# by the WPF. +# + +source vsp-lib.sh + +features="rpf.0 wpf.0" +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 + + $vsp_runner $mdev input 0 ARGB32 | ./logger.sh input.0 >> $logfile & + $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile + + result=$(compare_frames exact reference $format 0) + + test_complete $result +} + +test_run() { + for format in $formats ; do + test_wpf_packing $format + done +} + +test_init $0 "$features" +test_run diff --git a/tests/vsp-unit-test-0002.sh b/tests/vsp-unit-test-0002.sh new file mode 100755 index 0000000..e2602d8 --- /dev/null +++ b/tests/vsp-unit-test-0002.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# +# Test WPF packing in YUV mode. Use a RPF -> WPF pipeline with a fixed YUYV +# format on the input and capture output frames in all YUV formats supported +# by the WPF. +# + +source vsp-lib.sh + +features="rpf.0 wpf.0" +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 + + $vsp_runner $mdev input 0 YUYV | ./logger.sh input.0 >> $logfile & + $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile + + result=$(compare_frames fuzzy reference $format 0) + + test_complete $result +} + +test_run() { + for format in $formats ; do + test_wpf_packing $format + done +} + +test_init $0 "$features" +test_run diff --git a/tests/vsp-unit-test-0003.sh b/tests/vsp-unit-test-0003.sh new file mode 100755 index 0000000..ff81509 --- /dev/null +++ b/tests/vsp-unit-test-0003.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# +# Test downscaling and upscaling in RGB and YUV modes. Use a RPF -> UDS -> WPF +# pipeline with identical input and output formats. +# + +source vsp-lib.sh + +features="rpf.0 uds wpf.0" +formats="RGB24 UYVY" + +test_scale() { + format=$1 + insize=$2 + outsize=$3 + + 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 + + $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile & + $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile + + result=$(compare_frames exact scaled $format 0) + + test_complete $result +} + +test_run() { + for format in $formats ; do + test_scale $format 1024x768 640x480 + test_scale $format 640x480 1024x768 + done +} + +test_init $0 "$features" +test_run diff --git a/tests/vsp-unit-test-0004.sh b/tests/vsp-unit-test-0004.sh new file mode 100755 index 0000000..af5dfdb --- /dev/null +++ b/tests/vsp-unit-test-0004.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# +# Test 1D histogram generation. Use a RPF -> WPF pipeline with the HGO hooked +# up at the RPF output. +# + +source vsp-lib.sh + +features="hgo rpf.0 wpf.0" +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 + + $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 + + result=$(compare_histograms $format 0) + + test_complete $result +} + +test_run() { + for format in $formats ; do + test_histogram $format + done +} + +test_init $0 "$features" +test_run diff --git a/tests/vsp-unit-test-0005.sh b/tests/vsp-unit-test-0005.sh new file mode 100755 index 0000000..aeb0ca2 --- /dev/null +++ b/tests/vsp-unit-test-0005.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +# +# Test RPF -> WPF with all RPF and WPF instances in sequence. The format +# doesn't matter much, use RGB24 to simplify frame comparison. +# + +source vsp-lib.sh + +features="rpf.0 rpf.1 wpf.0 wpf.1" +format=RGB24 + +test_rpf() { + rpf=$1 + + 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 + + $vsp_runner $mdev input $rpf $format | ./logger.sh input.0 >> $logfile & + $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile + + result=$(compare_frames exact reference $format 0) + + test_complete $result +} + +test_wpf() { + wpf=$1 + + 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 + + $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile & + $vsp_runner $mdev output $wpf $format | ./logger.sh output.0 >> $logfile + + result=$(compare_frames exact reference $format $wpf) + + test_complete $result +} + +test_run() { + num_rpfs=$(vsp1_count_rpfs) + num_wpfs=$(vsp1_count_wpfs) + + for rpf in `seq 0 1 $((num_rpfs-1))` ; do + test_rpf $rpf + done + + # Skip WPF.0, it has already been tested during the RPF tests. + for wpf in `seq $((num_wpfs-1))` ; do + test_wpf $wpf + done +} + +test_init $0 "$features" +test_run diff --git a/tests/vsp-unit-test-0006.sh b/tests/vsp-unit-test-0006.sh new file mode 100755 index 0000000..0ae4259 --- /dev/null +++ b/tests/vsp-unit-test-0006.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# +# Test invalid pipelines, without an RPF or without a WPF. +# + +source vsp-lib.sh + +features="rpf.0 wpf.0" +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 + + $vsp_runner $mdev output 0 $format | ./logger.sh input.0 >> $logfile + + # The test always passes if the kernel doesn't crash + test_complete pass +} + +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 + + $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile + + # The test always passes if the kernel doesn't crash + test_complete pass +} + +test_run() { + test_no_rpf + test_no_wpf +} + +test_init $0 "$features" +test_run diff --git a/tests/vsp-unit-test-0007.sh b/tests/vsp-unit-test-0007.sh new file mode 100755 index 0000000..c124c29 --- /dev/null +++ b/tests/vsp-unit-test-0007.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# +# Test composition through the BRU in RGB and YUV formats. +# + +source vsp-lib.sh + +features="rpf.0 rpf.1 bru wpf.0" +formats="RGB24 UYVY" + +test_bru() { + format=$1 + ninputs=$2 + + 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 + + for input in `seq 0 1 $((ninputs-1))` ; do + $vsp_runner $mdev input $input $format | ./logger.sh input.$input >> $logfile & + done + $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile + + result=$(compare_frames fuzzy composed-$ninputs $format 0) + + test_complete $result +} + +test_run() { + max_inputs=$(vsp1_count_bru_inputs) + + for format in $formats ; do + for ninputs in `seq $max_inputs` ; do + test_bru $format $ninputs + done + done +} + +test_init $0 "$features" +test_run diff --git a/tests/vsp-unit-test-0008.sh b/tests/vsp-unit-test-0008.sh new file mode 100755 index 0000000..b3b0510 --- /dev/null +++ b/tests/vsp-unit-test-0008.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# +# Test downscaling and upscaling in RGB and YUV modes with a BRU inserted in +# the pipeline, both before and after the scaler. +# + +source vsp-lib.sh + +features="bru rpf.0 uds wpf.0" +formats="RGB24 UYVY" + +test_scale() { + format=$1 + insize=$2 + outsize=$3 + order=$4 + + if [ $order = 'after' ] ; then + pipe=rpf-bru-uds + else + pipe=rpf-uds-bru + fi + + 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 + + $vsp_runner $mdev input 0 $format | ./logger.sh input.0 >> $logfile & + $vsp_runner $mdev output 0 $format | ./logger.sh output.0 >> $logfile + + result=$(compare_frames exact scaled $format 0) + + test_complete $result +} + +test_run() { + for format in $formats ; do + test_scale $format 1024x768 640x480 before + test_scale $format 640x480 1024x768 before + test_scale $format 1024x768 640x480 after + test_scale $format 640x480 1024x768 after + done +} + +test_init $0 "$features" +test_run -- cgit v1.2.3