CTS 测试方式,CtsMediaTestCases 媒体包放到SD卡本地测试
在跑cts-on-gsi 在配置了翻墙VPN 的情况下还是遇到fail,复现步骤如下:
1、烧写load后,替换GSI ,GSI版本是7919922。
2、执行 run cts-on-gsi -m CtsMediaTestCases 时剩下如下fail。
android.media.cts.MediaCodecCapabilitiesTest#testAvcBaseline12 fail junit.framework.AssertionFailedError: Stream did not play successfully after all attempts
android.media.cts.MediaCodecCapabilitiesTest#testAvcBaseline30 fail junit.framework.AssertionFailedError: Stream did not play successfully after all attempts
android.media.cts.MediaCodecCapabilitiesTest#testAvcHigh31 fail Test failed to run to completion. Reason: ‘Test run failed to complete. Expected 45 tests, received 5’. Check device logcat for details
android.media.cts.MediaCodecCapabilitiesTest#testAvcHigh40 fail Test failed to run to completion. Reason: ‘Test run failed to complete. Expected 7 tests, received 0’. Check device logcat for details
android.media.cts.StreamingMediaPlayerTest#testHTTP_H263_AMR_Video1 fail junit.framework.AssertionFailedError: Stream did not play successfully after all attempts
android.media.cts.StreamingMediaPlayerTest#testHTTP_H263_AMR_Video2 fail junit.framework.AssertionFailedError: Stream did not play successfully after all attempts
android.media.cts.StreamingMediaPlayerTest#testHTTP_H264Base_AAC_Video1 fail Test failed to run to completion. Reason: ‘Test run failed to complete. Expected 6 tests, received 2’. Check device logcat for details
android.media.cts.StreamingMediaPlayerTest#testHTTP_H264Base_AAC_Video2 fail test did not run due to instrumentation issue.
android.media.cts.StreamingMediaPlayerTest#testHTTP_MPEG4SP_AAC_Video1 fail test did not run due to instrumentation issue.
android.media.cts.StreamingMediaPlayerTest#testHTTP_MPEG4SP_AAC_Video2 fail test did not run due to instrumentation issue.
这些fail一般是由于网络环境差导致,因为跑这些case需要下载媒体文件,由于未能下载成功导致,可以采用使用本地媒体文件的方法来跑,操作如下:
1下载文件如下所示。
参考https://source.android.com/compatibility/cts/run-locally
CTS 媒体 1.5
CtsMediaTestCases 仅媒体文件
2设置 CTS 媒体测试
将 android-cts-media-1.5.zip 的下载内容解压缩到 android-cts-media-1.5 文件夹。
将 CtsMediaTestCases.zip 媒体文件的下载内容解压缩到 CtsMediaTestCases 文件夹。
将文件复制到设备的 SD 卡:
$adb push CtsMediaTestCases /sdcard/
然后使用以下命令运行模块:
run cts -m CtsMediaTestCases --module-arg CtsMediaTestCases:config-url:https://storage.googleapis.com/cts_media/DynamicConfig_local.json --module-arg CtsMediaTestCases:local-media-path:/tmp/android-cts-media-1.5 --shard-count 6 -t android.media.cts.MediaCodecCapabilitiesTest#testAvcBaseline12
注意 --module-arg CtsMediaTestCases:config-url:https://storage.googleapis.com/cts_media/DynamicConfig_local.json 是制定用DynamicConfig_local.json这个json文件,其部分内容如下:
“media_codec_capabilities_test_avc_baseline12”: {
“configValues”: [
“file:///sdcard/CtsMediaTestCases/media_codec_capabilities_test_avc_baseline12.mp4” // 直接配置了待下载文件在SD上的路径,这样不再通过网络在线下载测试的mp4文件
]
},
“media_codec_capabilities_test_avc_baseline30”: {
“configValues”: [
“file:///sdcard/CtsMediaTestCases/media_codec_capabilities_test_avc_baseline30.mp4”
]
}
直接配置了待下载文件在SD上的路径,这样不再通过网络在线下载测试的mp4文件。