公制測試

指標測試通常用於練習硬體抽象層 (HAL) 或直接與較低層級的系統服務互動。為了利用持續測試服務,應使用google-benchmark框架建構指標測試。

例子

請參閱範例度量測試模組設定: bionic/benchmarks/bionic-benchmarks

步驟總結

  1. 測試模組設定檔應使用BUILD_NATIVE_BENCHMARK建置規則,以便自動包含 google-benchmark 依賴項。
  2. 使用 make 建置測試模組:

    make -j40 bionic-benchmarks
    
  3. 使用 Trade Federation 測試工具自動安裝和執行:

    make tradefed-all -j
    tradefed.sh run template/local_min --template:map test=bionic-benchmarks
    
  4. 手動安裝並運行如下:

    1. 將產生的測試二進位檔案推送到裝置上:

      adb push ${OUT}/data/benchmarktest/bionic-benchmarks/bionic-benchmarks32 \
        /data/benchmarktest/bionic-benchmarks/bionic-benchmarks32
      
    2. 透過在裝置上呼叫測試二進位檔案來執行測試:

      adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks32