]> granicus.if.org Git - esp-idf/commitdiff
tools: Add unit tests
authorKonstantinKondrashov <konstantin@espressif.com>
Wed, 23 Jan 2019 12:27:28 +0000 (20:27 +0800)
committerKonstantin Kondrashov <konstantin@espressif.com>
Thu, 24 Jan 2019 04:13:38 +0000 (12:13 +0800)
tools/ci/test_build_system.sh
tools/ci/test_build_system_cmake.sh

index 305a6e489977c4b5e34568caca2f81529487a3fd..99da318d61c6f91acb2ce3ef2aba3a4b16263bec 100755 (executable)
@@ -251,7 +251,18 @@ function run_tests()
        make
     assert_rebuilt ${APP_BINS}
     assert_not_rebuilt ${BOOTLOADER_BINS} esp32/libesp32.a
+    
+    print_status "Re-building does not change app.bin"
+    take_build_snapshot
+    make
+    assert_not_rebuilt ${APP_BINS} ${BOOTLOADER_BINS} esp32/libesp32.a
     rm -f ${TESTDIR}/template/version.txt
+
+    print_status "Get the version of app from git describe. Project is not inside IDF and do not have a tag only a hash commit."
+    make >> log.log || failure "Failed to build"
+    version="App \"app-template\" version: "
+    version+=$(git describe --always --tags --dirty)
+    grep "${version}" log.log || failure "Project version should have a hash commit"
     
     print_status "Build fails if partitions don't fit in flash"
     sed -i.bak "s/CONFIG_ESPTOOLPY_FLASHSIZE.\+//" sdkconfig  # remove all flashsize config
index 46abc89d5ca780d6b80be59df0c1c04223753d12..3fb5cb103ddd5b32aaac36b71e0a9ef5ceebaf1d 100755 (executable)
@@ -107,8 +107,19 @@ function run_tests()
        idf.py build || failure "Failed to rebuild with changed app version"
     assert_rebuilt ${APP_BINS}
     assert_not_rebuilt ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a
+    
+    print_status "Re-building does not change app.bin"
+    take_build_snapshot
+    idf.py build
+    assert_not_rebuilt ${APP_BINS} ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a
     rm -f ${TESTDIR}/template/version.txt
     
+    print_status "Get the version of app from git describe. Project is not inside IDF and do not have a tag only a hash commit."
+    idf.py build >> log.log || failure "Failed to build"
+    version="Project version: "
+    version+=$(git describe --always --tags --dirty)
+    grep "${version}" log.log || failure "Project version should have a hash commit"
+
     print_status "Moving BUILD_DIR_BASE out of tree"
     clean_build_dir
     OUTOFTREE_BUILD=${TESTDIR}/alt_build