1#!/usr/bin/env bash
2
3# While we support GNU Make & CMake together, check that unit tests support both
4CMAKE_UT_PATHS=$( find ${IDF_PATH}/components/ -type f -name CMakeLists.txt | grep "/test/" | grep -v "mbedtls/programs")
5MAKE_UT_PATHS=$( find ${IDF_PATH}/components/ -type f -name component.mk | grep "/test/" )
6
7CMAKE_UT_PATHS="$(/usr/bin/dirname $CMAKE_UT_PATHS | sort -n)"
8MAKE_UT_PATHS="$(/usr/bin/dirname $MAKE_UT_PATHS | sort -n)"
9
10MISMATCH=$(comm -3 <(echo "$MAKE_UT_PATHS") <(echo "$CMAKE_UT_PATHS"))
11
12if [ -n "$MISMATCH" ]; then
13    echo "Some unit tests are not in both CMake and GNU Make:"
14    echo "$MISMATCH"
15    exit 1
16fi
17
18echo "Unit tests match"
19exit 0
20