]> granicus.if.org Git - esp-idf/commitdiff
tools/ci: add test case for build without dependency on `git`
authorMahavir Jain <mahavir@espressif.com>
Thu, 12 Apr 2018 12:56:43 +0000 (18:26 +0530)
committerMahavir Jain <mahavir@espressif.com>
Fri, 13 Apr 2018 11:45:17 +0000 (17:15 +0530)
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
tools/ci/test_build_system.sh

index d83198bf46bd6888772744f7958ae3a103bd0031..a6640b4ed25ed11cce94fde6f249771918f7018b 100755 (executable)
@@ -205,6 +205,23 @@ function run_tests()
     git checkout main/component.mk
     rm -rf extra_source_dir
 
+    print_status "Can build without git installed on system"
+    clean_build_dir
+    # Make provision for getting IDF version
+    echo "custom-version-x.y" > ${IDF_PATH}/version.txt
+    # Hide .gitmodules so that submodule check is avoided
+    [ -f ${IDF_PATH}/.gitmodules ] && mv ${IDF_PATH}/.gitmodules ${IDF_PATH}/.gitmodules_backup
+    # Overload `git` command
+    echo -e '#!/bin/bash\ntouch ${IDF_PATH}/git_invoked' > git
+    chmod +x git
+    OLD_PATH=$PATH
+    export PATH="$PWD:$PATH"
+    make
+    [ -f ${IDF_PATH}/git_invoked ] && rm ${IDF_PATH}/git_invoked && failure "git should not have been invoked in this case"
+    rm -f ${IDF_PATH}/version.txt git
+    [ -f ${IDF_PATH}/.gitmodules_backup ] && mv ${IDF_PATH}/.gitmodules_backup ${IDF_PATH}/.gitmodules
+    export PATH=$OLD_PATH
+
     print_status "All tests completed"
     if [ -n "${FAILURES}" ]; then
         echo "Some failures were detected:"