1#!/usr/bin/env bash
2
3# Runs all released packages through the hidl2aidl tool and reports any failures
4# Requires that hidl2aidl is built.
5# 'm hidl2aidl'
6
7
8function hidl2aidl-all-interfaces-main() {
9    local ANY_FAIL=0
10    local TEST_DIR='/tmp/hidl2aidl_test'
11    set -e
12    mkdir "$TEST_DIR"
13    source "${ANDROID_BUILD_TOP}/system/tools/hidl/scripts/hal-queries.sh"
14
15    for i in $(aosp-released-packages);
16    do
17        hidl2aidl -o "$TEST_DIR" -f "$i" || \
18            { echo "FAIL: $i"; ANY_FAIL=1; }
19    done
20
21    rm -rf "$TEST_DIR"
22
23    [ $ANY_FAIL -eq 0 ] && echo 'All passed!'
24}
25
26hidl2aidl-all-interfaces-main
27