[PATCH v3 5/7] android/tester: Refractor properties veryfying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pre condition for properties veryfying is to have set expected
properties in step - there is no need to check it inside veryfying
function. However veryfying function should check if number of expected
or received number of properties is valid. If properties are expected
but number of them is 0, test should fail.
---
 android/tester-main.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/android/tester-main.c b/android/tester-main.c
index 152459d..a8a7bd3 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -501,6 +501,15 @@ static int verify_property(bt_property_t *exp_props, int exp_num_props,
 	int i, j;
 	int exp_prop_to_find = exp_num_props;
 
+	if (rec_num_props == 0)
+		return 1;
+
+	if (exp_num_props == 0) {
+		tester_debug("Wrong number of expected properties given");
+		tester_test_failed();
+		return 1;
+	}
+
 	/* Get first exp prop to match and search for it */
 	for (i = 0; i < exp_num_props; i++) {
 		for (j = 0; j < rec_num_props; j++) {
@@ -511,14 +520,6 @@ static int verify_property(bt_property_t *exp_props, int exp_num_props,
 		}
 	}
 
-	if ((i == 0) && exp_props) {
-		tester_warn("No property was verified: %s", exp_num_props ?
-				"unknown error!" :
-				"wrong \'.callback_result.num_properties\'?");
-
-		return 1;
-	}
-
 	return exp_prop_to_find;
 }
 
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux