Android CTS Verifier Sensor Test Cases (6)

3 篇文章 1 订阅
2 篇文章 0 订阅

5. CTS Sensor Integration Tests

按照 Sensor Interaction 的要求:

Android sensors must be able to work simultaneously and independently of one another. That is, any action on one Android sensor must not impact the behavior of the other sensors.

Specifically, at the HAL level:

  -  activating a sensor
  -  deactivating a sensor
  -  changing the sampling frequency of a sensor
  -  changing the maximum reporting latency of a sensor

cannot cause:

  -  another activated sensor to stop working
  -  another activated sensor to change sampling rate
  -  another activated sensor to decrease the quality of its measurements
  -  another non-activated sensor to start delivering events

Nor can any of the actions above prevent actions (activation, deactivation, and parameter changes) on another sensor from succeeding. For instance, whether we can activate the step counter must be independent of whether the accelerometer is currently activated. 

集成测试的目的在于检测不同客户 (client) 操作同一个 sensor 或不同的 senso r时,sensor 是否工作正常。

测试规则

1) 相同 odr 设置的新的 client 不应该影响其它正在使用该 sensor 的 clients。即原有的 clients, 仍然正常的接收该 sensor 的数据 (时间戳的顺序);

2) 多个 clients 同时使用相同 sensor 时,如果最新打开该 sensor 的 client 设置的 odr 最高,则其他 clients 将以这个最高的 odr 接收该 sensor 的数据;如果最新打开 sensor 的 client 设置的 odr 比原有 clients 设置的低,则该 odr 不起作用,sensor 仍将按照这些 clients 里设置最高的 odr 运行;

3) 一个 sensor 的打开关闭或更改 odr 不应该影响到另外一个 sensor 的正常功能使用。例如打开关闭 Accelerometer 不影响 Gyroscope 的数据;

测试项

1) testAccelerometerGyroscopeStopping, 9个用例检测Acceleormeter, Gyroscope 和 Magnetic Filed 三个 sensor 之间任意组合的打开关闭操作对数据的上报顺序(testSensorsWithSeveralClients)是否有影响;

2) testSensorsMovingRates, 测试Accelerometer, Gyroscope, Magnetic Field 三个 sensor 分别有 5 个不同的 clients 操作 100 次随机的 data rate 的设置下数据的 EventOrderingVerification 验证测试;

3) testSensorsWithSeveralClients, 测试Accelerometer, Gyroscope, Magnetic Filed 三个 sensor 分别有 50 个 clients 做 continuousOperation 和 batchingOperation 测试。对这两类测试收集的数据进行 EventOrderingVerification 验证。

其中 EventOrderingVerification 又分为:

* testNoEvents, 是否没有数据;
* testSequentialTimestamp, 是否数据的时间戳是递增;
* testSingleOutofOrder, 是否单个数据上报的顺序混乱;
* testMultipleOutOfOrder, 是否多个数据上报的顺序混乱;

失败分析
下面这个测试失败是因为 testNoEvents 测试没有通过。在设置的时间内CTS Verifier 没有收到数据。

testSensorsMovingRates | FAIL | testSensorsMovingRates(android.hardware.cts.SensorIntegrationTests): java.lang.AssertionError: Operation 4 failed: "WaitForEvents | sensor='Magnetic Field Sensor', samplingPeriodUs=0, maxReportLatencyUs=1000000 | requested:100, received:0", java.lang.AssertionError: Operation 5 failed: "WaitForEvents | sensor='Magnetic Field Sensor', samplingPeriodUs=300000, maxReportLatencyUs=1000000 | requested:100, received:0", java.lang.AssertionError: Operation 2 failed: "WaitForEvents | sensor='Magnetic Field Sensor', samplingPeriodUs=0, maxReportLatencyUs=2000000 | requested:100, received:0", java.lang.AssertionError: Operation 1 failed: "WaitForEvents | sensor='Magnetic Field Sensor', samplingPeriodUs=0, maxReportLatencyUs=1000000 | requested:100, received:0", java.lang.AssertionError: Operation 2 failed: "WaitForEvents | sensor='Magnetic Field Sensor', samplingPeriodUs=0, maxReportLatencyUs=1000000 | requested:100, received:0", 
testSensorsWithSeveralClients | FAIL | testSensorsWithSeveralClients(android.hardware.cts.SensorIntegrationTests): java.lang.AssertionError: Iteration 10 failed: "WaitForEvents | sensor='Acceleration Sensor', samplingPeriodUs=0, maxReportLatencyUs=0 | requested:100, received:0", java.lang.AssertionError: Iteration 18 failed: "WaitForEvents | sensor='Acceleration Sensor', samplingPeriodUs=5000, maxReportLatencyUs=5000000 | requested:100, received:0", 

这个则属于 events out of oder 失败,错误提示多少个数据顺序发现错误,在第几个,前一个数据的时间戳,当前数据的时间戳等等信息。
这里写图片描述

要通过该项测试,driver & HAL 需要保证:

1) sensor 工作正常,打开则可以上报数据,关闭则停止上报数据;
2) 每个 sensor 的数据严格按照时间递增顺序上报,不允许出现新数据的时间戳比旧数据时间戳小的情况;


SensorIntegrationTests.java
EventOrderingVerification.java
EventOrderingVerificationTest.java

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值