diff mbox series

[VSP-Tests,7/7] vsp-lib: Reset controls to defaults on each test run

Message ID 20181204155146.9726-8-kieran.bingham@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series Reset controls and unloved patches | expand

Commit Message

Kieran Bingham Dec. 4, 2018, 3:51 p.m. UTC
Some of our tests set flipping and rotation controls, and the VSP cell
can be used again by later tests. If these controls are not reset, then
that operation is applied to later tests incorrectly causing that test
to fail.

In an ideal world, tests should clean up after themselves, and leave the
system in a known state. However the world is not ideal and we would not
be able to guarantee any previous system state before a test was run
anyway. Therefore it is more effective to reset state at the beginning
of a test.

To repair this - reset all control values to their defaults at the start
of every test during test_init()

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 scripts/vsp-lib.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Laurent Pinchart Feb. 17, 2019, 12:01 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Tue, Dec 04, 2018 at 03:51:46PM +0000, Kieran Bingham wrote:
> Some of our tests set flipping and rotation controls, and the VSP cell

cell ?

> can be used again by later tests. If these controls are not reset, then
> that operation is applied to later tests incorrectly causing that test

s/that test/those tests/ ?

> to fail.
> 
> In an ideal world, tests should clean up after themselves, and leave the
> system in a known state. However the world is not ideal and we would not
> be able to guarantee any previous system state before a test was run
> anyway. Therefore it is more effective to reset state at the beginning
> of a test.
> 
> To repair this - reset all control values to their defaults at the start
> of every test during test_init()
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  scripts/vsp-lib.sh | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh
> index 3d2792707d24..33442816f208 100755
> --- a/scripts/vsp-lib.sh
> +++ b/scripts/vsp-lib.sh
> @@ -94,6 +94,14 @@ vsp1_set_control() {
>  	$yavta --no-query -w "$control $value" $subdev | ./logger.sh "$entity" >> $logfile
>  }
>  
> +vsp1_reset_controls() {
> +	local entity=$1
> +	local subdev=$(vsp1_entity_subdev $entity)
> +
> +	echo "Resetting controls on $subdev" | ./logger.sh "$entity" >> $logfile
> +	$yavta --no-query --reset-controls $subdev | ./logger.sh "$entity" >> $logfile
> +}
> +
>  # -----------------------------------------------------------------------------
>  # Reference frame generation
>  #
> @@ -1082,6 +1090,9 @@ test_init() {
>  	dev=$(vsp1_device $mdev)
>  	echo "Using device $mdev ($dev)" | ./logger.sh config >> $logfile
>  
> +	# Reset any rotation or flipping controls
> +	vsp1_reset_controls wpf.0
> +
>  	vsp_runner=./vsp-runner.sh
>  }
>
Kieran Bingham Feb. 17, 2019, 9 p.m. UTC | #2
Hi Laurent,

On 17/02/2019 12:01, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Tue, Dec 04, 2018 at 03:51:46PM +0000, Kieran Bingham wrote:
>> Some of our tests set flipping and rotation controls, and the VSP cell
> 
> cell ?

Hrm ... Block, Module, Instance ?
What is your preferred name for a particular instance of the HW entity ?

I think VSP instance might be the right choice.

> 
>> can be used again by later tests. If these controls are not reset, then
>> that operation is applied to later tests incorrectly causing that test
> 
> s/that test/those tests/ ?

Yes, agreed.


> 
>> to fail.
>>
>> In an ideal world, tests should clean up after themselves, and leave the
>> system in a known state. However the world is not ideal and we would not
>> be able to guarantee any previous system state before a test was run
>> anyway. Therefore it is more effective to reset state at the beginning
>> of a test.
>>
>> To repair this - reset all control values to their defaults at the start
>> of every test during test_init()
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> ---
>>  scripts/vsp-lib.sh | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh
>> index 3d2792707d24..33442816f208 100755
>> --- a/scripts/vsp-lib.sh
>> +++ b/scripts/vsp-lib.sh
>> @@ -94,6 +94,14 @@ vsp1_set_control() {
>>  	$yavta --no-query -w "$control $value" $subdev | ./logger.sh "$entity" >> $logfile
>>  }
>>  
>> +vsp1_reset_controls() {
>> +	local entity=$1
>> +	local subdev=$(vsp1_entity_subdev $entity)
>> +
>> +	echo "Resetting controls on $subdev" | ./logger.sh "$entity" >> $logfile
>> +	$yavta --no-query --reset-controls $subdev | ./logger.sh "$entity" >> $logfile
>> +}
>> +
>>  # -----------------------------------------------------------------------------
>>  # Reference frame generation
>>  #
>> @@ -1082,6 +1090,9 @@ test_init() {
>>  	dev=$(vsp1_device $mdev)
>>  	echo "Using device $mdev ($dev)" | ./logger.sh config >> $logfile
>>  
>> +	# Reset any rotation or flipping controls
>> +	vsp1_reset_controls wpf.0
>> +
>>  	vsp_runner=./vsp-runner.sh
>>  }
>>  
>
diff mbox series

Patch

diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh
index 3d2792707d24..33442816f208 100755
--- a/scripts/vsp-lib.sh
+++ b/scripts/vsp-lib.sh
@@ -94,6 +94,14 @@  vsp1_set_control() {
 	$yavta --no-query -w "$control $value" $subdev | ./logger.sh "$entity" >> $logfile
 }
 
+vsp1_reset_controls() {
+	local entity=$1
+	local subdev=$(vsp1_entity_subdev $entity)
+
+	echo "Resetting controls on $subdev" | ./logger.sh "$entity" >> $logfile
+	$yavta --no-query --reset-controls $subdev | ./logger.sh "$entity" >> $logfile
+}
+
 # -----------------------------------------------------------------------------
 # Reference frame generation
 #
@@ -1082,6 +1090,9 @@  test_init() {
 	dev=$(vsp1_device $mdev)
 	echo "Using device $mdev ($dev)" | ./logger.sh config >> $logfile
 
+	# Reset any rotation or flipping controls
+	vsp1_reset_controls wpf.0
+
 	vsp_runner=./vsp-runner.sh
 }