Merge "Fix file paths for DumpstateUtil calls in 1.0"
diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp
index 390d4ee..070242f 100644
--- a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp
@@ -155,11 +155,20 @@
0xfe3199be, 0xaed0, 0x413f, 0x87bb,
std::array<uint8_t, 6>{{0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}}};
+enum { PARAM_FACTORY_NAME, PARAM_EFFECT_UUID };
+using EffectParameter = std::tuple<std::string, Uuid>;
+
+static inline std::string EffectParameterToString(
+ const ::testing::TestParamInfo<EffectParameter>& info) {
+ return ::android::hardware::PrintInstanceNameToString(::testing::TestParamInfo<std::string>{
+ std::get<PARAM_FACTORY_NAME>(info.param), info.index});
+}
+
// The main test class for Audio Effect HIDL HAL.
-class AudioEffectHidlTest : public ::testing::TestWithParam<std::string> {
+class AudioEffectHidlTest : public ::testing::TestWithParam<EffectParameter> {
public:
void SetUp() override {
- effectsFactory = IEffectsFactory::getService(GetParam());
+ effectsFactory = IEffectsFactory::getService(std::get<PARAM_FACTORY_NAME>(GetParam()));
ASSERT_NE(nullptr, effectsFactory.get());
findAndCreateEffect(getEffectType());
@@ -180,7 +189,7 @@
RecordProperty("description", description);
}
- virtual Uuid getEffectType() { return EQUALIZER_EFFECT_TYPE; }
+ Uuid getEffectType() const { return std::get<PARAM_EFFECT_UUID>(GetParam()); }
void findAndCreateEffect(const Uuid& type);
void findEffectInstance(const Uuid& type, Uuid* uuid);
@@ -369,7 +378,9 @@
description("Verify Disable -> Enable -> Disable sequence for an effect");
Return<Result> ret = effect->disable();
EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::INVALID_ARGUMENTS, ret);
+ // Note: some legacy effects may return -EINVAL (INVALID_ARGUMENTS),
+ // more canonical is to return -ENOSYS (NOT_SUPPORTED)
+ EXPECT_TRUE(ret == Result::NOT_SUPPORTED || ret == Result::INVALID_ARGUMENTS);
ret = effect->enable();
EXPECT_TRUE(ret.isOk());
EXPECT_EQ(Result::OK, ret);
@@ -519,15 +530,19 @@
// The main test class for Equalizer Audio Effect HIDL HAL.
class EqualizerAudioEffectHidlTest : public AudioEffectHidlTest {
- public:
+ public:
void SetUp() override {
AudioEffectHidlTest::SetUp();
equalizer = IEqualizerEffect::castFrom(effect);
ASSERT_NE(nullptr, equalizer.get());
}
- protected:
- Uuid getEffectType() override { return EQUALIZER_EFFECT_TYPE; }
+ void TearDown() override {
+ equalizer.clear();
+ AudioEffectHidlTest::TearDown();
+ }
+
+ protected:
void getNumBands(uint16_t* numBands);
void getLevelRange(int16_t* minLevel, int16_t* maxLevel);
void getBandFrequencyRange(uint16_t band, uint32_t* minFreq, uint32_t* centerFreq,
@@ -765,16 +780,19 @@
// The main test class for Equalizer Audio Effect HIDL HAL.
class LoudnessEnhancerAudioEffectHidlTest : public AudioEffectHidlTest {
- public:
+ public:
void SetUp() override {
AudioEffectHidlTest::SetUp();
enhancer = ILoudnessEnhancerEffect::castFrom(effect);
ASSERT_NE(nullptr, enhancer.get());
}
- protected:
- Uuid getEffectType() override { return LOUDNESS_ENHANCER_EFFECT_TYPE; }
+ void TearDown() override {
+ enhancer.clear();
+ AudioEffectHidlTest::TearDown();
+ }
+ protected:
sp<ILoudnessEnhancerEffect> enhancer;
};
@@ -799,19 +817,31 @@
EXPECT_EQ(gain, actualGain);
}
+INSTANTIATE_TEST_SUITE_P(EffectsFactory, AudioEffectsFactoryHidlTest,
+ ::testing::ValuesIn(::android::hardware::getAllHalInstanceNames(
+ IEffectsFactory::descriptor)),
+ ::android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P(
- EffectsFactory, AudioEffectsFactoryHidlTest,
- testing::ValuesIn(android::hardware::getAllHalInstanceNames(IEffectsFactory::descriptor)),
- android::hardware::PrintInstanceNameToString);
+ Equalizer_IEffect, AudioEffectHidlTest,
+ ::testing::Combine(::testing::ValuesIn(::android::hardware::getAllHalInstanceNames(
+ IEffectsFactory::descriptor)),
+ ::testing::Values(EQUALIZER_EFFECT_TYPE)),
+ EffectParameterToString);
INSTANTIATE_TEST_SUITE_P(
- Equalizer, AudioEffectHidlTest,
- testing::ValuesIn(android::hardware::getAllHalInstanceNames(IEffectsFactory::descriptor)),
- android::hardware::PrintInstanceNameToString);
+ LoudnessEnhancer_IEffect, AudioEffectHidlTest,
+ ::testing::Combine(::testing::ValuesIn(::android::hardware::getAllHalInstanceNames(
+ IEffectsFactory::descriptor)),
+ ::testing::Values(LOUDNESS_ENHANCER_EFFECT_TYPE)),
+ EffectParameterToString);
INSTANTIATE_TEST_SUITE_P(
Equalizer, EqualizerAudioEffectHidlTest,
- testing::ValuesIn(android::hardware::getAllHalInstanceNames(IEffectsFactory::descriptor)),
- android::hardware::PrintInstanceNameToString);
+ ::testing::Combine(::testing::ValuesIn(::android::hardware::getAllHalInstanceNames(
+ IEffectsFactory::descriptor)),
+ ::testing::Values(EQUALIZER_EFFECT_TYPE)),
+ EffectParameterToString);
INSTANTIATE_TEST_SUITE_P(
LoudnessEnhancer, LoudnessEnhancerAudioEffectHidlTest,
- testing::ValuesIn(android::hardware::getAllHalInstanceNames(IEffectsFactory::descriptor)),
- android::hardware::PrintInstanceNameToString);
+ ::testing::Combine(::testing::ValuesIn(::android::hardware::getAllHalInstanceNames(
+ IEffectsFactory::descriptor)),
+ ::testing::Values(LOUDNESS_ENHANCER_EFFECT_TYPE)),
+ EffectParameterToString);
diff --git a/compatibility_matrices/compatibility_matrix.4.xml b/compatibility_matrices/compatibility_matrix.4.xml
index 01ec172..e5e012c 100644
--- a/compatibility_matrices/compatibility_matrix.4.xml
+++ b/compatibility_matrices/compatibility_matrix.4.xml
@@ -181,12 +181,6 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.gnss</name>
- <!--
- - Both versions are listed here as a workaround for libvintf since 2.0 extends 1.1.
- - Devices launched with Q must support gnss@2.0, see VtsTrebleVendorVintfTest
- - test DeviceManifestTest#GnssHalVersionCompatibility.
- -->
- <version>1.1</version>
<version>2.0</version>
<interface>
<name>IGnss</name>
@@ -429,7 +423,6 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.thermal</name>
- <version>1.0-1</version>
<version>2.0</version>
<interface>
<name>IThermal</name>
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index fea5e6f..cc4f0cd 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -181,12 +181,6 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.gnss</name>
- <!--
- - Both versions are listed here as a workaround for libvintf since 2.0 extends 1.1.
- - Devices launched with Q must support gnss@2.0, see VtsTrebleVendorVintfTest
- - test DeviceManifestTest#GnssHalVersionCompatibility.
- -->
- <version>1.1</version>
<version>2.0</version>
<interface>
<name>IGnss</name>
@@ -439,7 +433,6 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.thermal</name>
- <version>1.0</version>
<version>2.0</version>
<interface>
<name>IThermal</name>
diff --git a/current.txt b/current.txt
index 627b5f6..6732044 100644
--- a/current.txt
+++ b/current.txt
@@ -1,6 +1,10 @@
# Do not change this file except to add new interfaces. Changing
# pre-existing interfaces will fail VTS and break framework-only OTAs
+# Test HALs
+
+717c17cd380bb48710dff601d1a03351d4ebc28028353d5d60489248f506523c android.hardware.tests.lazy@1.0::ILazy
+
# HALs released in Android O
f219c3b5b8c6cb1d659d4c7328f67246abfe1a8613f469826fd3b9ad090417a2 android.hardware.audio@2.0::IDevice
diff --git a/identity/aidl/default/IdentityCredential.cpp b/identity/aidl/default/IdentityCredential.cpp
index 341fae6..aaae1f6 100644
--- a/identity/aidl/default/IdentityCredential.cpp
+++ b/identity/aidl/default/IdentityCredential.cpp
@@ -102,7 +102,7 @@
}
ndk::ScopedAStatus IdentityCredential::deleteCredential(
- vector<int8_t>* outProofOfDeletionSignature) {
+ vector<uint8_t>* outProofOfDeletionSignature) {
cppbor::Array array = {"ProofOfDeletion", docType_, testCredential_};
vector<uint8_t> proofOfDeletion = array.encode();
@@ -115,11 +115,11 @@
IIdentityCredentialStore::STATUS_FAILED, "Error signing data"));
}
- *outProofOfDeletionSignature = byteStringToSigned(signature.value());
+ *outProofOfDeletionSignature = signature.value();
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus IdentityCredential::createEphemeralKeyPair(vector<int8_t>* outKeyPair) {
+ndk::ScopedAStatus IdentityCredential::createEphemeralKeyPair(vector<uint8_t>* outKeyPair) {
optional<vector<uint8_t>> kp = support::createEcKeyPair();
if (!kp) {
return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
@@ -135,13 +135,13 @@
}
ephemeralPublicKey_ = publicKey.value();
- *outKeyPair = byteStringToSigned(kp.value());
+ *outKeyPair = kp.value();
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus IdentityCredential::setReaderEphemeralPublicKey(
- const vector<int8_t>& publicKey) {
- readerPublicKey_ = byteStringToUnsigned(publicKey);
+ const vector<uint8_t>& publicKey) {
+ readerPublicKey_ = publicKey;
return ndk::ScopedAStatus::ok();
}
@@ -169,8 +169,8 @@
// ahead of time.
bool checkReaderAuthentication(const SecureAccessControlProfile& profile,
const vector<uint8_t>& readerCertificateChain) {
- optional<vector<uint8_t>> acpPubKey = support::certificateChainGetTopMostKey(
- byteStringToUnsigned(profile.readerCertificate.encodedCertificate));
+ optional<vector<uint8_t>> acpPubKey =
+ support::certificateChainGetTopMostKey(profile.readerCertificate.encodedCertificate);
if (!acpPubKey) {
LOG(ERROR) << "Error extracting public key from readerCertificate in profile";
return false;
@@ -255,13 +255,9 @@
ndk::ScopedAStatus IdentityCredential::startRetrieval(
const vector<SecureAccessControlProfile>& accessControlProfiles,
- const HardwareAuthToken& authToken, const vector<int8_t>& itemsRequestS,
- const vector<int8_t>& signingKeyBlobS, const vector<int8_t>& sessionTranscriptS,
- const vector<int8_t>& readerSignatureS, const vector<int32_t>& requestCounts) {
- auto sessionTranscript = byteStringToUnsigned(sessionTranscriptS);
- auto itemsRequest = byteStringToUnsigned(itemsRequestS);
- auto readerSignature = byteStringToUnsigned(readerSignatureS);
-
+ const HardwareAuthToken& authToken, const vector<uint8_t>& itemsRequest,
+ const vector<uint8_t>& signingKeyBlob, const vector<uint8_t>& sessionTranscript,
+ const vector<uint8_t>& readerSignature, const vector<int32_t>& requestCounts) {
if (sessionTranscript.size() > 0) {
auto [item, _, message] = cppbor::parse(sessionTranscript);
if (item == nullptr) {
@@ -498,7 +494,7 @@
currentNameSpace_ = "";
itemsRequest_ = itemsRequest;
- signingKeyBlob_ = byteStringToUnsigned(signingKeyBlobS);
+ signingKeyBlob_ = signingKeyBlob;
numStartRetrievalCalls_ += 1;
return ndk::ScopedAStatus::ok();
@@ -605,10 +601,8 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus IdentityCredential::retrieveEntryValue(const vector<int8_t>& encryptedContentS,
- vector<int8_t>* outContent) {
- auto encryptedContent = byteStringToUnsigned(encryptedContentS);
-
+ndk::ScopedAStatus IdentityCredential::retrieveEntryValue(const vector<uint8_t>& encryptedContent,
+ vector<uint8_t>* outContent) {
optional<vector<uint8_t>> content =
support::decryptAes128Gcm(storageKey_, encryptedContent, entryAdditionalData_);
if (!content) {
@@ -647,12 +641,12 @@
currentNameSpaceDeviceNameSpacesMap_.add(currentName_, std::move(entryValueItem));
}
- *outContent = byteStringToSigned(content.value());
+ *outContent = content.value();
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus IdentityCredential::finishRetrieval(vector<int8_t>* outMac,
- vector<int8_t>* outDeviceNameSpaces) {
+ndk::ScopedAStatus IdentityCredential::finishRetrieval(vector<uint8_t>* outMac,
+ vector<uint8_t>* outDeviceNameSpaces) {
if (currentNameSpaceDeviceNameSpacesMap_.size() > 0) {
deviceNameSpacesMap_.add(currentNameSpace_,
std::move(currentNameSpaceDeviceNameSpacesMap_));
@@ -704,13 +698,13 @@
}
}
- *outMac = byteStringToSigned(mac.value_or(vector<uint8_t>({})));
- *outDeviceNameSpaces = byteStringToSigned(encodedDeviceNameSpaces);
+ *outMac = mac.value_or(vector<uint8_t>({}));
+ *outDeviceNameSpaces = encodedDeviceNameSpaces;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus IdentityCredential::generateSigningKeyPair(
- vector<int8_t>* outSigningKeyBlob, Certificate* outSigningKeyCertificate) {
+ vector<uint8_t>* outSigningKeyBlob, Certificate* outSigningKeyCertificate) {
string serialDecimal = "0"; // TODO: set serial to something unique
string issuer = "Android Open Source Project";
string subject = "Android IdentityCredential Reference Implementation";
@@ -758,9 +752,9 @@
return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
IIdentityCredentialStore::STATUS_FAILED, "Error encrypting signingKey"));
}
- *outSigningKeyBlob = byteStringToSigned(encryptedSigningKey.value());
+ *outSigningKeyBlob = encryptedSigningKey.value();
*outSigningKeyCertificate = Certificate();
- outSigningKeyCertificate->encodedCertificate = byteStringToSigned(certificate.value());
+ outSigningKeyCertificate->encodedCertificate = certificate.value();
return ndk::ScopedAStatus::ok();
}
diff --git a/identity/aidl/default/IdentityCredential.h b/identity/aidl/default/IdentityCredential.h
index fc29254..6072afe 100644
--- a/identity/aidl/default/IdentityCredential.h
+++ b/identity/aidl/default/IdentityCredential.h
@@ -47,23 +47,23 @@
int initialize();
// Methods from IIdentityCredential follow.
- ndk::ScopedAStatus deleteCredential(vector<int8_t>* outProofOfDeletionSignature) override;
- ndk::ScopedAStatus createEphemeralKeyPair(vector<int8_t>* outKeyPair) override;
- ndk::ScopedAStatus setReaderEphemeralPublicKey(const vector<int8_t>& publicKey) override;
+ ndk::ScopedAStatus deleteCredential(vector<uint8_t>* outProofOfDeletionSignature) override;
+ ndk::ScopedAStatus createEphemeralKeyPair(vector<uint8_t>* outKeyPair) override;
+ ndk::ScopedAStatus setReaderEphemeralPublicKey(const vector<uint8_t>& publicKey) override;
ndk::ScopedAStatus createAuthChallenge(int64_t* outChallenge) override;
ndk::ScopedAStatus startRetrieval(
const vector<SecureAccessControlProfile>& accessControlProfiles,
- const HardwareAuthToken& authToken, const vector<int8_t>& itemsRequest,
- const vector<int8_t>& signingKeyBlob, const vector<int8_t>& sessionTranscript,
- const vector<int8_t>& readerSignature, const vector<int32_t>& requestCounts) override;
+ const HardwareAuthToken& authToken, const vector<uint8_t>& itemsRequest,
+ const vector<uint8_t>& signingKeyBlob, const vector<uint8_t>& sessionTranscript,
+ const vector<uint8_t>& readerSignature, const vector<int32_t>& requestCounts) override;
ndk::ScopedAStatus startRetrieveEntryValue(
const string& nameSpace, const string& name, int32_t entrySize,
const vector<int32_t>& accessControlProfileIds) override;
- ndk::ScopedAStatus retrieveEntryValue(const vector<int8_t>& encryptedContent,
- vector<int8_t>* outContent) override;
- ndk::ScopedAStatus finishRetrieval(vector<int8_t>* outMac,
- vector<int8_t>* outDeviceNameSpaces) override;
- ndk::ScopedAStatus generateSigningKeyPair(vector<int8_t>* outSigningKeyBlob,
+ ndk::ScopedAStatus retrieveEntryValue(const vector<uint8_t>& encryptedContent,
+ vector<uint8_t>* outContent) override;
+ ndk::ScopedAStatus finishRetrieval(vector<uint8_t>* outMac,
+ vector<uint8_t>* outDeviceNameSpaces) override;
+ ndk::ScopedAStatus generateSigningKeyPair(vector<uint8_t>* outSigningKeyBlob,
Certificate* outSigningKeyCertificate) override;
private:
diff --git a/identity/aidl/default/IdentityCredentialStore.cpp b/identity/aidl/default/IdentityCredentialStore.cpp
index 1efb4b4..30dc6f3 100644
--- a/identity/aidl/default/IdentityCredentialStore.cpp
+++ b/identity/aidl/default/IdentityCredentialStore.cpp
@@ -51,7 +51,7 @@
}
ndk::ScopedAStatus IdentityCredentialStore::getCredential(
- CipherSuite cipherSuite, const vector<int8_t>& credentialData,
+ CipherSuite cipherSuite, const vector<uint8_t>& credentialData,
shared_ptr<IIdentityCredential>* outCredential) {
// We only support CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256 right now.
if (cipherSuite != CipherSuite::CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256) {
@@ -60,8 +60,8 @@
"Unsupported cipher suite"));
}
- vector<uint8_t> data = vector<uint8_t>(credentialData.begin(), credentialData.end());
- shared_ptr<IdentityCredential> credential = ndk::SharedRefBase::make<IdentityCredential>(data);
+ shared_ptr<IdentityCredential> credential =
+ ndk::SharedRefBase::make<IdentityCredential>(credentialData);
auto ret = credential->initialize();
if (ret != IIdentityCredentialStore::STATUS_OK) {
return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
diff --git a/identity/aidl/default/IdentityCredentialStore.h b/identity/aidl/default/IdentityCredentialStore.h
index a205113..4f3a421 100644
--- a/identity/aidl/default/IdentityCredentialStore.h
+++ b/identity/aidl/default/IdentityCredentialStore.h
@@ -39,7 +39,7 @@
const string& docType, bool testCredential,
shared_ptr<IWritableIdentityCredential>* outWritableCredential) override;
- ndk::ScopedAStatus getCredential(CipherSuite cipherSuite, const vector<int8_t>& credentialData,
+ ndk::ScopedAStatus getCredential(CipherSuite cipherSuite, const vector<uint8_t>& credentialData,
shared_ptr<IIdentityCredential>* outCredential) override;
};
diff --git a/identity/aidl/default/Util.cpp b/identity/aidl/default/Util.cpp
index a0f86be..66b9f13 100644
--- a/identity/aidl/default/Util.cpp
+++ b/identity/aidl/default/Util.cpp
@@ -39,21 +39,12 @@
return hardwareBoundKey;
}
-vector<uint8_t> byteStringToUnsigned(const vector<int8_t>& value) {
- return vector<uint8_t>(value.begin(), value.end());
-}
-
-vector<int8_t> byteStringToSigned(const vector<uint8_t>& value) {
- return vector<int8_t>(value.begin(), value.end());
-}
-
vector<uint8_t> secureAccessControlProfileEncodeCbor(const SecureAccessControlProfile& profile) {
cppbor::Map map;
map.add("id", profile.id);
if (profile.readerCertificate.encodedCertificate.size() > 0) {
- map.add("readerCertificate",
- cppbor::Bstr(byteStringToUnsigned(profile.readerCertificate.encodedCertificate)));
+ map.add("readerCertificate", cppbor::Bstr(profile.readerCertificate.encodedCertificate));
}
if (profile.userAuthenticationRequired) {
@@ -94,7 +85,7 @@
if (!mac) {
return false;
}
- if (mac.value() != byteStringToUnsigned(profile.mac)) {
+ if (mac.value() != profile.mac) {
return false;
}
return true;
diff --git a/identity/aidl/default/Util.h b/identity/aidl/default/Util.h
index ee41ad1..9fccba2 100644
--- a/identity/aidl/default/Util.h
+++ b/identity/aidl/default/Util.h
@@ -49,10 +49,6 @@
vector<uint8_t> entryCreateAdditionalData(const string& nameSpace, const string& name,
const vector<int32_t> accessControlProfileIds);
-vector<uint8_t> byteStringToUnsigned(const vector<int8_t>& value);
-
-vector<int8_t> byteStringToSigned(const vector<uint8_t>& value);
-
} // namespace aidl::android::hardware::identity
#endif // ANDROID_HARDWARE_IDENTITY_UTIL_H
diff --git a/identity/aidl/default/WritableIdentityCredential.cpp b/identity/aidl/default/WritableIdentityCredential.cpp
index 89f7f35..bce913a 100644
--- a/identity/aidl/default/WritableIdentityCredential.cpp
+++ b/identity/aidl/default/WritableIdentityCredential.cpp
@@ -53,8 +53,8 @@
// attestation certificate with current time and expires one year from now. The
// certificate shall contain all values as specified in hal.
ndk::ScopedAStatus WritableIdentityCredential::getAttestationCertificate(
- const vector<int8_t>& attestationApplicationId, //
- const vector<int8_t>& attestationChallenge, //
+ const vector<uint8_t>& attestationApplicationId, //
+ const vector<uint8_t>& attestationChallenge, //
vector<Certificate>* outCertificateChain) {
if (!credentialPrivKey_.empty() || !credentialPubKey_.empty() || !certificateChain_.empty()) {
return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
@@ -97,7 +97,7 @@
*outCertificateChain = vector<Certificate>();
for (const vector<uint8_t>& cert : certificateChain_) {
Certificate c = Certificate();
- c.encodedCertificate = byteStringToSigned(cert);
+ c.encodedCertificate = cert;
outCertificateChain->push_back(std::move(c));
}
return ndk::ScopedAStatus::ok();
@@ -146,14 +146,13 @@
return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
IIdentityCredentialStore::STATUS_FAILED, "Error calculating MAC for profile"));
}
- profile.mac = byteStringToSigned(mac.value());
+ profile.mac = mac.value();
cppbor::Map profileMap;
profileMap.add("id", profile.id);
if (profile.readerCertificate.encodedCertificate.size() > 0) {
- profileMap.add(
- "readerCertificate",
- cppbor::Bstr(byteStringToUnsigned(profile.readerCertificate.encodedCertificate)));
+ profileMap.add("readerCertificate",
+ cppbor::Bstr(profile.readerCertificate.encodedCertificate));
}
if (profile.userAuthenticationRequired) {
profileMap.add("userAuthenticationRequired", profile.userAuthenticationRequired);
@@ -223,9 +222,8 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus WritableIdentityCredential::addEntryValue(const vector<int8_t>& contentS,
- vector<int8_t>* outEncryptedContent) {
- auto content = byteStringToUnsigned(contentS);
+ndk::ScopedAStatus WritableIdentityCredential::addEntryValue(const vector<uint8_t>& content,
+ vector<uint8_t>* outEncryptedContent) {
size_t contentSize = content.size();
if (contentSize > IdentityCredentialStore::kGcmChunkSize) {
@@ -280,7 +278,7 @@
signedDataCurrentNamespace_.add(std::move(entryMap));
}
- *outEncryptedContent = byteStringToSigned(encryptedContent.value());
+ *outEncryptedContent = encryptedContent.value();
return ndk::ScopedAStatus::ok();
}
@@ -329,7 +327,7 @@
}
ndk::ScopedAStatus WritableIdentityCredential::finishAddingEntries(
- vector<int8_t>* outCredentialData, vector<int8_t>* outProofOfProvisioningSignature) {
+ vector<uint8_t>* outCredentialData, vector<uint8_t>* outProofOfProvisioningSignature) {
if (signedDataCurrentNamespace_.size() > 0) {
signedDataNamespaces_.add(entryNameSpace_, std::move(signedDataCurrentNamespace_));
}
@@ -364,8 +362,8 @@
IIdentityCredentialStore::STATUS_FAILED, "Error generating CredentialData"));
}
- *outCredentialData = byteStringToSigned(credentialData);
- *outProofOfProvisioningSignature = byteStringToSigned(signature.value());
+ *outCredentialData = credentialData;
+ *outProofOfProvisioningSignature = signature.value();
return ndk::ScopedAStatus::ok();
}
diff --git a/identity/aidl/default/WritableIdentityCredential.h b/identity/aidl/default/WritableIdentityCredential.h
index b182862..4b6fca8 100644
--- a/identity/aidl/default/WritableIdentityCredential.h
+++ b/identity/aidl/default/WritableIdentityCredential.h
@@ -37,8 +37,8 @@
bool initialize();
// Methods from IWritableIdentityCredential follow.
- ndk::ScopedAStatus getAttestationCertificate(const vector<int8_t>& attestationApplicationId,
- const vector<int8_t>& attestationChallenge,
+ ndk::ScopedAStatus getAttestationCertificate(const vector<uint8_t>& attestationApplicationId,
+ const vector<uint8_t>& attestationChallenge,
vector<Certificate>* outCertificateChain) override;
ndk::ScopedAStatus startPersonalization(int32_t accessControlProfileCount,
@@ -53,12 +53,12 @@
const string& nameSpace, const string& name,
int32_t entrySize) override;
- ndk::ScopedAStatus addEntryValue(const vector<int8_t>& content,
- vector<int8_t>* outEncryptedContent) override;
+ ndk::ScopedAStatus addEntryValue(const vector<uint8_t>& content,
+ vector<uint8_t>* outEncryptedContent) override;
ndk::ScopedAStatus finishAddingEntries(
- vector<int8_t>* outCredentialData,
- vector<int8_t>* outProofOfProvisioningSignature) override;
+ vector<uint8_t>* outCredentialData,
+ vector<uint8_t>* outProofOfProvisioningSignature) override;
// private:
string docType_;
diff --git a/media/Android.bp b/media/Android.bp
new file mode 100644
index 0000000..267c02b
--- /dev/null
+++ b/media/Android.bp
@@ -0,0 +1,27 @@
+//
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+filegroup {
+ name: "media_omx_audio_res",
+ path: "res",
+ srcs: ["res/*hz*"],
+}
+
+filegroup {
+ name: "media_omx_video_res",
+ path: "res",
+ srcs: ["res/*fps*"],
+}
diff --git a/media/omx/1.0/vts/functional/README.md b/media/omx/1.0/vts/functional/README.md
index 274b30d..c5a6867 100644
--- a/media/omx/1.0/vts/functional/README.md
+++ b/media/omx/1.0/vts/functional/README.md
@@ -6,29 +6,27 @@
#### master :
Functionality of master is to enumerate all the omx components (and the roles it supports) available in android media framework.
-usage: VtsHalMediaOmxV1\_0TargetMasterTest -I default
+usage: atest VtsHalMediaOmxV1\_0TargetMasterTest
#### component :
This folder includes test fixtures that tests aspects common to all omx compatible components. For instance, port enabling/disabling, enumerating port formats, state transitions, flush, ..., stay common to all components irrespective of the service they offer. Test fixtures here are directed towards testing these (omx core). Every standard OMX compatible component is expected to pass these tests.
-usage: VtsHalMediaOmxV1\_0TargetComponentTest -I default -C <comp name> -R <comp role>
+usage: atest VtsHalMediaOmxV1\_0TargetComponentTest
#### audio :
This folder includes test fixtures associated with testing audio encoder and decoder components such as simple encoding of a raw clip or decoding of an elementary stream, end of stream test, timestamp deviations test, flush test and so on. These tests are aimed towards testing the plugin that connects the component to the omx core.
usage:
-VtsHalMediaOmxV1\_0TargetAudioDecTest -I default -C <comp name> -R audio_decoder.<comp class> -P /data/local/tmp/media/
+atest VtsHalMediaOmxV1\_0TargetAudioDecTest
-VtsHalMediaOmxV1\_0TargetAudioEncTest -I default -C <comp name> -R audio_encoder.<comp class> -P /data/local/tmp/media/
+atest VtsHalMediaOmxV1\_0TargetAudioEncTest
#### video :
This folder includes test fixtures associated with testing video encoder and decoder components such as simple encoding of a raw clip or decoding of an elementary stream, end of stream test, timestamp deviations test, flush test and so on. These tests are aimed towards testing the plugin that connects the component to the omx core.
usage:
-VtsHalMediaOmxV1\_0TargetVideoDecTest -I default -C <comp name> -R video_decoder.<comp class> -P /data/local/tmp/media/
+atest VtsHalMediaOmxV1\_0TargetVideoDecTest
-VtsHalMediaOmxV1\_0TargetVideoEncTest -I default -C <comp name> -R video_encoder.<comp class> -P /data/local/tmp/media/
-
-While tesing audio/video encoder, decoder components, test fixtures require input files. These input are files are present in the folder 'res'. Before running the tests all the files in 'res' have to be placed in '/data/local/tmp/media' or a path of your choice and this path needs to be provided as an argument to the test application
+atest VtsHalMediaOmxV1\_0TargetVideoEncTest
diff --git a/media/omx/1.0/vts/functional/audio/Android.bp b/media/omx/1.0/vts/functional/audio/Android.bp
index 7418bb4..532521e 100644
--- a/media/omx/1.0/vts/functional/audio/Android.bp
+++ b/media/omx/1.0/vts/functional/audio/Android.bp
@@ -16,22 +16,30 @@
cc_test {
name: "VtsHalMediaOmxV1_0TargetAudioEncTest",
+ stem: "vts_hal_media_omx_v1_0_audio_enc_test",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: [
"VtsHalMediaOmxV1_0TargetAudioEncTest.cpp",
- "media_audio_hidl_test_common.cpp"
+ "media_audio_hidl_test_common.cpp",
],
- test_suites: ["general-tests"],
+ data: [":media_omx_audio_res"],
+ test_config: "VtsHalMediaOmxV1_0TargetAudioEncTest.xml",
+ test_suites: [
+ "vts-core",
+ ],
}
cc_test {
name: "VtsHalMediaOmxV1_0TargetAudioDecTest",
+ stem: "vts_hal_media_omx_v1_0_audio_dec_test",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: [
"VtsHalMediaOmxV1_0TargetAudioDecTest.cpp",
- "media_audio_hidl_test_common.cpp"
+ "media_audio_hidl_test_common.cpp",
],
- test_suites: ["general-tests"],
+ data: [":media_omx_audio_res"],
+ test_config: "VtsHalMediaOmxV1_0TargetAudioDecTest.xml",
+ test_suites: [
+ "vts-core",
+ ],
}
-
-
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
index 4543c01..3ed5670 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
@@ -28,6 +28,8 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
@@ -44,48 +46,45 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <getopt.h>
#include <media_audio_hidl_test_common.h>
-#include <media_hidl_test_common.h>
#include <fstream>
-static ComponentTestEnvironment* gEnv = nullptr;
+// Resource directory
+std::string sResourceDir = "";
// audio decoder test fixture class
-class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- private:
- typedef ::testing::VtsHalHidlTargetTestBase Super;
- public:
- ::std::string getTestCaseInfo() const override {
- return ::std::string() +
- "Component: " + gEnv->getComponent().c_str() + " | " +
- "Role: " + gEnv->getRole().c_str() + " | " +
- "Instance: " + gEnv->getInstance().c_str() + " | " +
- "Res: " + gEnv->getRes().c_str();
+class AudioDecHidlTest
+ : public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
+ public:
+ ::std::string getTestCaseInfo() const {
+ return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
+ "Instance: " + instance_ + " | " + "Res: " + sResourceDir;
}
virtual void SetUp() override {
- Super::SetUp();
+ instance_ = std::get<0>(GetParam());
+ component_ = std::get<1>(GetParam());
+ role_ = std::get<2>(GetParam());
+ ASSERT_NE(sResourceDir.empty(), true);
+
disableTest = false;
android::hardware::media::omx::V1_0::Status status;
- omx = Super::getService<IOmx>(gEnv->getInstance());
+ omx = IOmx::getService(instance_);
ASSERT_NE(omx, nullptr);
observer =
new CodecObserver([this](Message msg, const BufferInfo* buffer) {
handleMessage(msg, buffer);
});
ASSERT_NE(observer, nullptr);
- if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
- disableTest = true;
- EXPECT_TRUE(omx->allocateNode(
- gEnv->getComponent(), observer,
- [&](android::hardware::media::omx::V1_0::Status _s,
- sp<IOmxNode> const& _nl) {
- status = _s;
- this->omxNode = _nl;
- })
- .isOk());
+ if (component_.find("OMX.") != 0) disableTest = true;
+ EXPECT_TRUE(omx->allocateNode(component_, observer,
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IOmxNode> const& _nl) {
+ status = _s;
+ this->omxNode = _nl;
+ })
+ .isOk());
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
disableTest = true;
std::cout << "[ WARN ] Test Disabled, component not present\n";
@@ -93,7 +92,7 @@
}
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
- ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
+ ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
struct StringToName {
const char* Name;
standardComp CompName;
@@ -108,7 +107,7 @@
sizeof(kStringToName) / sizeof(kStringToName[0]);
const char* pch;
char substring[OMX_MAX_STRINGNAME_SIZE];
- strcpy(substring, gEnv->getRole().c_str());
+ strcpy(substring, role_.c_str());
pch = strchr(substring, '.');
ASSERT_NE(pch, nullptr);
compName = unknown_comp;
@@ -153,11 +152,8 @@
timestampDevTest = false;
isSecure = false;
size_t suffixLen = strlen(".secure");
- if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
- isSecure =
- !strcmp(gEnv->getComponent().c_str() +
- strlen(gEnv->getComponent().c_str()) - suffixLen,
- ".secure");
+ if (component_.rfind(".secure") == component_.length() - suffixLen) {
+ isSecure = true;
}
if (isSecure) disableTest = true;
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
@@ -172,7 +168,6 @@
EXPECT_TRUE((omxNode->freeNode()).isOk());
omxNode = nullptr;
}
- Super::TearDown();
}
// callback function to process messages received by onMessages() from IL
@@ -249,6 +244,10 @@
unknown_comp,
};
+ std::string component_;
+ std::string role_;
+ std::string instance_;
+
sp<IOmx> omx;
sp<CodecObserver> observer;
sp<IOmxNode> omxNode;
@@ -656,21 +655,21 @@
}
// set component role
-TEST_F(AudioDecHidlTest, SetRole) {
+TEST_P(AudioDecHidlTest, SetRole) {
description("Test Set Component Role");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
}
// port format enumeration
-TEST_F(AudioDecHidlTest, EnumeratePortFormat) {
+TEST_P(AudioDecHidlTest, EnumeratePortFormat) {
description("Test Component on Mandatory Port Parameters (Port Format)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
@@ -687,12 +686,12 @@
// test port settings reconfiguration, elementary stream decode and timestamp
// deviation
-TEST_F(AudioDecHidlTest, DecodeTest) {
+TEST_P(AudioDecHidlTest, DecodeTest) {
description("Tests Port Reconfiguration, Decode and timestamp deviation");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
@@ -702,8 +701,8 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512], info[512];
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info);
std::ifstream eleStream, eleInfo;
@@ -776,12 +775,12 @@
}
// end of sequence test
-TEST_F(AudioDecHidlTest, EOSTest_M) {
+TEST_P(AudioDecHidlTest, EOSTest_M) {
description("Test end of stream monkeying");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
@@ -840,12 +839,12 @@
}
// end of sequence test
-TEST_F(AudioDecHidlTest, ThumbnailTest) {
+TEST_P(AudioDecHidlTest, ThumbnailTest) {
description("Test Request for thumbnail");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
@@ -855,8 +854,8 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512], info[512];
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info);
std::ifstream eleStream, eleInfo;
@@ -954,12 +953,12 @@
}
// end of sequence test
-TEST_F(AudioDecHidlTest, SimpleEOSTest) {
+TEST_P(AudioDecHidlTest, SimpleEOSTest) {
description("Test end of stream");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
@@ -969,8 +968,8 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512], info[512];
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info);
std::ifstream eleStream, eleInfo;
@@ -1046,12 +1045,12 @@
}
// test input/output port flush
-TEST_F(AudioDecHidlTest, FlushTest) {
+TEST_P(AudioDecHidlTest, FlushTest) {
description("Test Flush");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
@@ -1061,8 +1060,8 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512], info[512];
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info);
std::ifstream eleStream, eleInfo;
@@ -1153,15 +1152,21 @@
kPortIndexOutput));
}
+INSTANTIATE_TEST_SUITE_P(PerInstance, AudioDecHidlTest, testing::ValuesIn(kTestParameters),
+ android::hardware::PrintInstanceTupleNameToString<>);
+
int main(int argc, char** argv) {
- gEnv = new ComponentTestEnvironment();
- ::testing::AddGlobalTestEnvironment(gEnv);
+ kTestParameters = getTestParameters("audio_decoder");
::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
- int status = gEnv->initFromOptions(argc, argv);
- if (status == 0) {
- status = RUN_ALL_TESTS();
- ALOGI("Test result = %d", status);
+
+ // Set the resource directory based on command line args.
+ // Test will fail to set up if the argument is not set.
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
+ sResourceDir = argv[i + 1];
+ break;
+ }
}
- return status;
-}
+
+ return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.xml b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.xml
new file mode 100644
index 0000000..275fefe
--- /dev/null
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the"License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an"AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs VtsHalMediaOmxV1_0TargetAudioDecTest.">
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push-file" key="vts_hal_media_omx_v1_0_audio_dec_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_audio_dec_test" />
+
+ <!-- Files used for audio testing -->
+ <option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.aac" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.aac" />
+ <option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.info" />
+ <option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.amrwb" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.amrwb" />
+ <option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.info" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.info" />
+ <option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.flac" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.flac" />
+ <option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.info" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.info" />
+ <option name="push-file" key="bbb_g711alaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.info" />
+ <option name="push-file" key="bbb_g711alaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.raw" />
+ <option name="push-file" key="bbb_g711mulaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.info" />
+ <option name="push-file" key="bbb_g711mulaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.raw" />
+ <option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.info" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.info" />
+ <option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.raw" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.raw" />
+ <option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.info" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.info" />
+ <option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.mp3" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.mp3" />
+ <option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.info" />
+ <option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.opus" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.opus" />
+ <option name="push-file" key="bbb_raw_1ch_16khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_16khz_s16le.raw" />
+ <option name="push-file" key="bbb_raw_1ch_8khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s16le.raw" />
+ <option name="push-file" key="bbb_raw_1ch_8khz_s32le.info" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.info" />
+ <option name="push-file" key="bbb_raw_1ch_8khz_s32le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.raw" />
+ <option name="push-file" key="bbb_raw_2ch_48khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_2ch_48khz_s16le.raw" />
+ <option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.info" />
+ <option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.vorbis" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.vorbis" />
+ <option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.amrnb" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.amrnb" />
+ <option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.info" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.info" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="vts_hal_media_omx_v1_0_audio_dec_test" />
+ <option name="native-test-flag" value="-P /data/local/tmp/media/" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
index 0ebab88..32e6f4c 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
@@ -28,6 +28,8 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
@@ -44,48 +46,45 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <getopt.h>
#include <media_audio_hidl_test_common.h>
-#include <media_hidl_test_common.h>
#include <fstream>
-static ComponentTestEnvironment* gEnv = nullptr;
+// Resource directory
+std::string sResourceDir = "";
// audio encoder test fixture class
-class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- private:
- typedef ::testing::VtsHalHidlTargetTestBase Super;
- public:
- ::std::string getTestCaseInfo() const override {
- return ::std::string() +
- "Component: " + gEnv->getComponent().c_str() + " | " +
- "Role: " + gEnv->getRole().c_str() + " | " +
- "Instance: " + gEnv->getInstance().c_str() + " | " +
- "Res: " + gEnv->getRes().c_str();
+class AudioEncHidlTest
+ : public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
+ public:
+ ::std::string getTestCaseInfo() const {
+ return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
+ "Instance: " + instance_ + " | " + "Res: " + sResourceDir;
}
virtual void SetUp() override {
- Super::SetUp();
+ instance_ = std::get<0>(GetParam());
+ component_ = std::get<1>(GetParam());
+ role_ = std::get<2>(GetParam());
+ ASSERT_NE(sResourceDir.empty(), true);
+
disableTest = false;
android::hardware::media::omx::V1_0::Status status;
- omx = Super::getService<IOmx>(gEnv->getInstance());
+ omx = IOmx::getService(instance_);
ASSERT_NE(omx, nullptr);
observer =
new CodecObserver([this](Message msg, const BufferInfo* buffer) {
handleMessage(msg, buffer);
});
ASSERT_NE(observer, nullptr);
- if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
- disableTest = true;
- EXPECT_TRUE(omx->allocateNode(
- gEnv->getComponent(), observer,
- [&](android::hardware::media::omx::V1_0::Status _s,
- sp<IOmxNode> const& _nl) {
- status = _s;
- this->omxNode = _nl;
- })
- .isOk());
+ if (component_.find("OMX.") != 0) disableTest = true;
+ EXPECT_TRUE(omx->allocateNode(component_, observer,
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IOmxNode> const& _nl) {
+ status = _s;
+ this->omxNode = _nl;
+ })
+ .isOk());
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
disableTest = true;
std::cout << "[ WARN ] Test Disabled, component not present\n";
@@ -93,7 +92,7 @@
}
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
- ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
+ ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
struct StringToName {
const char* Name;
standardComp CompName;
@@ -105,7 +104,7 @@
sizeof(kStringToName) / sizeof(kStringToName[0]);
const char* pch;
char substring[OMX_MAX_STRINGNAME_SIZE];
- strcpy(substring, gEnv->getRole().c_str());
+ strcpy(substring, role_.c_str());
pch = strchr(substring, '.');
ASSERT_NE(pch, nullptr);
compName = unknown_comp;
@@ -149,7 +148,6 @@
EXPECT_TRUE((omxNode->freeNode()).isOk());
omxNode = nullptr;
}
- Super::TearDown();
}
// callback function to process messages received by onMessages() from IL
@@ -190,6 +188,10 @@
unknown_comp,
};
+ std::string component_;
+ std::string role_;
+ std::string instance_;
+
sp<IOmx> omx;
sp<CodecObserver> observer;
sp<IOmxNode> omxNode;
@@ -364,21 +366,21 @@
}
// set component role
-TEST_F(AudioEncHidlTest, SetRole) {
+TEST_P(AudioEncHidlTest, SetRole) {
description("Test Set Component Role");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_.c_str());
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
}
// port format enumeration
-TEST_F(AudioEncHidlTest, EnumeratePortFormat) {
+TEST_P(AudioEncHidlTest, EnumeratePortFormat) {
description("Test Component on Mandatory Port Parameters (Port Format)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
@@ -394,12 +396,12 @@
}
// test raw stream encode
-TEST_F(AudioEncHidlTest, SimpleEncodeTest) {
+TEST_P(AudioEncHidlTest, SimpleEncodeTest) {
description("Tests Basic encoding and EOS");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
@@ -409,7 +411,7 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512];
- strcpy(mURL, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
GetURLForComponent(compName, mURL);
std::ifstream eleStream;
@@ -484,15 +486,21 @@
kPortIndexOutput));
}
+INSTANTIATE_TEST_SUITE_P(PerInstance, AudioEncHidlTest, testing::ValuesIn(kTestParameters),
+ android::hardware::PrintInstanceTupleNameToString<>);
+
int main(int argc, char** argv) {
- gEnv = new ComponentTestEnvironment();
- ::testing::AddGlobalTestEnvironment(gEnv);
+ kTestParameters = getTestParameters("audio_encoder");
::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
- int status = gEnv->initFromOptions(argc, argv);
- if (status == 0) {
- status = RUN_ALL_TESTS();
- ALOGI("Test result = %d", status);
+
+ // Set the resource directory based on command line args.
+ // Test will fail to set up if the argument is not set.
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
+ sResourceDir = argv[i + 1];
+ break;
+ }
}
- return status;
-}
+
+ return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.xml b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.xml
new file mode 100644
index 0000000..88b6c87
--- /dev/null
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the"License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an"AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs VtsHalMediaOmxV1_0TargetAudioEncTest.">
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push-file" key="vts_hal_media_omx_v1_0_audio_enc_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_audio_enc_test" />
+
+ <!-- Files used for audio testing -->
+ <option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.aac" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.aac" />
+ <option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.info" />
+ <option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.amrwb" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.amrwb" />
+ <option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.info" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.info" />
+ <option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.flac" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.flac" />
+ <option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.info" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.info" />
+ <option name="push-file" key="bbb_g711alaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.info" />
+ <option name="push-file" key="bbb_g711alaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.raw" />
+ <option name="push-file" key="bbb_g711mulaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.info" />
+ <option name="push-file" key="bbb_g711mulaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.raw" />
+ <option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.info" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.info" />
+ <option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.raw" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.raw" />
+ <option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.info" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.info" />
+ <option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.mp3" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.mp3" />
+ <option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.info" />
+ <option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.opus" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.opus" />
+ <option name="push-file" key="bbb_raw_1ch_16khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_16khz_s16le.raw" />
+ <option name="push-file" key="bbb_raw_1ch_8khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s16le.raw" />
+ <option name="push-file" key="bbb_raw_1ch_8khz_s32le.info" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.info" />
+ <option name="push-file" key="bbb_raw_1ch_8khz_s32le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.raw" />
+ <option name="push-file" key="bbb_raw_2ch_48khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_2ch_48khz_s16le.raw" />
+ <option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.info" />
+ <option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.vorbis" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.vorbis" />
+ <option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.amrnb" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.amrnb" />
+ <option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.info" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.info" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="vts_hal_media_omx_v1_0_audio_enc_test" />
+ <option name="native-test-flag" value="-P /data/local/tmp/media/" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
index e7ae083..7c3b23f 100644
--- a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
@@ -44,7 +44,6 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <hidlmemory/mapping.h>
#include <media_audio_hidl_test_common.h>
#include <media_hidl_test_common.h>
diff --git a/media/omx/1.0/vts/functional/common/Android.bp b/media/omx/1.0/vts/functional/common/Android.bp
index 5a79e55..2c024a0 100644
--- a/media/omx/1.0/vts/functional/common/Android.bp
+++ b/media/omx/1.0/vts/functional/common/Android.bp
@@ -23,7 +23,7 @@
export_include_dirs: ["."],
static_libs: [
- "VtsHalHidlTargetTestBase",
+ "libgtest",
"libhidlmemory",
"android.hidl.allocator@1.0",
"android.hidl.memory@1.0",
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
index 8d4c022..d9d1157 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
@@ -56,17 +56,16 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <hidlmemory/mapping.h>
#include <media/hardware/HardwareAPI.h>
#include <media_hidl_test_common.h>
#include <memory>
// set component role
-Return<android::hardware::media::omx::V1_0::Status> setRole(
- sp<IOmxNode> omxNode, const char* role) {
+Return<android::hardware::media::omx::V1_0::Status> setRole(sp<IOmxNode> omxNode,
+ const std::string& role) {
OMX_PARAM_COMPONENTROLETYPE params;
- strcpy((char*)params.cRole, role);
+ strcpy((char*)params.cRole, role.c_str());
return setParam(omxNode, OMX_IndexParamStandardComponentRole, ¶ms);
}
@@ -759,3 +758,46 @@
EXPECT_EQ(eosFlag, true);
eosFlag = false;
}
+
+hidl_vec<IOmx::ComponentInfo> getComponentInfoList(sp<IOmx> omx) {
+ android::hardware::media::omx::V1_0::Status status;
+ hidl_vec<IOmx::ComponentInfo> nodeList;
+ omx->listNodes([&status, &nodeList](android::hardware::media::omx::V1_0::Status _s,
+ hidl_vec<IOmx::ComponentInfo> const& _nl) {
+ status = _s;
+ nodeList = _nl;
+ });
+ if (status != android::hardware::media::omx::V1_0::Status::OK) {
+ ALOGE("Failed to get ComponentInfo list for IOmx.");
+ }
+ return nodeList;
+}
+
+// Return all test parameters, a list of tuple of <instance, component, role>
+const std::vector<std::tuple<std::string, std::string, std::string>>& getTestParameters(
+ const std::string& filter) {
+ static std::vector<std::tuple<std::string, std::string, std::string>> parameters;
+
+ auto instances = android::hardware::getAllHalInstanceNames(IOmx::descriptor);
+ for (std::string instance : instances) {
+ sp<IOmx> omx = IOmx::getService(instance);
+ hidl_vec<IOmx::ComponentInfo> componentInfos = getComponentInfoList(omx);
+ for (IOmx::ComponentInfo info : componentInfos) {
+ for (std::string role : info.mRoles) {
+ if (filter.empty()) {
+ if (kWhiteListRoles.find(role.c_str()) == kWhiteListRoles.end()) {
+ // This is for component test and the role is not in the white list.
+ continue;
+ }
+ } else if (role.find(filter) == std::string::npos) {
+ // The role doesn't match the given filter, e.g., video_decoder_vp8 role doesn't
+ // need to run for audio_decoder tests.
+ continue;
+ }
+ parameters.push_back(std::make_tuple(instance, info.mName.c_str(), role.c_str()));
+ }
+ }
+ }
+
+ return parameters;
+}
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
index ac077a3..bb03dd0 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
@@ -32,6 +32,8 @@
#include <android/hardware/graphics/mapper/2.0/types.h>
#include <android/hardware/graphics/mapper/3.0/IMapper.h>
#include <android/hardware/graphics/mapper/3.0/types.h>
+#include <gtest/gtest.h>
+#include <hidl/ServiceManagement.h>
#include <media/stagefright/foundation/ALooper.h>
#include <utils/Condition.h>
#include <utils/List.h>
@@ -44,8 +46,6 @@
#include <media/openmax/OMX_AudioExt.h>
#include <media/openmax/OMX_VideoExt.h>
-#include <VtsHalHidlTargetTestEnvBase.h>
-
/* TIME OUTS (Wait time in dequeueMessage()) */
/* As component is switching states (loaded<->idle<->execute), dequeueMessage()
@@ -78,6 +78,20 @@
unknown,
};
+// White list audio/video roles to be tested.
+static std::set<std::string> kWhiteListRoles{
+ "audio_encoder.aac", "audio_encoder.amrnb", "audio_encoder.amrwb",
+ "audio_encoder.flac", "audio_decoder.aac", "audio_decoder.amrnb",
+ "audio_decoder.amrwb", "audio_decoder.flac", "audio_decoder.g711alaw",
+ "audio_decoder.g711mlaw", "audio_decoder.gsm", "audio_decoder.mp3",
+ "audio_decoder.opus", "audio_decoder.raw", "audio_decoder.vorbis",
+ "video_encoder.avc", "video_encoder.h263", "video_encoder.mpeg4",
+ "video_encoder.vp8", "video_encoder.vp9", "video_decoder.avc",
+ "video_decoder.h263", "video_decoder.hevc", "video_decoder.mpeg4",
+ "video_decoder.vp8", "video_decoder.vp9"};
+
+static std::vector<std::tuple<std::string, std::string, std::string>> kTestParameters;
+
/*
* TODO: below definitions are borrowed from Conversion.h.
* This is not the ideal way to do it. Loose these definitions once you
@@ -328,8 +342,8 @@
using Rect = IMapper::Rect;
};
-Return<android::hardware::media::omx::V1_0::Status> setRole(
- sp<IOmxNode> omxNode, const char* role);
+Return<android::hardware::media::omx::V1_0::Status> setRole(sp<IOmxNode> omxNode,
+ const std::string& role);
Return<android::hardware::media::omx::V1_0::Status> setPortBufferSize(
sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_U32 size);
@@ -400,77 +414,10 @@
portreconfig fptr = nullptr, OMX_U32 kPortIndexInput = 0,
OMX_U32 kPortIndexOutput = 1, void* args = nullptr);
-// A class for test environment setup
-class ComponentTestEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
- private:
- typedef ::testing::VtsHalHidlTargetTestEnvBase Super;
+hidl_vec<IOmx::ComponentInfo> getComponentInfoList(sp<IOmx> omx);
- public:
- virtual void registerTestServices() override { registerTestService<IOmx>(); }
-
- ComponentTestEnvironment() : res("/data/local/tmp/media/") {}
-
- void setComponent(const char* _component) { component = _component; }
-
- void setRole(const char* _role) { role = _role; }
-
- void setRes(const char* _res) { res = _res; }
-
- const hidl_string getInstance() { return Super::getServiceName<IOmx>(); }
-
- const hidl_string getComponent() const { return component; }
-
- const hidl_string getRole() const { return role; }
-
- const hidl_string getRes() const { return res; }
-
- int initFromOptions(int argc, char** argv) {
- static struct option options[] = {{"component", required_argument, 0, 'C'},
- {"role", required_argument, 0, 'R'},
- {"res", required_argument, 0, 'P'},
- {0, 0, 0, 0}};
-
- while (true) {
- int index = 0;
- int c = getopt_long(argc, argv, "C:R:P:", options, &index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'C':
- setComponent(optarg);
- break;
- case 'R':
- setRole(optarg);
- break;
- case 'P':
- setRes(optarg);
- break;
- case '?':
- break;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr,
- "unrecognized option: %s\n\n"
- "usage: %s <gtest options> <test options>\n\n"
- "test options are:\n\n"
- "-C, --component: OMX component to test\n"
- "-R, --role: OMX component Role\n"
- "-P, --res: Resource files directory location\n",
- argv[optind ?: 1], argv[0]);
- return 2;
- }
- return 0;
- }
-
- private:
- hidl_string instance;
- hidl_string component;
- hidl_string role;
- hidl_string res;
-};
+// Return all test parameters, a list of tuple of <instance, component, role>
+const std::vector<std::tuple<std::string, std::string, std::string>>& getTestParameters(
+ const std::string& filter);
#endif // MEDIA_HIDL_TEST_COMMON_H
diff --git a/media/omx/1.0/vts/functional/component/Android.bp b/media/omx/1.0/vts/functional/component/Android.bp
index 970eabe..c7be2cc 100644
--- a/media/omx/1.0/vts/functional/component/Android.bp
+++ b/media/omx/1.0/vts/functional/component/Android.bp
@@ -18,6 +18,7 @@
name: "VtsHalMediaOmxV1_0TargetComponentTest",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: ["VtsHalMediaOmxV1_0TargetComponentTest.cpp"],
- test_suites: ["general-tests"],
+ test_suites: [
+ "vts-core",
+ ],
}
-
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
index 1c1d39b..01cec6d 100644
--- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -28,6 +28,8 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
@@ -44,42 +46,37 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <getopt.h>
#include <media_hidl_test_common.h>
-static ComponentTestEnvironment* gEnv = nullptr;
-
// generic component test fixture class
-class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- private:
- typedef ::testing::VtsHalHidlTargetTestBase Super;
- public:
- ::std::string getTestCaseInfo() const override {
- return ::std::string() +
- "Component: " + gEnv->getComponent().c_str() + " | " +
- "Role: " + gEnv->getRole().c_str() + " | " +
- "Instance: " + gEnv->getInstance().c_str();
+class ComponentHidlTest
+ : public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
+ public:
+ ::std::string getTestCaseInfo() const {
+ return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
+ "Instance: " + instance_;
}
virtual void SetUp() override {
- Super::SetUp();
+ instance_ = std::get<0>(GetParam());
+ component_ = std::get<1>(GetParam());
+ role_ = std::get<2>(GetParam());
+
disableTest = false;
android::hardware::media::omx::V1_0::Status status;
- omx = Super::getService<IOmx>(gEnv->getInstance());
+ omx = IOmx::getService(instance_);
ASSERT_NE(omx, nullptr);
observer = new CodecObserver(nullptr);
ASSERT_NE(observer, nullptr);
- if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
- disableTest = true;
- EXPECT_TRUE(omx->allocateNode(
- gEnv->getComponent(), observer,
- [&](android::hardware::media::omx::V1_0::Status _s,
- sp<IOmxNode> const& _nl) {
- status = _s;
- this->omxNode = _nl;
- })
- .isOk());
+ if (component_.find("OMX.") != 0) disableTest = true;
+ EXPECT_TRUE(omx->allocateNode(component_, observer,
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IOmxNode> const& _nl) {
+ status = _s;
+ this->omxNode = _nl;
+ })
+ .isOk());
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
disableTest = true;
std::cout << "[ WARN ] Test Disabled, component not present\n";
@@ -87,7 +84,7 @@
}
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
- ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
+ ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
struct StringToClass {
const char* Class;
standardCompClass CompClass;
@@ -102,7 +99,7 @@
sizeof(kStringToClass) / sizeof(kStringToClass[0]);
const char* pch;
char substring[OMX_MAX_STRINGNAME_SIZE];
- strcpy(substring, gEnv->getRole().c_str());
+ strcpy(substring, role_.c_str());
pch = strchr(substring, '.');
ASSERT_NE(pch, nullptr) << "Invalid Component Role";
substring[pch - substring] = '\0';
@@ -117,11 +114,8 @@
isSecure = false;
mTunnel = false;
size_t suffixLen = strlen(".secure");
- if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
- isSecure =
- !strcmp(gEnv->getComponent().c_str() +
- strlen(gEnv->getComponent().c_str()) - suffixLen,
- ".secure");
+ if (component_.rfind(".secure") == component_.length() - suffixLen) {
+ isSecure = true;
}
if (compClass == video_decoder) {
omxNode->configureVideoTunnelMode(
@@ -147,7 +141,6 @@
EXPECT_TRUE((omxNode->freeNode()).isOk());
omxNode = nullptr;
}
- Super::TearDown();
}
enum standardCompClass {
@@ -158,6 +151,10 @@
unknown_class,
};
+ std::string component_;
+ std::string role_;
+ std::string instance_;
+
sp<IOmx> omx;
sp<CodecObserver> observer;
sp<IOmxNode> omxNode;
@@ -191,7 +188,7 @@
}
// test dispatch message API call
-TEST_F(ComponentHidlTest, dispatchMsg) {
+TEST_P(ComponentHidlTest, dispatchMsg) {
description("test dispatch message API call");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
@@ -216,22 +213,22 @@
}
// set component role
-TEST_F(ComponentHidlTest, SetRole) {
+TEST_P(ComponentHidlTest, SetRole) {
description("Test Set Component Role");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
}
// port indices enumeration
-TEST_F(ComponentHidlTest, DISABLED_GetPortIndices) {
+TEST_P(ComponentHidlTest, DISABLED_GetPortIndices) {
description("Test Component on Mandatory Port Parameters (Port Indices)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
OMX_PORT_PARAM_TYPE params;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
// Get Number of Ports and their Indices for all Domains
@@ -248,13 +245,13 @@
}
// port format enumeration
-TEST_F(ComponentHidlTest, EnumeratePortFormat) {
+TEST_P(ComponentHidlTest, EnumeratePortFormat) {
description("Test Component on Mandatory Port Parameters (Port Format)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -308,14 +305,14 @@
}
// get/set default port settings of a component
-TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
+TEST_P(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
description(
"Test Component on Mandatory Port Parameters (Port Definition)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -398,7 +395,7 @@
portDef = mirror;
OMX_U32 nBufferSize = portDef.nBufferSize >> 1;
if (nBufferSize != 0) {
- if (!strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11)) {
+ if (component_.find("OMX.google.") != 0) {
portDef.nBufferSize = nBufferSize;
} else {
// Probable alignment requirements of vendor component
@@ -438,13 +435,13 @@
}
// populate port test
-TEST_F(ComponentHidlTest, DISABLED_PopulatePort) {
+TEST_P(ComponentHidlTest, DISABLED_PopulatePort) {
description("Verify bPopulated field of a component port");
if (disableTest || isSecure) return;
android::hardware::media::omx::V1_0::Status status;
OMX_U32 portBase = 0;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -490,14 +487,14 @@
}
// Flush test
-TEST_F(ComponentHidlTest, Flush) {
+TEST_P(ComponentHidlTest, Flush) {
description("Test Flush");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -561,14 +558,14 @@
}
// Flush test - monkeying
-TEST_F(ComponentHidlTest, Flush_M) {
+TEST_P(ComponentHidlTest, Flush_M) {
description("Test Flush monkeying");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -669,14 +666,14 @@
}
// test port mode configuration when the component is in various states
-TEST_F(ComponentHidlTest, PortModeConfig) {
+TEST_P(ComponentHidlTest, PortModeConfig) {
description("Test Port Mode Configuration");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -733,14 +730,14 @@
}
// state transitions test
-TEST_F(ComponentHidlTest, StateTransitions) {
+TEST_P(ComponentHidlTest, StateTransitions) {
description("Test State Transitions Loaded<->Idle<->Execute");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
OMX_U32 portBase = 0;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -852,14 +849,14 @@
}
// state transitions test - monkeying
-TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
+TEST_P(ComponentHidlTest, DISABLED_StateTransitions_M) {
description("Test State Transitions monkeying");
if (disableTest || isSecure) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -918,13 +915,13 @@
}
// port enable disable test
-TEST_F(ComponentHidlTest, DISABLED_PortEnableDisable_Loaded) {
+TEST_P(ComponentHidlTest, DISABLED_PortEnableDisable_Loaded) {
description("Test Port Enable and Disable (Component State :: Loaded)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
OMX_U32 portBase = 0;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -968,14 +965,14 @@
}
// port enable disable test
-TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
+TEST_P(ComponentHidlTest, PortEnableDisable_Idle) {
description("Test Port Enable and Disable (Component State :: Idle)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
OMX_U32 portBase = 0;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -1074,14 +1071,14 @@
}
// port enable disable test
-TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
+TEST_P(ComponentHidlTest, PortEnableDisable_Execute) {
description("Test Port Enable and Disable (Component State :: Execute)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
OMX_U32 portBase = 0;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -1192,14 +1189,14 @@
}
// port enable disable test - monkeying
-TEST_F(ComponentHidlTest, DISABLED_PortEnableDisable_M) {
+TEST_P(ComponentHidlTest, DISABLED_PortEnableDisable_M) {
description(
"Test Port Enable and Disable Monkeying (Component State :: Loaded)");
if (disableTest || isSecure) return;
android::hardware::media::omx::V1_0::Status status;
OMX_U32 portBase = 0;
Message msg;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
if (compClass == audio_decoder || compClass == audio_encoder) {
@@ -1267,15 +1264,11 @@
}
}
+INSTANTIATE_TEST_SUITE_P(PerInstance, ComponentHidlTest, testing::ValuesIn(kTestParameters),
+ android::hardware::PrintInstanceTupleNameToString<>);
+
int main(int argc, char** argv) {
- gEnv = new ComponentTestEnvironment();
- ::testing::AddGlobalTestEnvironment(gEnv);
+ kTestParameters = getTestParameters("");
::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
- int status = gEnv->initFromOptions(argc, argv);
- if (status == 0) {
- status = RUN_ALL_TESTS();
- ALOGI("Test result = %d", status);
- }
- return status;
-}
+ return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/master/Android.bp b/media/omx/1.0/vts/functional/master/Android.bp
index cf3f15d..0eb2cc9 100644
--- a/media/omx/1.0/vts/functional/master/Android.bp
+++ b/media/omx/1.0/vts/functional/master/Android.bp
@@ -18,6 +18,7 @@
name: "VtsHalMediaOmxV1_0TargetMasterTest",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: ["VtsHalMediaOmxV1_0TargetMasterTest.cpp"],
- test_suites: ["general-tests"],
+ test_suites: [
+ "vts-core",
+ ],
}
-
diff --git a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
index 64abe1c..c14f1da 100644
--- a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
+++ b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
@@ -29,6 +29,9 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
@@ -46,30 +49,18 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <getopt.h>
#include <media_hidl_test_common.h>
-static ComponentTestEnvironment* gEnv = nullptr;
-
-class MasterHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- private:
- typedef ::testing::VtsHalHidlTargetTestBase Super;
- public:
+class MasterHidlTest : public ::testing::TestWithParam<std::string> {
+ public:
virtual void SetUp() override {
- Super::SetUp();
- omxStore = nullptr;
- omxStore = Super::getService<IOmxStore>();
+ omxStore = IOmxStore::getService(GetParam());
ASSERT_NE(omxStore, nullptr);
- omx = nullptr;
- omx = omxStore->getOmx(gEnv->getInstance());
+ omx = IOmx::getService(GetParam());
ASSERT_NE(omx, nullptr);
}
- virtual void TearDown() override {
- Super::TearDown();
- }
-
sp<IOmxStore> omxStore;
sp<IOmx> omx;
@@ -89,8 +80,19 @@
}
}
+// Make sure IOmx and IOmxStore have the same set of instances.
+TEST(MasterHidlTest, instanceMatchValidation) {
+ auto omxInstances = android::hardware::getAllHalInstanceNames(IOmx::descriptor);
+ auto omxStoreInstances = android::hardware::getAllHalInstanceNames(IOmxStore::descriptor);
+ ASSERT_EQ(omxInstances.size(), omxInstances.size());
+ for (const std::string& omxInstance : omxInstances) {
+ EXPECT_TRUE(std::find(omxStoreInstances.begin(), omxStoreInstances.end(), omxInstance) !=
+ omxStoreInstances.end());
+ }
+}
+
// list service attributes
-TEST_F(MasterHidlTest, ListServiceAttr) {
+TEST_P(MasterHidlTest, ListServiceAttr) {
description("list service attributes");
android::hardware::media::omx::V1_0::Status status;
hidl_vec<IOmxStore::Attribute> attributes;
@@ -107,7 +109,7 @@
}
// get node prefix
-TEST_F(MasterHidlTest, getNodePrefix) {
+TEST_P(MasterHidlTest, getNodePrefix) {
description("get node prefix");
hidl_string prefix;
omxStore->getNodePrefix(
@@ -116,7 +118,7 @@
}
// list roles
-TEST_F(MasterHidlTest, ListRoles) {
+TEST_P(MasterHidlTest, ListRoles) {
description("list roles");
hidl_vec<IOmxStore::RoleInfo> roleList;
omxStore->listRoles([&roleList](hidl_vec<IOmxStore::RoleInfo> const& _nl) {
@@ -126,7 +128,7 @@
}
// list components and roles.
-TEST_F(MasterHidlTest, ListNodes) {
+TEST_P(MasterHidlTest, ListNodes) {
description("enumerate component and roles");
android::hardware::media::omx::V1_0::Status status;
hidl_vec<IOmx::ComponentInfo> nodeList;
@@ -174,15 +176,7 @@
EXPECT_TRUE(isPass);
}
-int main(int argc, char** argv) {
- gEnv = new ComponentTestEnvironment();
- ::testing::AddGlobalTestEnvironment(gEnv);
- ::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
- int status = gEnv->initFromOptions(argc, argv);
- if (status == 0) {
- status = RUN_ALL_TESTS();
- ALOGI("Test result = %d", status);
- }
- return status;
-}
+INSTANTIATE_TEST_CASE_P(
+ PerInstance, MasterHidlTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(IOmxStore::descriptor)),
+ android::hardware::PrintInstanceNameToString);
diff --git a/media/omx/1.0/vts/functional/video/Android.bp b/media/omx/1.0/vts/functional/video/Android.bp
index c7e0424..7e93faa 100644
--- a/media/omx/1.0/vts/functional/video/Android.bp
+++ b/media/omx/1.0/vts/functional/video/Android.bp
@@ -16,23 +16,33 @@
cc_test {
name: "VtsHalMediaOmxV1_0TargetVideoDecTest",
+ stem: "vts_hal_media_omx_v1_0_video_dec_test",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: [
"VtsHalMediaOmxV1_0TargetVideoDecTest.cpp",
- "media_video_hidl_test_common.cpp"
+ "media_video_hidl_test_common.cpp",
],
- test_suites: ["general-tests"],
+ data: [":media_omx_video_res"],
+ test_config: "VtsHalMediaOmxV1_0TargetVideoDecTest.xml",
+ test_suites: [
+ "vts-core",
+ ],
}
cc_test {
name: "VtsHalMediaOmxV1_0TargetVideoEncTest",
+ stem: "vts_hal_media_omx_v1_0_video_enc_test",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: [
"VtsHalMediaOmxV1_0TargetVideoEncTest.cpp",
- "media_video_hidl_test_common.cpp"
+ "media_video_hidl_test_common.cpp",
],
static_libs: [
"libnativewindow",
],
- test_suites: ["general-tests"],
+ data: [":media_omx_video_res"],
+ test_config: "VtsHalMediaOmxV1_0TargetVideoEncTest.xml",
+ test_suites: [
+ "vts-core",
+ ],
}
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
index df048c6..29a32a5 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
@@ -28,6 +28,8 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
@@ -44,49 +46,46 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <getopt.h>
#include <media/hardware/HardwareAPI.h>
-#include <media_hidl_test_common.h>
#include <media_video_hidl_test_common.h>
#include <fstream>
-static ComponentTestEnvironment* gEnv = nullptr;
+// Resource directory
+std::string sResourceDir = "";
// video decoder test fixture class
-class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- private:
- typedef ::testing::VtsHalHidlTargetTestBase Super;
- public:
- ::std::string getTestCaseInfo() const override {
- return ::std::string() +
- "Component: " + gEnv->getComponent().c_str() + " | " +
- "Role: " + gEnv->getRole().c_str() + " | " +
- "Instance: " + gEnv->getInstance().c_str() + " | " +
- "Res: " + gEnv->getRes().c_str();
+class VideoDecHidlTest
+ : public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
+ public:
+ ::std::string getTestCaseInfo() const {
+ return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
+ "Instance: " + instance_ + " | " + "Res: " + sResourceDir;
}
virtual void SetUp() override {
- Super::SetUp();
+ instance_ = std::get<0>(GetParam());
+ component_ = std::get<1>(GetParam());
+ role_ = std::get<2>(GetParam());
+ ASSERT_NE(sResourceDir.empty(), true);
+
disableTest = false;
android::hardware::media::omx::V1_0::Status status;
- omx = Super::getService<IOmx>(gEnv->getInstance());
+ omx = IOmx::getService(instance_);
ASSERT_NE(omx, nullptr);
observer =
new CodecObserver([this](Message msg, const BufferInfo* buffer) {
handleMessage(msg, buffer);
});
ASSERT_NE(observer, nullptr);
- if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
- disableTest = true;
- EXPECT_TRUE(omx->allocateNode(
- gEnv->getComponent(), observer,
- [&](android::hardware::media::omx::V1_0::Status _s,
- sp<IOmxNode> const& _nl) {
- status = _s;
- this->omxNode = _nl;
- })
- .isOk());
+ if (component_.find("OMX.") != 0) disableTest = true;
+ EXPECT_TRUE(omx->allocateNode(component_, observer,
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IOmxNode> const& _nl) {
+ status = _s;
+ this->omxNode = _nl;
+ })
+ .isOk());
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
disableTest = true;
std::cout << "[ WARN ] Test Disabled, component not present\n";
@@ -94,7 +93,7 @@
}
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
- ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
+ ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
struct StringToName {
const char* Name;
standardComp CompName;
@@ -107,7 +106,7 @@
sizeof(kStringToName) / sizeof(kStringToName[0]);
const char* pch;
char substring[OMX_MAX_STRINGNAME_SIZE];
- strcpy(substring, gEnv->getRole().c_str());
+ strcpy(substring, role_.c_str());
pch = strchr(substring, '.');
ASSERT_NE(pch, nullptr);
compName = unknown_comp;
@@ -146,11 +145,8 @@
isSecure = false;
portSettingsChange = false;
size_t suffixLen = strlen(".secure");
- if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
- isSecure =
- !strcmp(gEnv->getComponent().c_str() +
- strlen(gEnv->getComponent().c_str()) - suffixLen,
- ".secure");
+ if (component_.rfind(".secure") == component_.length() - suffixLen) {
+ isSecure = true;
}
if (isSecure) disableTest = true;
omxNode->configureVideoTunnelMode(
@@ -175,7 +171,6 @@
EXPECT_TRUE((omxNode->freeNode()).isOk());
omxNode = nullptr;
}
- Super::TearDown();
}
// callback function to process messages received by onMessages() from IL
@@ -255,6 +250,10 @@
unknown_comp,
};
+ std::string component_;
+ std::string role_;
+ std::string instance_;
+
sp<IOmx> omx;
sp<CodecObserver> observer;
sp<IOmxNode> omxNode;
@@ -719,23 +718,23 @@
}
// set component role
-TEST_F(VideoDecHidlTest, SetRole) {
+TEST_P(VideoDecHidlTest, SetRole) {
description("Test Set Component Role");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
}
// port format enumeration
-TEST_F(VideoDecHidlTest, EnumeratePortFormat) {
+TEST_P(VideoDecHidlTest, EnumeratePortFormat) {
description("Test Component on Mandatory Port Parameters (Port Format)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
OMX_U32 xFramerate = (24U << 16);
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -755,12 +754,12 @@
// test port settings reconfiguration, elementary stream decode and timestamp
// deviation
-TEST_F(VideoDecHidlTest, DecodeTest) {
+TEST_P(VideoDecHidlTest, DecodeTest) {
description("Tests Port Reconfiguration, Decode and timestamp deviation");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -770,8 +769,8 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512], info[512];
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info);
std::ifstream eleStream, eleInfo;
@@ -860,7 +859,7 @@
}
// Test for adaptive playback support
-TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
+TEST_P(VideoDecHidlTest, AdaptivePlaybackTest) {
description("Tests for Adaptive Playback support");
if (disableTest) return;
if (!(compName == avc || compName == hevc || compName == vp8 ||
@@ -868,7 +867,7 @@
return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -895,7 +894,7 @@
uint32_t adaptiveMaxHeight = 240;
status = omxNode->prepareForAdaptivePlayback(
kPortIndexOutput, true, adaptiveMaxWidth, adaptiveMaxHeight);
- if (strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11) == 0) {
+ if (component_.find("OMX.google.") == 0) {
// SoftOMX Decoders donot support graphic buffer modes. So for them
// support for adaptive play back is mandatory in Byte Buffer mode
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
@@ -944,8 +943,8 @@
std::ifstream eleStream, eleInfo;
char mURL[512], info[512];
android::Vector<FrameData> Info;
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info, i % STREAM_COUNT);
eleInfo.open(info);
ASSERT_EQ(eleInfo.is_open(), true);
@@ -1008,12 +1007,12 @@
}
// end of sequence test
-TEST_F(VideoDecHidlTest, EOSTest_M) {
+TEST_P(VideoDecHidlTest, EOSTest_M) {
description("Test End of stream monkeying");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1074,12 +1073,12 @@
}
// end of sequence test
-TEST_F(VideoDecHidlTest, ThumbnailTest) {
+TEST_P(VideoDecHidlTest, ThumbnailTest) {
description("Test Request for thumbnail");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1089,8 +1088,8 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512], info[512];
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info);
std::ifstream eleStream, eleInfo;
@@ -1195,12 +1194,12 @@
}
// end of sequence test
-TEST_F(VideoDecHidlTest, SimpleEOSTest) {
+TEST_P(VideoDecHidlTest, SimpleEOSTest) {
description("Test End of stream");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1210,8 +1209,8 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512], info[512];
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info);
std::ifstream eleStream, eleInfo;
@@ -1302,12 +1301,12 @@
}
// test input/output port flush
-TEST_F(VideoDecHidlTest, FlushTest) {
+TEST_P(VideoDecHidlTest, FlushTest) {
description("Test Flush");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1317,8 +1316,8 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512], info[512];
- strcpy(mURL, gEnv->getRes().c_str());
- strcpy(info, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
+ strcpy(info, sResourceDir.c_str());
GetURLForComponent(compName, mURL, info);
std::ifstream eleStream, eleInfo;
@@ -1420,15 +1419,21 @@
kPortIndexOutput));
}
+INSTANTIATE_TEST_SUITE_P(PerInstance, VideoDecHidlTest, testing::ValuesIn(kTestParameters),
+ android::hardware::PrintInstanceTupleNameToString<>);
+
int main(int argc, char** argv) {
- gEnv = new ComponentTestEnvironment();
- ::testing::AddGlobalTestEnvironment(gEnv);
+ kTestParameters = getTestParameters("video_decoder");
::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
- int status = gEnv->initFromOptions(argc, argv);
- if (status == 0) {
- status = RUN_ALL_TESTS();
- ALOGI("Test result = %d", status);
+
+ // Set the resource directory based on command line args.
+ // Test will fail to set up if the argument is not set.
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
+ sResourceDir = argv[i + 1];
+ break;
+ }
}
- return status;
-}
+
+ return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.xml b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.xml
new file mode 100644
index 0000000..a2fd92a
--- /dev/null
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the"License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an"AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs VtsHalMediaOmxV1_0TargetVideoDecTest.">
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push-file" key="vts_hal_media_omx_v1_0_video_dec_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_video_dec_test" />
+
+ <!-- Files used for video testing -->
+ <option name="push-file" key="bbb_352x288_420p_30fps_32frames.yuv" value="/data/local/tmp/media/bbb_352x288_420p_30fps_32frames.yuv" />
+ <option name="push-file" key="bbb_avc_176x144_300kbps_60fps.h264" value="/data/local/tmp/media/bbb_avc_176x144_300kbps_60fps.h264" />
+ <option name="push-file" key="bbb_avc_176x144_300kbps_60fps.info" value="/data/local/tmp/media/bbb_avc_176x144_300kbps_60fps.info" />
+ <option name="push-file" key="bbb_avc_640x360_768kbps_30fps.h264" value="/data/local/tmp/media/bbb_avc_640x360_768kbps_30fps.h264" />
+ <option name="push-file" key="bbb_avc_640x360_768kbps_30fps.info" value="/data/local/tmp/media/bbb_avc_640x360_768kbps_30fps.info" />
+ <option name="push-file" key="bbb_h263_352x288_300kbps_12fps.h263" value="/data/local/tmp/media/bbb_h263_352x288_300kbps_12fps.h263" />
+ <option name="push-file" key="bbb_h263_352x288_300kbps_12fps.info" value="/data/local/tmp/media/bbb_h263_352x288_300kbps_12fps.info" />
+ <option name="push-file" key="bbb_hevc_176x144_176kbps_60fps.hevc" value="/data/local/tmp/media/bbb_hevc_176x144_176kbps_60fps.hevc" />
+ <option name="push-file" key="bbb_hevc_176x144_176kbps_60fps.info" value="/data/local/tmp/media/bbb_hevc_176x144_176kbps_60fps.info" />
+ <option name="push-file" key="bbb_hevc_640x360_1600kbps_30fps.hevc" value="/data/local/tmp/media/bbb_hevc_640x360_1600kbps_30fps.hevc" />
+ <option name="push-file" key="bbb_hevc_640x360_1600kbps_30fps.info" value="/data/local/tmp/media/bbb_hevc_640x360_1600kbps_30fps.info" />
+ <option name="push-file" key="bbb_mpeg2_176x144_105kbps_25fps.info" value="/data/local/tmp/media/bbb_mpeg2_176x144_105kbps_25fps.info" />
+ <option name="push-file" key="bbb_mpeg2_176x144_105kbps_25fps.m2v" value="/data/local/tmp/media/bbb_mpeg2_176x144_105kbps_25fps.m2v" />
+ <option name="push-file" key="bbb_mpeg2_352x288_1mbps_60fps.info" value="/data/local/tmp/media/bbb_mpeg2_352x288_1mbps_60fps.info" />
+ <option name="push-file" key="bbb_mpeg2_352x288_1mbps_60fps.m2v" value="/data/local/tmp/media/bbb_mpeg2_352x288_1mbps_60fps.m2v" />
+ <option name="push-file" key="bbb_mpeg4_352x288_512kbps_30fps.info" value="/data/local/tmp/media/bbb_mpeg4_352x288_512kbps_30fps.info" />
+ <option name="push-file" key="bbb_mpeg4_352x288_512kbps_30fps.m4v" value="/data/local/tmp/media/bbb_mpeg4_352x288_512kbps_30fps.m4v" />
+ <option name="push-file" key="bbb_vp8_176x144_240kbps_60fps.info" value="/data/local/tmp/media/bbb_vp8_176x144_240kbps_60fps.info" />
+ <option name="push-file" key="bbb_vp8_176x144_240kbps_60fps.vp8" value="/data/local/tmp/media/bbb_vp8_176x144_240kbps_60fps.vp8" />
+ <option name="push-file" key="bbb_vp8_640x360_2mbps_30fps.info" value="/data/local/tmp/media/bbb_vp8_640x360_2mbps_30fps.info" />
+ <option name="push-file" key="bbb_vp8_640x360_2mbps_30fps.vp8" value="/data/local/tmp/media/bbb_vp8_640x360_2mbps_30fps.vp8" />
+ <option name="push-file" key="bbb_vp9_176x144_285kbps_60fps.info" value="/data/local/tmp/media/bbb_vp9_176x144_285kbps_60fps.info" />
+ <option name="push-file" key="bbb_vp9_176x144_285kbps_60fps.vp9" value="/data/local/tmp/media/bbb_vp9_176x144_285kbps_60fps.vp9" />
+ <option name="push-file" key="bbb_vp9_640x360_1600kbps_30fps.info" value="/data/local/tmp/media/bbb_vp9_640x360_1600kbps_30fps.info" />
+ <option name="push-file" key="bbb_vp9_640x360_1600kbps_30fps.vp9" value="/data/local/tmp/media/bbb_vp9_640x360_1600kbps_30fps.vp9" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="vts_hal_media_omx_v1_0_video_dec_test" />
+ <option name="native-test-flag" value="-P /data/local/tmp/media/" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
index 2280cee..4b469e6 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
@@ -34,6 +34,8 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
using ::android::hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer;
using ::android::hardware::graphics::bufferqueue::V1_0::IProducerListener;
@@ -56,51 +58,48 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <getopt.h>
#include <media/hardware/HardwareAPI.h>
-#include <media_hidl_test_common.h>
#include <media_video_hidl_test_common.h>
#include <system/window.h>
#include <fstream>
#include <variant>
-static ComponentTestEnvironment* gEnv = nullptr;
+// Resource directory
+std::string sResourceDir = "";
// video encoder test fixture class
-class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- private:
- typedef ::testing::VtsHalHidlTargetTestBase Super;
- public:
- ::std::string getTestCaseInfo() const override {
- return ::std::string() +
- "Component: " + gEnv->getComponent().c_str() + " | " +
- "Role: " + gEnv->getRole().c_str() + " | " +
- "Instance: " + gEnv->getInstance().c_str() + " | " +
- "Res: " + gEnv->getRes().c_str();
+class VideoEncHidlTest
+ : public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
+ public:
+ ::std::string getTestCaseInfo() const {
+ return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
+ "Instance: " + instance_ + " | " + "Res: " + sResourceDir;
}
virtual void SetUp() override {
- Super::SetUp();
+ instance_ = std::get<0>(GetParam());
+ component_ = std::get<1>(GetParam());
+ role_ = std::get<2>(GetParam());
+ ASSERT_NE(sResourceDir.empty(), true);
+
disableTest = false;
android::hardware::media::omx::V1_0::Status status;
- omx = Super::getService<IOmx>(gEnv->getInstance());
+ omx = IOmx::getService(instance_);
ASSERT_NE(omx, nullptr);
observer =
new CodecObserver([this](Message msg, const BufferInfo* buffer) {
handleMessage(msg, buffer);
});
ASSERT_NE(observer, nullptr);
- if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
- disableTest = true;
- EXPECT_TRUE(omx->allocateNode(
- gEnv->getComponent(), observer,
- [&](android::hardware::media::omx::V1_0::Status _s,
- sp<IOmxNode> const& _nl) {
- status = _s;
- this->omxNode = _nl;
- })
- .isOk());
+ if (component_.find("OMX.") != 0) disableTest = true;
+ EXPECT_TRUE(omx->allocateNode(component_, observer,
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IOmxNode> const& _nl) {
+ status = _s;
+ this->omxNode = _nl;
+ })
+ .isOk());
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
disableTest = true;
std::cout << "[ WARN ] Test Disabled, component not present\n";
@@ -108,7 +107,7 @@
}
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
- ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
+ ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
struct StringToName {
const char* Name;
standardComp CompName;
@@ -121,7 +120,7 @@
sizeof(kStringToName) / sizeof(kStringToName[0]);
const char* pch;
char substring[OMX_MAX_STRINGNAME_SIZE];
- strcpy(substring, gEnv->getRole().c_str());
+ strcpy(substring, role_.c_str());
pch = strchr(substring, '.');
ASSERT_NE(pch, nullptr);
compName = unknown_comp;
@@ -158,11 +157,8 @@
source = nullptr;
isSecure = false;
size_t suffixLen = strlen(".secure");
- if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
- isSecure =
- !strcmp(gEnv->getComponent().c_str() +
- strlen(gEnv->getComponent().c_str()) - suffixLen,
- ".secure");
+ if (component_.rfind(".secure") == component_.length() - suffixLen) {
+ isSecure = true;
}
if (isSecure) disableTest = true;
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
@@ -177,7 +173,6 @@
EXPECT_TRUE((omxNode->freeNode()).isOk());
omxNode = nullptr;
}
- Super::TearDown();
}
// callback function to process messages received by onMessages() from IL
@@ -245,6 +240,10 @@
unknown_comp,
};
+ std::string component_;
+ std::string role_;
+ std::string instance_;
+
sp<IOmx> omx;
sp<CodecObserver> observer;
sp<IOmxNode> omxNode;
@@ -1085,23 +1084,23 @@
}
// set component role
-TEST_F(VideoEncHidlTest, SetRole) {
+TEST_P(VideoEncHidlTest, SetRole) {
description("Test Set Component Role");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
}
// port format enumeration
-TEST_F(VideoEncHidlTest, EnumeratePortFormat) {
+TEST_P(VideoEncHidlTest, EnumeratePortFormat) {
description("Test Component on Mandatory Port Parameters (Port Format)");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
OMX_U32 xFramerate = (30U << 16);
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1121,12 +1120,12 @@
}
// Test IOmxBufferSource CallBacks
-TEST_F(VideoEncHidlTest, BufferSourceCallBacks) {
+TEST_P(VideoEncHidlTest, BufferSourceCallBacks) {
description("Test IOmxBufferSource CallBacks");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1178,12 +1177,12 @@
}
// test raw stream encode (input is byte buffers)
-TEST_F(VideoEncHidlTest, EncodeTest) {
+TEST_P(VideoEncHidlTest, EncodeTest) {
description("Test Encode");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1193,7 +1192,7 @@
kPortIndexOutput = kPortIndexInput + 1;
}
char mURL[512];
- strcpy(mURL, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
GetURLForComponent(mURL);
std::ifstream eleStream;
@@ -1293,12 +1292,12 @@
}
// test raw stream encode (input is ANW buffers)
-TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
+TEST_P(VideoEncHidlTest, EncodeTestBufferMetaModes) {
description("Test Encode Input buffer metamodes");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1383,7 +1382,7 @@
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
char mURL[512];
- strcpy(mURL, gEnv->getRes().c_str());
+ strcpy(mURL, sResourceDir.c_str());
GetURLForComponent(mURL);
uint32_t latency = 0;
@@ -1460,12 +1459,12 @@
}
// Test end of stream
-TEST_F(VideoEncHidlTest, EncodeTestEOS) {
+TEST_P(VideoEncHidlTest, EncodeTestEOS) {
description("Test EOS");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
- status = setRole(omxNode, gEnv->getRole().c_str());
+ status = setRole(omxNode, role_);
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
OMX_PORT_PARAM_TYPE params;
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
@@ -1574,15 +1573,21 @@
ASSERT_EQ(returnval, 0);
}
+INSTANTIATE_TEST_SUITE_P(PerInstance, VideoEncHidlTest, testing::ValuesIn(kTestParameters),
+ android::hardware::PrintInstanceTupleNameToString<>);
+
int main(int argc, char** argv) {
- gEnv = new ComponentTestEnvironment();
- ::testing::AddGlobalTestEnvironment(gEnv);
+ kTestParameters = getTestParameters("video_encoder");
::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
- int status = gEnv->initFromOptions(argc, argv);
- if (status == 0) {
- status = RUN_ALL_TESTS();
- ALOGI("Test result = %d", status);
+
+ // Set the resource directory based on command line args.
+ // Test will fail to set up if the argument is not set.
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
+ sResourceDir = argv[i + 1];
+ break;
+ }
}
- return status;
-}
+
+ return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.xml b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.xml
new file mode 100644
index 0000000..57ba1e4
--- /dev/null
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the"License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an"AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs VtsHalMediaOmxV1_0TargetVideoEncTest.">
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push-file" key="vts_hal_media_omx_v1_0_video_enc_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_video_enc_test" />
+
+ <!-- Files used for video testing -->
+ <option name="push-file" key="bbb_352x288_420p_30fps_32frames.yuv" value="/data/local/tmp/media/bbb_352x288_420p_30fps_32frames.yuv" />
+ <option name="push-file" key="bbb_avc_176x144_300kbps_60fps.h264" value="/data/local/tmp/media/bbb_avc_176x144_300kbps_60fps.h264" />
+ <option name="push-file" key="bbb_avc_176x144_300kbps_60fps.info" value="/data/local/tmp/media/bbb_avc_176x144_300kbps_60fps.info" />
+ <option name="push-file" key="bbb_avc_640x360_768kbps_30fps.h264" value="/data/local/tmp/media/bbb_avc_640x360_768kbps_30fps.h264" />
+ <option name="push-file" key="bbb_avc_640x360_768kbps_30fps.info" value="/data/local/tmp/media/bbb_avc_640x360_768kbps_30fps.info" />
+ <option name="push-file" key="bbb_h263_352x288_300kbps_12fps.h263" value="/data/local/tmp/media/bbb_h263_352x288_300kbps_12fps.h263" />
+ <option name="push-file" key="bbb_h263_352x288_300kbps_12fps.info" value="/data/local/tmp/media/bbb_h263_352x288_300kbps_12fps.info" />
+ <option name="push-file" key="bbb_hevc_176x144_176kbps_60fps.hevc" value="/data/local/tmp/media/bbb_hevc_176x144_176kbps_60fps.hevc" />
+ <option name="push-file" key="bbb_hevc_176x144_176kbps_60fps.info" value="/data/local/tmp/media/bbb_hevc_176x144_176kbps_60fps.info" />
+ <option name="push-file" key="bbb_hevc_640x360_1600kbps_30fps.hevc" value="/data/local/tmp/media/bbb_hevc_640x360_1600kbps_30fps.hevc" />
+ <option name="push-file" key="bbb_hevc_640x360_1600kbps_30fps.info" value="/data/local/tmp/media/bbb_hevc_640x360_1600kbps_30fps.info" />
+ <option name="push-file" key="bbb_mpeg2_176x144_105kbps_25fps.info" value="/data/local/tmp/media/bbb_mpeg2_176x144_105kbps_25fps.info" />
+ <option name="push-file" key="bbb_mpeg2_176x144_105kbps_25fps.m2v" value="/data/local/tmp/media/bbb_mpeg2_176x144_105kbps_25fps.m2v" />
+ <option name="push-file" key="bbb_mpeg2_352x288_1mbps_60fps.info" value="/data/local/tmp/media/bbb_mpeg2_352x288_1mbps_60fps.info" />
+ <option name="push-file" key="bbb_mpeg2_352x288_1mbps_60fps.m2v" value="/data/local/tmp/media/bbb_mpeg2_352x288_1mbps_60fps.m2v" />
+ <option name="push-file" key="bbb_mpeg4_352x288_512kbps_30fps.info" value="/data/local/tmp/media/bbb_mpeg4_352x288_512kbps_30fps.info" />
+ <option name="push-file" key="bbb_mpeg4_352x288_512kbps_30fps.m4v" value="/data/local/tmp/media/bbb_mpeg4_352x288_512kbps_30fps.m4v" />
+ <option name="push-file" key="bbb_vp8_176x144_240kbps_60fps.info" value="/data/local/tmp/media/bbb_vp8_176x144_240kbps_60fps.info" />
+ <option name="push-file" key="bbb_vp8_176x144_240kbps_60fps.vp8" value="/data/local/tmp/media/bbb_vp8_176x144_240kbps_60fps.vp8" />
+ <option name="push-file" key="bbb_vp8_640x360_2mbps_30fps.info" value="/data/local/tmp/media/bbb_vp8_640x360_2mbps_30fps.info" />
+ <option name="push-file" key="bbb_vp8_640x360_2mbps_30fps.vp8" value="/data/local/tmp/media/bbb_vp8_640x360_2mbps_30fps.vp8" />
+ <option name="push-file" key="bbb_vp9_176x144_285kbps_60fps.info" value="/data/local/tmp/media/bbb_vp9_176x144_285kbps_60fps.info" />
+ <option name="push-file" key="bbb_vp9_176x144_285kbps_60fps.vp9" value="/data/local/tmp/media/bbb_vp9_176x144_285kbps_60fps.vp9" />
+ <option name="push-file" key="bbb_vp9_640x360_1600kbps_30fps.info" value="/data/local/tmp/media/bbb_vp9_640x360_1600kbps_30fps.info" />
+ <option name="push-file" key="bbb_vp9_640x360_1600kbps_30fps.vp9" value="/data/local/tmp/media/bbb_vp9_640x360_1600kbps_30fps.vp9" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="vts_hal_media_omx_v1_0_video_enc_test" />
+ <option name="native-test-flag" value="-P /data/local/tmp/media/" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
index e1b6022..5e2c107 100644
--- a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
@@ -44,7 +44,6 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-#include <VtsHalHidlTargetTestBase.h>
#include <hidlmemory/mapping.h>
#include <media/hardware/HardwareAPI.h>
#include <media_hidl_test_common.h>
diff --git a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
index 55de125..e8f5172 100644
--- a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
@@ -17,6 +17,8 @@
#ifndef MEDIA_VIDEO_HIDL_TEST_COMMON_H
#define MEDIA_VIDEO_HIDL_TEST_COMMON_H
+#include <media_hidl_test_common.h>
+
/*
* Common video utils
*/
diff --git a/tests/lazy/1.0/.hidl_for_test b/tests/lazy/1.0/.hidl_for_test
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/lazy/1.0/.hidl_for_test
diff --git a/tests/lazy/1.0/Android.bp b/tests/lazy/1.0/Android.bp
new file mode 100644
index 0000000..d2f8175
--- /dev/null
+++ b/tests/lazy/1.0/Android.bp
@@ -0,0 +1,14 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.tests.lazy@1.0",
+ root: "android.hardware",
+ system_ext_specific: true,
+ srcs: [
+ "ILazy.hal",
+ ],
+ interfaces: [
+ "android.hidl.base@1.0",
+ ],
+ gen_java: true,
+}
diff --git a/tests/lazy/1.0/ILazy.hal b/tests/lazy/1.0/ILazy.hal
new file mode 100644
index 0000000..b0be48e
--- /dev/null
+++ b/tests/lazy/1.0/ILazy.hal
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.tests.lazy@1.0;
+
+interface ILazy {};