Skip to contentSkip to conversation

VSP-Tests: Add suspend resume tests and helpers

PATCH In review Kieran Bingham 4 participants 18 messages Nov 25, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

cover VSP-Tests: Add suspend resume tests and helpers

From: Kieran Bingham <[email protected]>

Provide two tests for suspend/resume cycles. One will verify the VSP1 is functional with a test before and after a suspend cycle. The other will maintain an active pipeline which must succeed despite a suspend resume cycle occuring in the middle of the test.

Along side these tests are a couple of helpers that I have locally and thought they might be useful to others, so I'm posting for review. A test suite runner simplifies executing all vsp-unit tests, and provides the ability to easily repeat the test suite (for example to run an overnight longevity test).

'bin2png.sh' is a wrapper around the existing tools that helps convert the test files generated by VSP-Tests into png files for easy viewing.

Finally, I have extended 'logger.sh' to also log to the FTrace buffer. As I have been making greater use of ftrace for register write capture, and driver flow - this addition helps separate multiple tests from the ftrace kernelshark view.

Kieran Bingham (5):
scripts: Test suite runner
scripts: Provide bin2png.sh helper
logger: Log to the FTrace buffer if tracing is enabled
tests: Test suspend/resume on idle pipelines
tests: Test suspend/resume on active pipelines

 scripts/Makefile            |  2 +-
 scripts/bin2png.sh          | 34 ++++++++++++++++
 scripts/logger.sh           | 13 ++++++-
 scripts/vsp-tests.sh        | 46 ++++++++++++++++++++++
 tests/vsp-unit-test-0019.sh | 84 ++++++++++++++++++++++++++++++++++++++++
 tests/vsp-unit-test-0020.sh | 94 +++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 271 insertions(+), 2 deletions(-)
 create mode 100755 scripts/bin2png.sh
 create mode 100755 scripts/vsp-tests.sh
 create mode 100755 tests/vsp-unit-test-0019.sh
 create mode 100755 tests/vsp-unit-test-0020.sh
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 scripts: Test suite runner

From: Kieran Bingham <[email protected]>

Provide a utility script to execute all vsp unit tests, as well as the option to execute multiple iterations of the suite.

---
 scripts/vsp-tests.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100755 scripts/vsp-tests.sh
scripts/vsp-tests.sh new file +46 -0
new file mode 100755
index 000000000000..e5ffa0ec4236
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+##
+## VSP Tests runner
+##
+## Automatically execute all vsp-unit tests
+## Move test failure results to a specific folder for
+## the running kernel version
+##
+## An argument can be provided to specify the number of
+## iterations to perform
+##
+## usage:
+##  ./vsp-tests.sh <n>
+##
+##   n: Number of iterations to execute test suite
+##
+
+KERNEL_VERSION=`uname -r`
+
+run_test() {
+	echo $1
+	./$1
+
+	if [ $(ls *.bin 2>/dev/null | wc -l) != 0 ];
+	then
+		RESULTS_DIR=$KERNEL_VERSION/test-$1/$2/
+
+		echo "Moving *.bin to test-$1/$2/";
+		mkdir -p $RESULTS_DIR;
+		echo "mv *.bin $RESULTS_DIR";
+		mv *.bin $RESULTS_DIR;
+	fi;
+}
+
+run_suite() {
+	echo "Test loop $1"
+
+	for test in vsp-unit-test*.sh; do
+		run_test $test $1;
+	done;
+}
+
+for loop in `seq 1 1 $1`; do
+	run_suite $loop
+done;
Signature · 1 line
2.7.4
#4 lore raw

PATCH 2/5 scripts: Provide bin2png.sh helper

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Identify the size and format from the test output filename, and pass to raw2rgbpnm for conversion to a PNM file.

Quoted 1 line

From there we can convert easily to a PNG output file.

---
 scripts/Makefile   |  2 +-
 scripts/bin2png.sh | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100755 scripts/bin2png.sh
scripts/Makefile +1 -1
index 8c452f4c54ce..6586b2989aed 100644
@@ -1,4 +1,4 @@
-SCRIPTS=logger.sh vsp-lib.sh
+SCRIPTS=$(wildcard *.sh)
 
 all:
 
scripts/bin2png.sh new file +34 -0
new file mode 100755
index 000000000000..527c5546514d
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+FILE="$1"
+
+fmt=$(echo $FILE | sed -e 's/.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin/\1/')
+size=$(echo $FILE | sed -e 's/.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin/\2/')
+
+case $fmt in
+	yuv410m|yvu410m|yuv411m|yuv420m|yvu420m|yuv422m|yvu422m|yuv444m|yvu444m)
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+		fmt=`echo $fmt | tr 'M' 'P'`
+		;;
+	nv12m|nv21m|nv16m|nv61m)
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+		fmt=`echo $fmt | tr -d 'M'`
+		;;
+	argb555|xrgb555)
+		fmt=RGB555X
+		;;
+	argb32|xrgb32)
+		fmt=RGB32
+		;;
+	abgr32|xbgr32)
+		fmt=BGR32
+		;;
+	*)
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+		;;
+esac
+
+# Only run pnmtopng if the conversion to PNM succeeds
+raw2rgbpnm -s $size -f $fmt $FILE $FILE.pnm && \
+	pnmtopng $FILE.pnm > $FILE.png
+rm $FILE.pnm
Signature · 1 line
2.7.4
#7 lore raw

PATCH 3/5 logger: Log to the FTrace buffer if tracing is enabled

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Extend the logger such that it will detect the tracing system, and also append print statement to this ring buffer.

This provides the relevant logging output interspersed in the ftrace logs for an effective solution to identifying the actions that caused the traces to occur

---
 scripts/logger.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
scripts/logger.sh +12 -1
index 8123f0c9f6e3..8412b0ba9a08 100755
@@ -6,6 +6,17 @@ now() {
 
 label=${1:+ [$1]}
 
+TRACE_MARKER=/sys/kernel/debug/tracing/trace_marker
+if [ -e $TRACE_MARKER ]; then
+	extra_log_files=$TRACE_MARKER
+fi
+
 while read line ; do
-	echo "$(now)$label $line"
+	newline="$(now)$label $line"
+
+	echo "$newline"
+
+	for f in $extra_log_files; do
+		echo "$newline" >> $f;
+	done;
 done
Signature · 1 line
2.7.4
#11 lore raw

PATCH 4/5 tests: Test suspend/resume on idle pipelines

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Provide a test to verify the hardware is functional both before and after entering a suspend / resume cycle. Make use of the /sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform the testing

---
 tests/vsp-unit-test-0019.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100755 tests/vsp-unit-test-0019.sh
tests/vsp-unit-test-0019.sh new file +77 -0
new file mode 100755
index 000000000000..e7b94996c1aa
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are idle
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the hardware
+# is operable while we perform test suspend and resume, and verify that it is
+# still operable after resume.
+#
+# Format iteration loops are maintained, even with only one format so that this
+# test can be easily extended to try further formats if needed in the future.
+#
+
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+formats="RGB24"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"
+
+test_wpf_packing() {
+	test_start "Verify WPF packing in $format before/after suspend:$mode"
+
+	pipe_configure rpf-wpf 0 0
+	format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+	vsp_runner rpf.0 &
+	vsp_runner wpf.0
+
+	local result=$(compare_frames)
+
+	test_complete $result
+}
+
+test_hw_pipe() {
+	local format
+
+	for format in $formats ; do
+		test_wpf_packing $format
+	done
+}
+
+test_suspend_resume() {
+	local test_results=0
+
+	# Test the hardware each side of suspend resume
+	test_hw_pipe
+
+	# Set the test mode
+	echo $mode > /sys/power/pm_test
+
+	# Comence suspend
+	# The pm_test framework will automatically resume after 5 seconds
+	echo mem > /sys/power/state
+
+	# Verify the hardware is still operational
+	test_hw_pipe
+}
+
+test_main() {
+	local mode;
+
+	# Check for pm-suspend test option
+	if [ ! -e /sys/power/pm_test ] ; then
+		echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+		test_complete skip
+		return
+	fi;
+
+	for mode in $suspend_modes ; do
+		test_suspend_resume $mode
+	done;
+}
+
+test_init $0 "$features"
+test_run
Signature · 1 line
2.7.4
#14 lore raw

PATCH 5/5 tests: Test suspend/resume on active pipelines

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Provide a test to verify the hardware completes a functional test whilst performing a suspend resume cycle in parallel. Make use of the /sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform the testing

---
 tests/vsp-unit-test-0020.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100755 tests/vsp-unit-test-0020.sh
tests/vsp-unit-test-0020.sh new file +86 -0
new file mode 100755
index 000000000000..5838295139b2
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are active
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the hardware
+# is operable while we perform test suspend and resume, and verify that it is
+# still successful even with a suspend resume cycle in the middle of the test.
+#
+# Format iteration loops are maintained, even with only one format so that this
+# test can be easily extended to try further formats if needed in the future.
+#
+
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+formats="RGB24"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"
+
+# This extended function performs the same
+# as it's non-extended name-sake - but runs the pipeline
+# for 300 frames. The suspend action occurs between frame #150~#200
+test_extended_wpf_packing() {
+	test_start "Verify WPF packing in $format during suspend:$mode"
+
+	pipe_configure rpf-wpf 0 0
+	format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+	vsp_runner rpf.0 --count=300 &
+	vsp_runner wpf.0 --count=300 --skip=297
+
+	local result=$(compare_frames)
+
+	test_complete $result
+}
+
+test_hw_pipe() {
+	local format
+
+	for format in $formats ; do
+		test_extended_wpf_packing $format
+	done
+}
+
+test_suspend_resume() {
+	local test_results=0
+	local test_pid
+
+	# Test the hardware each side of suspend resume
+	test_hw_pipe &
+	test_pid=$!
+
+	# Make sure the pipeline has time to start
+	sleep 1
+
+	# Set the test mode
+	echo $mode > /sys/power/pm_test
+
+	# Comence suspend
+	# The pm_test framework will automatically resume after 5 seconds
+	echo mem > /sys/power/state
+
+	# Wait for the pipeline to complete
+	wait $test_pid
+}
+
+test_main() {
+	local mode;
+	local suspend_test_failures
+
+	# Check for pm-suspend test option
+	if [ ! -e /sys/power/pm_test ] ; then
+		echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+		test_complete skip
+		return
+	fi;
+
+	for mode in $suspend_modes ; do
+		test_suspend_resume $mode
+	done;
+}
+
+test_init $0 "$features"
+test_run
Signature · 1 line
2.7.4
#15 lore raw

Re: [PATCH 5/5] tests: Test suspend/resume on active pipelines

Hi Kieran,

Thank you for the patch.

Quoted 32 lines · On Friday 25 Nov 2016 13:59:16 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Provide a test to verify the hardware completes a functional test whilst performing a suspend resume cycle in parallel. Make use of the /sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform the testing

---
 tests/vsp-unit-test-0020.sh | 86 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100755 tests/vsp-unit-test-0020.sh
tests/vsp-unit-test-0020.sh new file +6 -0
new file mode 100755
index 000000000000..5838295139b2
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are active
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the

hardware
+# is operable while we perform test suspend and resume, and verify that it is
+# still successful even with a suspend resume cycle in the middle of the test.

tests/vsp-unit-test-0020.sh new file +2 -0
+#
+# Format iteration loops are maintained, even with only one format so that
Quoted 4 lines

this
+# test can be easily extended to try further formats if needed in the future.
+#

Given that this test will suspend during the first iteration only I don't think it's very useful to keep the loop.

tests/vsp-unit-test-0020.sh line 20

Quoted 8 lines
tests/vsp-unit-test-0020.sh new file +8 -0
+
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+formats="RGB24"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"

How about extracting them from that file then ? :-) Or maybe just verifying they are available before trying to use them ?

Quoted 17 lines
tests/vsp-unit-test-0020.sh new file +17 -0
+# This extended function performs the same
+# as it's non-extended name-sake - but runs the pipeline
+# for 300 frames. The suspend action occurs between frame #150~#200
+test_extended_wpf_packing() {
+	test_start "Verify WPF packing in $format during suspend:$mode"
+
+	pipe_configure rpf-wpf 0 0
+	format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+	vsp_runner rpf.0 --count=300 &
+	vsp_runner wpf.0 --count=300 --skip=297
+
+	local result=$(compare_frames)
+
+	test_complete $result
+}
+

tests/vsp-unit-test-0020.sh line 48

Quoted 10 lines
tests/vsp-unit-test-0020.sh new file +10 -0
+test_hw_pipe() {
+	local format
+
+	for format in $formats ; do
+		test_extended_wpf_packing $format
+	done
+}
+
+test_suspend_resume() {
+	local test_results=0

This variable doesn't seem to be used.

tests/vsp-unit-test-0020.sh line 61

Quoted 13 lines
tests/vsp-unit-test-0020.sh new file +13 -0
+	local test_pid
+
+	# Test the hardware each side of suspend resume
+	test_hw_pipe &
+	test_pid=$!
+
+	# Make sure the pipeline has time to start
+	sleep 1
+
+	# Set the test mode
+	echo $mode > /sys/power/pm_test
+
+	# Comence suspend

Commence ?

tests/vsp-unit-test-0020.sh line 66

Quoted 5 lines
tests/vsp-unit-test-0020.sh new file +5 -0
+	# The pm_test framework will automatically resume after 5 seconds
+	echo mem > /sys/power/state
+
+	# Wait for the pipeline to complete
+	wait $test_pid

It would be nice to add a timeout here. Maybe something like the following (untested) ?

	(sleep 30 ; kill $test_pid) &
	kill_pid=$!
	wait $test_pid
	kill $kill_pid

test_complete should be called here based on both whether the frames compared successfully and whether the test timed out.

tests/vsp-unit-test-0020.sh line 70

Quoted 4 lines
tests/vsp-unit-test-0020.sh new file +4 -0
+}
+
+test_main() {
+	local mode;

No need for the trailing ;.

tests/vsp-unit-test-0020.sh line 71

Quoted 1 line
tests/vsp-unit-test-0020.sh new file +1 -0
+	local suspend_test_failures

This variable doesn't seem to be used.

Quoted 15 lines
tests/vsp-unit-test-0020.sh new file +15 -0
+
+	# Check for pm-suspend test option
+	if [ ! -e /sys/power/pm_test ] ; then
+		echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+		test_complete skip
+		return
+	fi;
+
+	for mode in $suspend_modes ; do
+		test_suspend_resume $mode
+	done;
+}
+
+test_init $0 "$features"
+test_run
Signature · 3 lines
Regards,

Laurent Pinchart
#12 lore raw

Re: [PATCH 4/5] tests: Test suspend/resume on idle pipelines

In reply to Kieran Bingham

Hi Kieran,

Thank you for the patch.

Quoted 31 lines · On Friday 25 Nov 2016 13:59:15 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Provide a test to verify the hardware is functional both before and after entering a suspend / resume cycle. Make use of the /sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform the testing

---
 tests/vsp-unit-test-0019.sh | 77 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100755 tests/vsp-unit-test-0019.sh
tests/vsp-unit-test-0019.sh new file +6 -0
new file mode 100755
index 000000000000..e7b94996c1aa
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are idle
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the

hardware
+# is operable while we perform test suspend and resume, and verify that it is

tests/vsp-unit-test-0019.sh new file +3 -0
+# still operable after resume.
+#
+# Format iteration loops are maintained, even with only one format so that
Quoted 4 lines

this
+# test can be easily extended to try further formats if needed in the future.
+#

I don't think testing multiple formats is needed, but I would like the test_wpf_packing() function to be called twice, to verify that stop -> start works fine after resume. You could specify two formats to achieve that (with a comment explaining why at least two formats should be specified).

Quoted 22 lines
tests/vsp-unit-test-0019.sh new file +22 -0
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+formats="RGB24"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"
+
+test_wpf_packing() {
+	test_start "Verify WPF packing in $format before/after suspend:$mode"
+
+	pipe_configure rpf-wpf 0 0
+	format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+	vsp_runner rpf.0 &
+	vsp_runner wpf.0
+
+	local result=$(compare_frames)
+
+	test_complete $result
+}
+

tests/vsp-unit-test-0019.sh line 45

Quoted 10 lines
tests/vsp-unit-test-0019.sh new file +10 -0
+test_hw_pipe() {
+	local format
+
+	for format in $formats ; do
+		test_wpf_packing $format
+	done
+}
+
+test_suspend_resume() {
+	local test_results=0

This variable is unused.

tests/vsp-unit-test-0019.sh line 58

Quoted 13 lines
tests/vsp-unit-test-0019.sh new file +13 -0
+
+	# Test the hardware each side of suspend resume
+	test_hw_pipe
+
+	# Set the test mode
+	echo $mode > /sys/power/pm_test
+
+	# Comence suspend
+	# The pm_test framework will automatically resume after 5 seconds
+	echo mem > /sys/power/state
+
+	# Verify the hardware is still operational
+	test_hw_pipe

Given that the goal is to test proper operation after resume, it would be better to call test_start and test_complete in this function, based on whether all the tests passed or not.

tests/vsp-unit-test-0019.sh line 62

Quoted 4 lines
tests/vsp-unit-test-0019.sh new file +4 -0
+}
+
+test_main() {
+	local mode;

No need for the trailing ;.

tests/vsp-unit-test-0019.sh line 69

Quoted 7 lines
tests/vsp-unit-test-0019.sh new file +7 -0
+
+	# Check for pm-suspend test option
+	if [ ! -e /sys/power/pm_test ] ; then
+		echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+		test_complete skip
+		return
+	fi;

Ditto.

tests/vsp-unit-test-0019.sh line 73

Quoted 4 lines
tests/vsp-unit-test-0019.sh new file +4 -0
+
+	for mode in $suspend_modes ; do
+		test_suspend_resume $mode
+	done;

Ditto.

Quoted 4 lines
tests/vsp-unit-test-0019.sh new file +4 -0
+}
+
+test_init $0 "$features"
+test_run
Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

Re: [PATCH 3/5] logger: Log to the FTrace buffer if tracing is enabled

In reply to Kieran Bingham

Hi Kieran,

Thank you for the patch.

Quoted 25 lines · On Friday 25 Nov 2016 13:59:14 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Extend the logger such that it will detect the tracing system, and also append print statement to this ring buffer.

This provides the relevant logging output interspersed in the ftrace logs for an effective solution to identifying the actions that caused the traces to occur

---
 scripts/logger.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
scripts/logger.sh +3 -0
index 8123f0c9f6e3..8412b0ba9a08 100755
@@ -6,6 +6,17 @@ now() {
 
 label=${1:+ [$1]}
 
+TRACE_MARKER=/sys/kernel/debug/tracing/trace_marker
+if [ -e $TRACE_MARKER ]; then
+	extra_log_files=$TRACE_MARKER

scripts/logger.sh now() { · line 20

Quoted 10 lines
scripts/logger.sh +8 -1
+fi
+
 while read line ; do
-	echo "$(now)$label $line"
+	newline="$(now)$label $line"
+
+	echo "$newline"
+
+	for f in $extra_log_files; do
+		echo "$newline" >> $f;

As the tracer adds a timestamp, should you echo "$label $line" only here ?

Quoted 2 lines
scripts/logger.sh +1 -0
+	done;
 done
Signature · 3 lines
Regards,

Laurent Pinchart
#5 lore raw

Re: [PATCH 2/5] scripts: Provide bin2png.sh helper

In reply to Kieran Bingham

Hi Kieran,

Thank you for the patch.

Quoted 38 lines · On Friday 25 Nov 2016 13:59:13 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Identify the size and format from the test output filename, and pass to raw2rgbpnm for conversion to a PNM file.

From there we can convert easily to a PNG output file.

---
 scripts/Makefile   |  2 +-
 scripts/bin2png.sh | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100755 scripts/bin2png.sh
scripts/Makefile +1 -1
index 8c452f4c54ce..6586b2989aed 100644
@@ -1,4 +1,4 @@
-SCRIPTS=logger.sh vsp-lib.sh
+SCRIPTS=$(wildcard *.sh)
 
 all:
 
scripts/bin2png.sh new file +5 -0
new file mode 100755
index 000000000000..527c5546514d
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+FILE="$1"
+
+fmt=$(echo $FILE | sed -e

's/.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin/\1/') +size=$(echo $FILE |
sed -e 's/.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin/\2/')

scripts/bin2png.sh

Quoted 3 lines
scripts/bin2png.sh new file +3 -0
+
+case $fmt in
+	yuv410m|yvu410m|yuv411m|yuv420m|yvu420m|yuv422m|yvu422m|yuv444m|

yvu444m)

Quoted 13 lines
scripts/bin2png.sh new file +13 -0
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+		fmt=`echo $fmt | tr 'M' 'P'`
+		;;
+	nv12m|nv21m|nv16m|nv61m)
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+		fmt=`echo $fmt | tr -d 'M'`
+		;;
+	argb555|xrgb555)
+		fmt=RGB555X
+		;;
+	argb32|xrgb32)
+		fmt=RGB32
+		;;

scripts/bin2png.sh line 32

Quoted 10 lines
scripts/bin2png.sh new file +10 -0
+	abgr32|xbgr32)
+		fmt=BGR32
+		;;
+	*)
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+		;;
+esac
+
+# Only run pnmtopng if the conversion to PNM succeeds
+raw2rgbpnm -s $size -f $fmt $FILE $FILE.pnm && \

How about stripping the .bin suffix to avoid calling the output file *.bin.png ?

scripts/bin2png.sh line 33

Quoted 1 line
scripts/bin2png.sh new file +1 -0
+	pnmtopng $FILE.pnm > $FILE.png

We already have a dependency on ImageMagick (although on the target side, not the host side). Shoould we use convert instead of pnmtopng ?

Quoted 1 line

+rm $FILE.pnm

Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

Re: [PATCH 2/5] scripts: Provide bin2png.sh helper

Hi Laurent,

Thanks for the review :D

Quoted 65 lines · Laurent Pinchart

Hi Kieran,

Thank you for the patch.

Quoted 38 lines · On Friday 25 Nov 2016 13:59:13 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Identify the size and format from the test output filename, and pass to raw2rgbpnm for conversion to a PNM file.

From there we can convert easily to a PNG output file.

---
 scripts/Makefile   |  2 +-
 scripts/bin2png.sh | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100755 scripts/bin2png.sh
scripts/Makefile +1 -1
index 8c452f4c54ce..6586b2989aed 100644
@@ -1,4 +1,4 @@
-SCRIPTS=logger.sh vsp-lib.sh
+SCRIPTS=$(wildcard *.sh)
 
 all:
 
scripts/bin2png.sh new file +5 -0
new file mode 100755
index 000000000000..527c5546514d
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+FILE="$1"
+
+fmt=$(echo $FILE | sed -e

's/.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin/\1/') +size=$(echo $FILE |
sed -e 's/.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin/\2/')

scripts/bin2png.sh

Quoted 3 lines
scripts/bin2png.sh new file +3 -0
+
+case $fmt in
+	yuv410m|yvu410m|yuv411m|yuv420m|yvu420m|yuv422m|yvu422m|yuv444m|

yvu444m)

Quoted 18 lines
scripts/bin2png.sh new file +18 -0
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+		fmt=`echo $fmt | tr 'M' 'P'`
+		;;
+	nv12m|nv21m|nv16m|nv61m)
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+		fmt=`echo $fmt | tr -d 'M'`
+		;;
+	argb555|xrgb555)
+		fmt=RGB555X
+		;;
+	argb32|xrgb32)
+		fmt=RGB32
+		;;
+	abgr32|xbgr32)
+		fmt=BGR32
+		;;
+	*)
+		fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
Quoted 8 lines

scripts/bin2png.sh line 32

Quoted 5 lines
scripts/bin2png.sh new file +5 -0
+		;;
+esac
+
+# Only run pnmtopng if the conversion to PNM succeeds
+raw2rgbpnm -s $size -f $fmt $FILE $FILE.pnm && \

How about stripping the .bin suffix to avoid calling the output file *.bin.png ?

Yeah, we can probably manage this :D

Quoted 4 lines

scripts/bin2png.sh line 33

Quoted 1 line
scripts/bin2png.sh new file +1 -0
+	pnmtopng $FILE.pnm > $FILE.png

We already have a dependency on ImageMagick (although on the target side, not the host side). Shoould we use convert instead of pnmtopng ?

Ahh - excellent plan. Actually I'd been using this script on the host only, using convert makes it easy to run this on the target as well.

That means in fact that I can convert 'bin' files from tmpfs storage and output small png's without hammering the network on NFS usage.

Sounds like a win to me !

Quoted 3 lines
Quoted 2 lines

+rm $FILE.pnm

#9 lore raw

Re: [PATCH 3/5] logger: Log to the FTrace buffer if tracing is enabled

In reply to Laurent Pinchart

Hi Laurent,

Quoted 27 lines · Laurent Pinchart

Hi Kieran,

Thank you for the patch.

Quoted 22 lines · On Friday 25 Nov 2016 13:59:14 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Extend the logger such that it will detect the tracing system, and also append print statement to this ring buffer.

This provides the relevant logging output interspersed in the ftrace logs for an effective solution to identifying the actions that caused the traces to occur

---
 scripts/logger.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
scripts/logger.sh +0 -0
index 8123f0c9f6e3..8412b0ba9a08 100755
@@ -6,6 +6,17 @@ now() {
 
 label=${1:+ [$1]}
 
Quoted 15 lines

scripts/logger.sh now() { · line 20

Quoted 13 lines
scripts/logger.sh +11 -1
+TRACE_MARKER=/sys/kernel/debug/tracing/trace_marker
+if [ -e $TRACE_MARKER ]; then
+	extra_log_files=$TRACE_MARKER
+fi
+
 while read line ; do
-	echo "$(now)$label $line"
+	newline="$(now)$label $line"
+
+	echo "$newline"
+
+	for f in $extra_log_files; do
+		echo "$newline" >> $f;

As the tracer adds a timestamp, should you echo "$label $line" only here ?

Hrm, yes it is possibly a little bit redundant...

My only argument would be that it will be a 'different' timestamp to the one logged by logger.sh.

Inspection of a recent log shows a difference of around 40-50 ms, which will be the latency between capturing the time in $(now) and passing the buffer to the kernel.

At this level though, the logger.sh is already susceptible to scheduler jitter anyway, so I'm not too worried about 40 ms. But anyone reading the logs will have to be aware of that extra latency.

Quoted 4 lines
Quoted 3 lines
scripts/logger.sh +1 -0
+	done;
 done
#13 lore raw

Re: [PATCH 4/5] tests: Test suspend/resume on idle pipelines

In reply to Laurent Pinchart
Quoted 37 lines · Laurent Pinchart

Hi Kieran,

Thank you for the patch.

Quoted 32 lines · On Friday 25 Nov 2016 13:59:15 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Provide a test to verify the hardware is functional both before and after entering a suspend / resume cycle. Make use of the /sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform the testing

---
 tests/vsp-unit-test-0019.sh | 77 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100755 tests/vsp-unit-test-0019.sh
tests/vsp-unit-test-0019.sh new file +6 -0
new file mode 100755
index 000000000000..e7b94996c1aa
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are idle
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the

hardware
+# is operable while we perform test suspend and resume, and verify that it is

tests/vsp-unit-test-0019.sh new file +3 -0
+# still operable after resume.
+#
+# Format iteration loops are maintained, even with only one format so that

this

Quoted 9 lines
Quoted 3 lines

+# test can be easily extended to try further formats if needed in the future.
+#

I don't think testing multiple formats is needed, but I would like the test_wpf_packing() function to be called twice, to verify that stop -> start works fine after resume. You could specify two formats to achieve that (with a comment explaining why at least two formats should be specified).

That sounds like a good plan.

Quoted 26 lines
Quoted 26 lines
tests/vsp-unit-test-0019.sh new file +26 -0
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+formats="RGB24"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"
+
+test_wpf_packing() {
+	test_start "Verify WPF packing in $format before/after suspend:$mode"
+
+	pipe_configure rpf-wpf 0 0
+	format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+	vsp_runner rpf.0 &
+	vsp_runner wpf.0
+
+	local result=$(compare_frames)
+
+	test_complete $result
+}
+
+test_hw_pipe() {
+	local format
+
+	for format in $formats ; do
Quoted 8 lines

tests/vsp-unit-test-0019.sh line 45

Quoted 6 lines
tests/vsp-unit-test-0019.sh new file +6 -0
+		test_wpf_packing $format
+	done
+}
+
+test_suspend_resume() {
+	local test_results=0

This variable is unused.

Bah, I missed some. I thought I'd cleaned these out before posting. :D

Quoted 9 lines
Quoted 9 lines
tests/vsp-unit-test-0019.sh new file +9 -0
+
+	# Test the hardware each side of suspend resume
+	test_hw_pipe
+
+	# Set the test mode
+	echo $mode > /sys/power/pm_test
+
+	# Comence suspend
+	# The pm_test framework will automatically resume after 5 seconds
Quoted 8 lines

tests/vsp-unit-test-0019.sh line 58

Quoted 4 lines
tests/vsp-unit-test-0019.sh new file +4 -0
+	echo mem > /sys/power/state
+
+	# Verify the hardware is still operational
+	test_hw_pipe

Given that the goal is to test proper operation after resume, it would be better to call test_start and test_complete in this function, based on whether all the tests passed or not.

Yes, I did go down this route - but stalled. Mainly in getting sensible return values from the $(compare_frames) which can be tracked through the functions.

I think it looked like I'd have to string match against, pass, skip, fail etc ... without a nice easy return value I can add to an integer.

This can be re-examined.

Quoted 6 lines

tests/vsp-unit-test-0019.sh line 62

Quoted 4 lines
tests/vsp-unit-test-0019.sh new file +4 -0
+}
+
+test_main() {
+	local mode;

No need for the trailing ;.

I think my hands are preprogrammed in 'c' coding style. Tough to get out of sometimes :D

Quoted 9 lines

tests/vsp-unit-test-0019.sh line 69

Quoted 7 lines
tests/vsp-unit-test-0019.sh new file +7 -0
+
+	# Check for pm-suspend test option
+	if [ ! -e /sys/power/pm_test ] ; then
+		echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+		test_complete skip
+		return
+	fi;

Ditto.

Ack.

Quoted 8 lines

tests/vsp-unit-test-0019.sh line 73

Quoted 5 lines
tests/vsp-unit-test-0019.sh new file +4 -0
+
+	for mode in $suspend_modes ; do
+		test_suspend_resume $mode
+	done;

Ditto.

Ack.

Quoted 5 lines
Quoted 4 lines
tests/vsp-unit-test-0019.sh new file +4 -0
+}
+
+test_init $0 "$features"
+test_run
#2 lore raw

Re: [PATCH 1/5] scripts: Test suite runner

In reply to Kieran Bingham

Hi Kieran,

Thank you for the patch.

Quoted 36 lines · On Friday 25 Nov 2016 13:59:12 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Provide a utility script to execute all vsp unit tests, as well as the option to execute multiple iterations of the suite.

---
 scripts/vsp-tests.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100755 scripts/vsp-tests.sh
scripts/vsp-tests.sh new file +19 -0
new file mode 100755
index 000000000000..e5ffa0ec4236
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+##
+## VSP Tests runner
+##
+## Automatically execute all vsp-unit tests
+## Move test failure results to a specific folder for
+## the running kernel version
+##
+## An argument can be provided to specify the number of
+## iterations to perform
+##
+## usage:
+##  ./vsp-tests.sh <n>
+##
+##   n: Number of iterations to execute test suite
+##
+
+KERNEL_VERSION=`uname -r`

scripts/vsp-tests.sh line 29

Quoted 10 lines
scripts/vsp-tests.sh new file +10 -0
+
+run_test() {
+	echo $1
+	./$1
+
+	if [ $(ls *.bin 2>/dev/null | wc -l) != 0 ];
+	then
+		RESULTS_DIR=$KERNEL_VERSION/test-$1/$2/
+
+		echo "Moving *.bin to test-$1/$2/";

You can remove the ; at the end of the lines.

scripts/vsp-tests.sh line 31

Quoted 2 lines
scripts/vsp-tests.sh new file +2 -0
+		mkdir -p $RESULTS_DIR;
+		echo "mv *.bin $RESULTS_DIR";

Do we really need this message ?

Quoted 15 lines
scripts/vsp-tests.sh new file +15 -0
+		mv *.bin $RESULTS_DIR;
+	fi;
+}
+
+run_suite() {
+	echo "Test loop $1"
+
+	for test in vsp-unit-test*.sh; do
+		run_test $test $1;
+	done;
+}
+
+for loop in `seq 1 1 $1`; do
+	run_suite $loop
+done;
Signature · 3 lines
Regards,

Laurent Pinchart
#10 lore raw

Re: [PATCH 3/5] logger: Log to the FTrace buffer if tracing is enabled

In reply to Kieran Bingham

Hi Kieran,

Quoted 48 lines · On Friday 25 Nov 2016 18:10:10 Kieran Bingham wrote:
Quoted 32 lines · Laurent Pinchart
Quoted 31 lines · On Friday 25 Nov 2016 13:59:14 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Extend the logger such that it will detect the tracing system, and also append print statement to this ring buffer.

This provides the relevant logging output interspersed in the ftrace logs for an effective solution to identifying the actions that caused the traces to occur

---

 scripts/logger.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
scripts/logger.sh +5 -0
index 8123f0c9f6e3..8412b0ba9a08 100755
@@ -6,6 +6,17 @@ now() {
 
 label=${1:+ [$1]}
 
+TRACE_MARKER=/sys/kernel/debug/tracing/trace_marker
+if [ -e $TRACE_MARKER ]; then
+	extra_log_files=$TRACE_MARKER
+fi
+
 
 while read line ; do
 
Quoted 9 lines

scripts/logger.sh now() { · line 20

Quoted 7 lines
scripts/logger.sh +6 -1
-	echo "$(now)$label $line"
+	newline="$(now)$label $line"
+
+	echo "$newline"
+
+	for f in $extra_log_files; do
+		echo "$newline" >> $f;

As the tracer adds a timestamp, should you echo "$label $line" only here ?

Hrm, yes it is possibly a little bit redundant...

My only argument would be that it will be a 'different' timestamp to the one logged by logger.sh.

Quoted 7 lines

Inspection of a recent log shows a difference of around 40-50 ms, which will be the latency between capturing the time in $(now) and passing the buffer to the kernel.

At this level though, the logger.sh is already susceptible to scheduler jitter anyway, so I'm not too worried about 40 ms. But anyone reading the logs will have to be aware of that extra latency.

If you think we should keep the timestamp I'm fine with that.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
scripts/logger.sh +1 -0
+	done;
 
 done
Signature · 3 lines
Regards,

Laurent Pinchart
#16 lore raw

Re: [PATCH 5/5] tests: Test suspend/resume on active pipelines

In reply to Laurent Pinchart

Hi Laurent,

Quoted 36 lines · Laurent Pinchart

Hi Kieran,

Thank you for the patch.

Quoted 31 lines · On Friday 25 Nov 2016 13:59:16 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Provide a test to verify the hardware completes a functional test whilst performing a suspend resume cycle in parallel. Make use of the /sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform the testing

---
 tests/vsp-unit-test-0020.sh | 86 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100755 tests/vsp-unit-test-0020.sh
tests/vsp-unit-test-0020.sh new file +6 -0
new file mode 100755
index 000000000000..5838295139b2
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are active
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the

hardware
+# is operable while we perform test suspend and resume, and verify that it is
+# still successful even with a suspend resume cycle in the middle of the test.
+#

Quoted 9 lines
Quoted 5 lines

+# Format iteration loops are maintained, even with only one format so that this
+# test can be easily extended to try further formats if needed in the future.
+#

Given that this test will suspend during the first iteration only I don't think it's very useful to keep the loop.

Agreed. Can you tell this test started it's life as vsp-unit-test-0019.sh ? :D

Quoted 11 lines

tests/vsp-unit-test-0020.sh line 20

Quoted 8 lines
tests/vsp-unit-test-0020.sh new file +8 -0
+
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+formats="RGB24"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"

How about extracting them from that file then ? :-) Or maybe just verifying they are available before trying to use them ?

I thought about that - and looked at it.

Annoyingly - /sys/power/pm_test contains none which would need to be filtered out, and also the active mode is surrounded by square brackets, which would also need filtering.

# cat /sys/power/pm_test
none core processors platform [devices] freezer

They are also in the reverse order of that which I wanted the tests to run.

All solvable, but I hadn't bothered as I thought it was possibly overkill. Of course extracting automatically does future proof us against different modes and changing mode-names - so it does sound like a valuable thing to do.

Quoted 21 lines
Quoted 21 lines
tests/vsp-unit-test-0020.sh new file +21 -0
+# This extended function performs the same
+# as it's non-extended name-sake - but runs the pipeline
+# for 300 frames. The suspend action occurs between frame #150~#200
+test_extended_wpf_packing() {
+	test_start "Verify WPF packing in $format during suspend:$mode"
+
+	pipe_configure rpf-wpf 0 0
+	format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+	vsp_runner rpf.0 --count=300 &
+	vsp_runner wpf.0 --count=300 --skip=297
+
+	local result=$(compare_frames)
+
+	test_complete $result
+}
+
+test_hw_pipe() {
+	local format
+
+	for format in $formats ; do
Quoted 9 lines

tests/vsp-unit-test-0020.sh line 48

Quoted 6 lines
tests/vsp-unit-test-0020.sh new file +6 -0
+		test_extended_wpf_packing $format
+	done
+}
+
+test_suspend_resume() {
+	local test_results=0

This variable doesn't seem to be used.

Another left over from when I was experimenting to get the return values before I was blocked by $(compare_frames) returning a string.

Quoted 7 lines
Quoted 7 lines
tests/vsp-unit-test-0020.sh new file +7 -0
+	local test_pid
+
+	# Test the hardware each side of suspend resume
+	test_hw_pipe &
+	test_pid=$!
+
+	# Make sure the pipeline has time to start
Quoted 8 lines

tests/vsp-unit-test-0020.sh line 61

Quoted 6 lines
tests/vsp-unit-test-0020.sh new file +6 -0
+	sleep 1
+
+	# Set the test mode
+	echo $mode > /sys/power/pm_test
+
+	# Comence suspend

Commence ?

Yes
Where can I get a terminal emulator with spell-check highlighting :D

Quoted 10 lines

tests/vsp-unit-test-0020.sh line 66

Quoted 6 lines
tests/vsp-unit-test-0020.sh new file +5 -0
+	# The pm_test framework will automatically resume after 5 seconds
+	echo mem > /sys/power/state
+
+	# Wait for the pipeline to complete
+	wait $test_pid

It would be nice to add a timeout here. Maybe something like the following (untested) ?

Quoted 8 lines
	(sleep 30 ; kill $test_pid) &
	kill_pid=$!
	wait $test_pid
	kill $kill_pid

test_complete should be called here based on both whether the frames compared successfully and whether the test timed out.

I agree that the test should have a timeout, and result determined, but scripting this in shell ... feels ugh :S

Its a shame we don't have gnu-timeout
- http://man7.org/linux/man-pages/man1/timeout.1.html(man 1 timeout)

Quoted 7 lines

tests/vsp-unit-test-0020.sh line 70

Quoted 4 lines
tests/vsp-unit-test-0020.sh new file +4 -0
+}
+
+test_main() {
+	local mode;

No need for the trailing ;.

Ack.

Quoted 3 lines

tests/vsp-unit-test-0020.sh line 71

Quoted 1 line
tests/vsp-unit-test-0020.sh new file +1 -0
+	local suspend_test_failures

This variable doesn't seem to be used.

Hrm .. maybe I forgot to do a fresh git-format-patch after I fixed these up :D

Quoted 17 lines
Quoted 16 lines
tests/vsp-unit-test-0020.sh new file +15 -0
+
+	# Check for pm-suspend test option
+	if [ ! -e /sys/power/pm_test ] ; then
+		echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+		test_complete skip
+		return
+	fi;
+
+	for mode in $suspend_modes ; do
+		test_suspend_resume $mode
+	done;
+}
+
+test_init $0 "$features"
+test_run
#3 lore raw

Re: [PATCH 1/5] scripts: Test suite runner

In reply to Laurent Pinchart
Quoted 54 lines · Laurent Pinchart

Hi Kieran,

Thank you for the patch.

Quoted 36 lines · On Friday 25 Nov 2016 13:59:12 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Provide a utility script to execute all vsp unit tests, as well as the option to execute multiple iterations of the suite.

---
 scripts/vsp-tests.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100755 scripts/vsp-tests.sh
scripts/vsp-tests.sh new file +19 -0
new file mode 100755
index 000000000000..e5ffa0ec4236
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+##
+## VSP Tests runner
+##
+## Automatically execute all vsp-unit tests
+## Move test failure results to a specific folder for
+## the running kernel version
+##
+## An argument can be provided to specify the number of
+## iterations to perform
+##
+## usage:
+##  ./vsp-tests.sh <n>
+##
+##   n: Number of iterations to execute test suite
+##
+
+KERNEL_VERSION=`uname -r`

scripts/vsp-tests.sh line 29

Quoted 10 lines
scripts/vsp-tests.sh new file +10 -0
+
+run_test() {
+	echo $1
+	./$1
+
+	if [ $(ls *.bin 2>/dev/null | wc -l) != 0 ];
+	then
+		RESULTS_DIR=$KERNEL_VERSION/test-$1/$2/
+
+		echo "Moving *.bin to test-$1/$2/";

You can remove the ; at the end of the lines.

Quoted 4 lines

scripts/vsp-tests.sh line 31

Quoted 2 lines
scripts/vsp-tests.sh new file +2 -0
+		mkdir -p $RESULTS_DIR;
+		echo "mv *.bin $RESULTS_DIR";

Do we really need this message ?

We certainly don't need two :D.

I'll combine the best bits of them both :D
echo "Moving test failures to $RESULTS_DIR";

And in fact, now that bin2png.sh works on the target - this could also generate the PNG files immediately which would be useful.

Quoted 16 lines
Quoted 15 lines
scripts/vsp-tests.sh new file +15 -0
+		mv *.bin $RESULTS_DIR;
+	fi;
+}
+
+run_suite() {
+	echo "Test loop $1"
+
+	for test in vsp-unit-test*.sh; do
+		run_test $test $1;
+	done;
+}
+
+for loop in `seq 1 1 $1`; do
+	run_suite $loop
+done;
Signature · 3 lines
Regards

Kieran Bingham
#17 lore raw

Re: [PATCH 5/5] tests: Test suspend/resume on active pipelines

In reply to Kieran Bingham

Hi Kieran,

Quoted 67 lines · On Friday 25 Nov 2016 18:40:34 Kieran Bingham wrote:
Quoted 33 lines · Laurent Pinchart
Quoted 32 lines · On Friday 25 Nov 2016 13:59:16 Kieran Bingham wrote:

From: Kieran Bingham <[email protected]>

Provide a test to verify the hardware completes a functional test whilst performing a suspend resume cycle in parallel. Make use of the /sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform the testing

---

 tests/vsp-unit-test-0020.sh | 86 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100755 tests/vsp-unit-test-0020.sh
tests/vsp-unit-test-0020.sh new file +6 -0
new file mode 100755
index 000000000000..5838295139b2
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are active
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the

hardware
+# is operable while we perform test suspend and resume, and verify that it is
+# still successful even with a suspend resume cycle in the middle of the test.
+#

Quoted 8 lines
Quoted 5 lines

+# Format iteration loops are maintained, even with only one format so that this
+# test can be easily extended to try further formats if needed in the future.
+#

Given that this test will suspend during the first iteration only I don't think it's very useful to keep the loop.

Agreed. Can you tell this test started it's life as vsp-unit-test-0019.sh ? :D

Quoted 11 lines

tests/vsp-unit-test-0020.sh line 20

Quoted 8 lines
tests/vsp-unit-test-0020.sh new file +8 -0
+
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+formats="RGB24"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"

How about extracting them from that file then ? :-) Or maybe just verifying they are available before trying to use them ?

I thought about that - and looked at it.

Annoyingly - /sys/power/pm_test contains none which would need to be filtered out, and also the active mode is surrounded by square brackets, which would also need filtering.

# cat /sys/power/pm_test
none core processors platform [devices] freezer
Quoted 6 lines

They are also in the reverse order of that which I wanted the tests to run.

All solvable, but I hadn't bothered as I thought it was possibly overkill. Of course extracting automatically does future proof us against different modes and changing mode-names - so it does sound like a valuable thing to do.

You're right that it might be overkill, it's up to you. If you want to keep the list of modes here to select the order, you could do a

grep -q $mode /sys/power/pm_test || continue

(or something similar possibly with a message being printed to inform that the test is skipped)

Even that might be overkill though.

Quoted 66 lines
Quoted 21 lines
Quoted 21 lines
tests/vsp-unit-test-0020.sh new file +21 -0
+# This extended function performs the same
+# as it's non-extended name-sake - but runs the pipeline
+# for 300 frames. The suspend action occurs between frame #150~#200
+test_extended_wpf_packing() {
+	test_start "Verify WPF packing in $format during suspend:$mode"
+
+	pipe_configure rpf-wpf 0 0
+	format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+	vsp_runner rpf.0 --count=300 &
+	vsp_runner wpf.0 --count=300 --skip=297
+
+	local result=$(compare_frames)
+
+	test_complete $result
+}
+
+test_hw_pipe() {
+	local format
+
+	for format in $formats ; do
Quoted 8 lines

tests/vsp-unit-test-0020.sh line 48

Quoted 6 lines
tests/vsp-unit-test-0020.sh new file +6 -0
+		test_extended_wpf_packing $format
+	done
+}
+
+test_suspend_resume() {
+	local test_results=0

This variable doesn't seem to be used.

Another left over from when I was experimenting to get the return values before I was blocked by $(compare_frames) returning a string.

Quoted 7 lines
Quoted 7 lines
tests/vsp-unit-test-0020.sh new file +7 -0
+	local test_pid
+
+	# Test the hardware each side of suspend resume
+	test_hw_pipe &
+	test_pid=$!
+
+	# Make sure the pipeline has time to start
Quoted 8 lines

tests/vsp-unit-test-0020.sh line 61

Quoted 6 lines
tests/vsp-unit-test-0020.sh new file +6 -0
+	sleep 1
+
+	# Set the test mode
+	echo $mode > /sys/power/pm_test
+
+	# Comence suspend

Commence ?

Yes
Where can I get a terminal emulator with spell-check highlighting :D

Quoted 14 lines

tests/vsp-unit-test-0020.sh line 66

Quoted 5 lines
tests/vsp-unit-test-0020.sh new file +5 -0
+	# The pm_test framework will automatically resume after 5 seconds
+	echo mem > /sys/power/state
+
+	# Wait for the pipeline to complete
+	wait $test_pid

It would be nice to add a timeout here. Maybe something like the following (untested) ?

	(sleep 30 ; kill $test_pid) &
	kill_pid=$!
	wait $test_pid
	kill $kill_pid
Quoted 8 lines
Quoted 2 lines

test_complete should be called here based on both whether the frames compared successfully and whether the test timed out.

I agree that the test should have a timeout, and result determined, but scripting this in shell ... feels ugh :S

Its a shame we don't have gnu-timeout
- http://man7.org/linux/man-pages/man1/timeout.1.html(man 1 timeout)

Would the busybox version of timeout work ? If so we could make that a requirement.

Quoted 31 lines
Quoted 6 lines

tests/vsp-unit-test-0020.sh line 70

Quoted 4 lines
tests/vsp-unit-test-0020.sh new file +4 -0
+}
+
+test_main() {
+	local mode;

No need for the trailing ;.

Ack.

Quoted 3 lines

tests/vsp-unit-test-0020.sh line 71

Quoted 1 line
tests/vsp-unit-test-0020.sh new file +1 -0
+	local suspend_test_failures

This variable doesn't seem to be used.

Hrm .. maybe I forgot to do a fresh git-format-patch after I fixed these up :D

Quoted 15 lines
Quoted 15 lines
tests/vsp-unit-test-0020.sh new file +15 -0
+
+	# Check for pm-suspend test option
+	if [ ! -e /sys/power/pm_test ] ; then
+		echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+		test_complete skip
+		return
+	fi;
+
+	for mode in $suspend_modes ; do
+		test_suspend_resume $mode
+	done;
+}
+
+test_init $0 "$features"
+test_run
Signature · 3 lines
Regards,

Laurent Pinchart