summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-05-27 11:50:07 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-06-19 15:26:01 +0300
commitb5f052feec329a39d4f176ef07f9b99370c7583d (patch)
treeb2df6a35dd357bc575b5891a42b9bf24fa37d0c5 /scripts
parentfd30af3f493394ec72b3d942f759c43d8167cacb (diff)
vsp-lib: Support optional features for tests
Add a third argument to test_init() to pass a list of optional features. If more than one media device supports all the required features, select the one that supports the highest number of optional features. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vsp-lib.sh29
1 files changed, 26 insertions, 3 deletions
diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh
index c5db772..d48108a 100755
--- a/scripts/vsp-lib.sh
+++ b/scripts/vsp-lib.sh
@@ -460,10 +460,13 @@ format_configure() {
test_init() {
logfile=${1/sh/log}
features=$2
+ optional_features=$3
rm -f $logfile
rm -f *.bin
+ best_features_count=0
+
for mdev in /dev/media* ; do
match='true'
for feature in $features ; do
@@ -473,17 +476,37 @@ test_init() {
}
done
- if [ $match == 'true' ] ; then
+ if [ $match == 'false' ] ; then
+ continue
+ fi
+
+ if [ -z "$optional_features" ] ; then
+ best_mdev=$mdev
break
fi
+
+ features_count=0
+ for feature in $optional_features ; do
+ $(vsp1_has_feature $feature) && {
+ features_count=$((features_count+1))
+ match='false';
+ break;
+ }
+ done
+
+ if [ $features_count -ge $best_features_count ] ; then
+ best_mdev=$mdev
+ best_features_count=$features_count
+ fi
done
- if [ $match == 'false' ] ; then
+ if [ -z $best_mdev ] ; then
echo "No device found with feature set $features" | ./logger.sh config >> $logfile
exit 1
fi
- dev=$(vsp1_device $mdev)
+ mdev=$best_mdev
+ dev=$(vsp1_device $best_mdev)
echo "Using device $mdev ($dev)" | ./logger.sh config >> $logfile
vsp_runner=./vsp-runner.sh