1#!/usr/bin/env bash
2
3cd ${IDF_PATH}/tools/unit-test-app
4
5AVAL_CONFIGS=""
6CONFIGS=$(ls configs)
7if [ $1 == "esp32" ]; then
8    #echo 'Searching for configs for target "'$1'"'
9    for FILE in $CONFIGS
10    do
11        grep 'CONFIG_IDF_TARGET' <configs/$FILE > /dev/null
12        if [ $? -ne 0 ]; then
13            # If CONFIG_IDF_TARGET not found, implies ESP32
14            AVAL_CONFIGS="$AVAL_CONFIGS $FILE"
15        fi
16        grep -E '^CONFIG_IDF_TARGET="?'$1'"?$' <configs/$FILE > /dev/null
17        if [ $? -eq 0 ]; then
18            AVAL_CONFIGS="$AVAL_CONFIGS $FILE"
19        fi
20    done
21else
22    #echo 'Searching for configs for target "'$1'"'
23    for FILE in $CONFIGS
24    do
25        grep -E '^CONFIG_IDF_TARGET="?'$1'"?$' <configs/$FILE > /dev/null
26        if [ $? -eq 0 ]; then
27            AVAL_CONFIGS="$AVAL_CONFIGS $FILE"
28        fi
29    done
30fi
31
32echo $AVAL_CONFIGS
33