Commit graph

246 commits

Author SHA1 Message Date
Kevin Rocard
b6d79ff112 Audio VTS: Create utility lib
Move code that can be reuse between audio tests of the HIDL interface in
an utility library.

Test: run vts tests
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Bug: 35700978

Change-Id: Ia930ad2b0a3ca31628b2cb767b265d54b210756b
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-06-05 11:22:24 -07:00
Kevin Rocard
06a2a40309 Audio VTS: Enforce policy configuration format
Validate the audio_policy_configuration.xml supplied in /vendor against
the format schema.

Test: Run the VTS test on target
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Bug: 35700978
Change-Id: I800e692a6ff4f64655007c33af7e34d879ee1132
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-06-02 16:24:43 -07:00
Mikhail Naganov
7cd76c1469 VTS Audio Effect: Do not check the result of IEffect::offload method am: 5abb15e987
am: dd5605c4fb

Change-Id: I98d3bd958af9266b97830c098d282f4760974cef
2017-06-02 18:31:08 +00:00
Mikhail Naganov
dd5605c4fb VTS Audio Effect: Do not check the result of IEffect::offload method
am: 5abb15e987

Change-Id: I266ac43808d0e9002822ea4d589d17bfc9995d84
2017-06-02 18:23:54 +00:00
Mikhail Naganov
5abb15e987 VTS Audio Effect: Do not check the result of IEffect::offload method
HAL may not support offloading, and a call to IEffect::offload
is allowed to return an error code.

Update the test to only check that the call to the method doesn't
crash.

Bug: 38437110
Test: still passes
Change-Id: I6cfd25998edb9c68d2e585e572ba8ba3a3427e98
2017-06-02 15:54:43 +00:00
Eric Laurent
9c21837d1f Merge "Audio: Add XML schema for audio policy configuration" into oc-dev am: 49f3b03348
am: e18fdf9ea7

Change-Id: I91958de424207ceac6bb3a8a3f662e6f814b6e84
2017-06-01 20:28:10 +00:00
Eric Laurent
e18fdf9ea7 Merge "Audio: Add XML schema for audio policy configuration" into oc-dev
am: 49f3b03348

Change-Id: Ifc0584bb4c03deb9ed2139f9b5f9b5c5df1c6782
2017-06-01 20:01:20 +00:00
TreeHugger Robot
49f3b03348 Merge "Audio: Add XML schema for audio policy configuration" into oc-dev 2017-06-01 19:56:21 +00:00
Mikhail Naganov
25e11c3a7e Merge "Revert "audiohal: Add diagnostics to investigate HAL call crashes"" into oc-dev am: 5482fe026c
am: f652c9e031

Change-Id: I7de1922316cb85789cc4cbf13fe70509de61032e
2017-06-01 16:40:08 +00:00
Mikhail Naganov
f652c9e031 Merge "Revert "audiohal: Add diagnostics to investigate HAL call crashes"" into oc-dev
am: 5482fe026c

Change-Id: I2a0d9aa82ec5cc2d6c593ae08f7b58ca91747860
2017-06-01 16:37:07 +00:00
TreeHugger Robot
5482fe026c Merge "Revert "audiohal: Add diagnostics to investigate HAL call crashes"" into oc-dev 2017-06-01 16:32:29 +00:00
Eric Laurent
524bdd39bf Audio: Add XML schema for audio policy configuration
The schema describes the XML format for audio policy
configuration.
It will be enforced in a follow up vts test.

Bug: 35700978
Test: schema is parsed with xmllint with no errors
Test: xmllint  --xinclude --noout --schema audio_policy_configuration.xsd  out/target/product/sailfish/vendor/etc/audio_policy_configuration.xml

Change-Id: Ic6830446b54b3e02e4bca9b0a392523a8fb359e1
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-31 15:29:17 -07:00
Mikhail Naganov
f811acf049 Revert "audiohal: Add diagnostics to investigate HAL call crashes"
This reverts commit 6c0f76a684.

Since the root cause of the crash has been established, there is no need to keep this code around.

Bug: 36225019
Change-Id: I74e570e863a0cdec5d9029f1672e2e8066c246b5
2017-05-31 19:59:21 +00:00
Kevin Rocard
07fb7363bc Revert "Temporary disable tests failing tests for O"
This commit was never intended to be merged in master but it could not
be avoided due to an automerger limitation.

This reverts commit fd297c6f8e.
Test: Run VTS
Bug: 36311550

Change-Id: I6ee23a6282c29b125e53cced0cfcc6b697754ce0
2017-05-26 17:41:31 -07:00
Mikhail Naganov
61de2b1f4a Audio: Add XML schema for audio effects configuration
The schema describes the new XML format for audio effects
configuration.

Bug: 37492580
Test: schema is parsed with xmllint with no errors
Change-Id: I5dd33c6806cace5cb66457e1a072bda51ee11294
2017-05-24 20:02:29 +00:00
TreeHugger Robot
9b15ddfff5 Merge "audiohal: Prevent logspam when calling get_presentation_position" 2017-05-23 22:34:13 +00:00
Kevin Rocard
54b4d1b2d0 Merge "Temporary disable tests failing tests for O" into oc-dev am: ed8c71e480
am: b7e2957ad5

Change-Id: I639e310bbcd1da5f12263d39dbec54e7aa8ebe0d
2017-05-23 21:53:19 +00:00
Kevin Rocard
b7e2957ad5 Merge "Temporary disable tests failing tests for O" into oc-dev
am: ed8c71e480

Change-Id: Ib0681b212b0e9e568004c6b07e66a61bb31ea371
2017-05-23 21:48:04 +00:00
TreeHugger Robot
ed8c71e480 Merge "Temporary disable tests failing tests for O" into oc-dev 2017-05-23 21:39:11 +00:00
Mikhail Naganov
96a3a19bed audiohal: Prevent logspam when calling get_presentation_position
get_presentation_position can return ENODATA if the stream
has stopped but the write is still querying the position.

Bug: 38376424
Change-Id: I9d516a19fb347843a8ec8e8e9a0f5eab0b0798e6
Test: no log messages from StreamHAL about get_presentation_position
2017-05-23 21:03:36 +00:00
Steven Moreland
7708449766 Update makefiles. (2/2) am: 76cfb84140
am: f203167814

Change-Id: I1f13401266f3c2f78c627088b09c79cd7c8d0276
2017-05-22 17:29:04 +00:00
Steven Moreland
f203167814 Update makefiles. (2/2)
am: 76cfb84140

Change-Id: I24d21438a5b2f447d2160929c6ff6e17b2b66820
2017-05-22 17:15:20 +00:00
Steven Moreland
76cfb84140 Update makefiles. (2/2)
Adds default configuration for all hals.

Bug: 38415912
Test: pass
Change-Id: Idd1f3a2b7b16ad956d31784a513e93a066cdd02e
2017-05-19 15:54:03 -07:00
Mikhail Naganov
95fa26f096 Merge "VTS Audio Effect: Allow 'NOT_SUPPORTED' from IEffect::offload method" into oc-dev am: 2bb2add8a9
am: 2d6f470495

Change-Id: Ibc558b4ca5af3e03c7eddff43450779c2026b118
2017-05-19 20:40:49 +00:00
Mikhail Naganov
2d6f470495 Merge "VTS Audio Effect: Allow 'NOT_SUPPORTED' from IEffect::offload method" into oc-dev
am: 2bb2add8a9

Change-Id: I4002f571964e615ec0e8357468cbf037fbdb0a43
2017-05-19 20:35:34 +00:00
Mikhail Naganov
c11724572e VTS Audio Effect: Allow 'NOT_SUPPORTED' from IEffect::offload method
HAL may not support offloading, and a call to IEffect::offload
is allowed to return an error code.

Update the test to accept either OK or NOT_SUPPORTED.

Bug: 38437110
Test: still passes
Change-Id: I1822010eed73f61bb0e0ae1852739b47fa72eade
2017-05-19 11:29:28 -07:00
Eric Laurent
3510657437 Merge "audio HAL: fix getParameters status check." into oc-dev am: af7bc59c0a
am: 7f7a0a880c

Change-Id: Ib1663485edb5abf7322ad0ef197e821ba5e21ba8
2017-05-18 17:47:36 +00:00
Eric Laurent
7f7a0a880c Merge "audio HAL: fix getParameters status check." into oc-dev
am: af7bc59c0a

Change-Id: Icd5926031ace47bc0dc1b1f24cb48e107851fcd7
2017-05-18 17:37:02 +00:00
Eric Laurent
45d4032215 audio HAL: fix getParameters status check.
Bug: 38326193
Test: VTS tests for module VtsHalAudioV2_0TargetTest.

Change-Id: If4109cea68120d722a3b1084ad583170e950cfa0
2017-05-17 18:38:47 -07:00
Kevin Rocard
fd297c6f8e Temporary disable tests failing tests for O
Those tests are failing because their fix
(I0ea1a4bf952527ac0711ed3cdd31c6aa53db4d2e) is dangerous to merge in O
so close to the final release.

The fix implements a rejection feature for unsupported audio format.
This rejection is required by the hal interface
but was only partially implemented in the hal.
The problem is that the framework was never tested with a hal supporting
this behavior nor some calls implemented with this requirement.
As a result I do not feel confident in merging it in oc-dev,
it might complex, hard to detect bugs.

The fix will be merged in master thus will be part of mr1.
The current patch will be reverted in master after the fix is merged.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ia9e1dcec5442e2755f0bcb13d8d502663f507dbe
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-17 15:54:09 -07:00
Kevin Rocard
6ade5e3c1b Merge changes from topic 'audio-primary-hal-vts-fix' into oc-dev am: c558ddf3fa
am: cdf142d8dd

Change-Id: I3429df38464282106bef8464a4852bd5b29f763d
2017-05-16 19:33:39 +00:00
Kevin Rocard
cdf142d8dd Merge changes from topic 'audio-primary-hal-vts-fix' into oc-dev
am: c558ddf3fa

Change-Id: I15868923cdfd165e20468d1c885a256fefd0eeca
2017-05-16 19:13:11 +00:00
Kevin Rocard
a1d6ea4ba7 Audio HAL: A speech volume outside of [0,1] is an error
Hals are supposed to received normalized volumes, between 0 and 1.
Previously volumes outside [0,1] were clamp to this range.
This clamping has the capability to hide bugs thus return an error if
such volume is received.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Iab70f9c651540ea2434d10939d28c1c842db19e0
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-15 14:51:28 -07:00
Chih-Hung Hsieh
7eb57b60ab Remove unused lambda capture
New clang compiler gives warning to unused lambda captures.
Apply clang-format.

Bug: 37423073
Test: Build

Change-Id: Icdf019df1a6c9dcadeb35551377d7afa09eebb3e
2017-05-15 14:02:45 -07:00
Kevin Rocard
fcf186bd59 Audio HAL VTS: Some methods are not optional
Some mandatory methods were allowed to return NOT_SUPPORTED
although their implementations is mandatory.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ibe4b3cf73257309975ed11269a38315051fa9064
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-12 16:02:30 -07:00
Kevin Rocard
c8e1b1dadc Merge changes from topic 'audio-primary-hal-vts-fix' into oc-dev
am: 257c2f1a43

Change-Id: Ic8850d915b5672e7529f99e7d57845b2de44857a
2017-05-12 06:57:47 +00:00
Kevin Rocard
257c2f1a43 Merge changes from topic 'audio-primary-hal-vts-fix' into oc-dev
* changes:
  Audio HAL: A volume/gain outside of [0,1] is an error
  Audio HAL VTS: Log test unexpected behaviour
  Audio HAL VTS: Improve ASSERT of Result and Return
  Audio HAL VTS: stopped stream state getters may return INVALID_STATE
  Audio HAL VTS: setGain allow -0.0
  Audio HAL VTS: Some methods are optional
  Audio HAL VTS: GetPresentationPosition may return 0 on stop stream
  Audio HAL VTS: getDevice() == NONE => not supported
  Audio HAL VTS: Getter test assert logic was incorrect
  Audio HAL VTS: debugDump can only test for crash
  Audio HAL VTS: Sanitize prepareFor{Writing,Reading} input size
  Audio HAL VTS: refactor prepareFor{Reading,Writing}
  Audio HAL VTS: Sanitize setMode input
  Audio HAL VTS: Allow OK when setting a non existing parameter
  Audio HAL VTS: differentiate getParam success/failure/not_implemented
  Audio HAL VTS: Fix style on modified files
2017-05-11 22:34:40 +00:00
Steven Moreland
a32ebce372 Update makefiles for c++-sources and c++-headers. (2/2)
am: bc71124120

Change-Id: Icf36068a4d863a8520854c7a83e51f960c188e12
2017-05-11 00:48:55 +00:00
Steven Moreland
bc71124120 Update makefiles for c++-sources and c++-headers. (2/2)
Test: pass
Bug: 38174080
Change-Id: Icad451f9f9ad5f46412356a4171a8a1222f8e545
2017-05-09 19:58:43 -07:00
Kevin Rocard
4c030024df Audio HAL: A volume/gain outside of [0,1] is an error
Hals are supposed to received normalized volumes, between 0 and 1.
Previously volumes outside [0,1] were clamp to this range.
This clamping has the capability to hide bugs thus return an error if
such volume is received.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ia4880bdff6111cbcdae6a4ebee921eddae141ee4
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 18:28:12 -07:00
Kevin Rocard
96f46c4a23 Audio HAL VTS: Log test unexpected behaviour
Some test output infos that are useful to understand how they run.
Unfortunately the xml report does not seem to be saved by VTS tradefed.
Thus output them in logcat.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I9a2cc10160c3b1c8f81db0464efbc6b26600cadc
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:03 -07:00
Kevin Rocard
f26f67a16b Audio HAL VTS: Improve ASSERT of Result and Return
Previously tests on Result and Return were using ASSERT_NO_FATAL_FAILURE
and helper methods.
This leaded to complex error messages were the error did not pointed to
the helper methods instead of the ASSERT_RESULT call.
Additionally SCOPE_TRACE messages are repeated
for each ASSERT_NO_FATAL_FAILURE level.

Use ::testing::AssertionResult to improve drastically the error messages.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: If705502546606d678df3f1966b0cd9f3ef8c2529
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
304b6c810e Audio HAL VTS: stopped stream state getters may return INVALID_STATE
A never started stream should have its render position and next write
timestamp at 0 or indicate that the state is invalid.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I62e16066bb22101ee8f75154fc6c85a66be2f402
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
c4f1b2f86a Audio HAL VTS: setGain allow -0.0
Previously -0.0 was consider an invalid value as not in the range [0,1].
But it is quite difficult in C++ to differentiate -0.0 and 0.0 as -0.0 == 0.0
and such difference has no impact in practice.

Thus leave the implementation support or not -0.0.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ia0ebcb325f77adcf8471620f418da1cbe8995e36
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
98390a6c2c Audio HAL VTS: Some methods are optional
Although the method documentation does not say it,
some HIDL interface methods are optional.

Update the tests to allow NOT_SUPPORTED to be returned.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: If31acc2dbdb6d1d563910e85c99401c48f4f3f86
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
476e38fd31 Audio HAL VTS: GetPresentationPosition may return 0 on stop stream
GetPresentationPosition returns the last time a sample was written to
the hardware.
Calling it on a stop stream should return 0 sample written, but the
timestamps of that measure is of little importance.
Thus allow this timestamp to be 0 indicating that the measure was never
actually made.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I3c33b60f98e8cbea269a7739cc1889af932dcff5
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
8f8730c762 Audio HAL VTS: getDevice() == NONE => not supported
getDevice does not return a Result, thus it can not return NOT_SUPPORTED.
Consider NONE as not supported.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I3b6f7a1fbc1d1535faf549f5b031461cb39d1722
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
4aefd1c1ff Audio HAL VTS: Getter test assert logic was incorrect
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Iaf2d71829a15b12dcf56e825773c8a697896a264
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
5e5783daef Audio HAL VTS: debugDump can only test for crash
DebugDump does not return an error code, thus the implementation can not
return not implemented.

As a result, the test can not expect any output from the function.
Only test that the call does not crash and add a log if the function is
probably not implemented in the test.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I2c18958bceb1eb638491f9afce9d8e8025ccd3ec
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
195205b323 Audio HAL VTS: Sanitize prepareFor{Writing,Reading} input size
Return an error if framesCount or frameSize are null to avoid a division
by zero when calculating the buffer size.

The message queues are allocated with a buffer size but if two big they will
assert not return an error.
Thus take some margin on the buffer size check.

Note that both function should be refactored as 99% identical.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I0576e9016ef2e567c8d4e171c6237883d9865db9
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00