From 52152e0be641c80c0dbb1e36ab3654efbd27661f Mon Sep 17 00:00:00 2001 From: Florin Blanaru Date: Thu, 11 Aug 2022 19:25:28 +0100 Subject: [PATCH] Build and test TVM under minimal configuration (#12178) This PR builds and tests TVM (running the CPP and unittests) under minimal configuration with some debug flags enabled: - `USE_RELAY_DEBUG=ON` in TVM - `-Wp,-D_GLIBCXX_ASSERTIONS` in TVM - `-DLLVM_ENABLE_ASSERTIONS=ON` in LLVM It also adds this configuration to the CI. `tests/python/unittest/test_meta_schedule_task_scheduler.py::test_meta_schedule_task_scheduler_multiple_gradient_based` results in an array OOB access and a segfault due to `D_GLIBCXX_ASSERTIONS`. I disable this test for now and will open an issue to solve it ASAP. It should fix #11932 and address [this discussion](https://discuss.tvm.apache.org/t/pre-rfc-new-ci-container-ci-cpu-asserts/12536/9). --- CMakeLists.txt | 2 + Jenkinsfile | 141 +++++++++++++++++- ci/jenkins/Build.groovy.j2 | 19 ++- ci/jenkins/Jenkinsfile.j2 | 1 + ci/jenkins/Test.groovy.j2 | 16 ++ ci/jenkins/generate.py | 4 + ci/jenkins/macros.j2 | 23 +++ cmake/utils/Summary.cmake | 7 + docker/Dockerfile.ci_minimal | 57 +++++++ .../install/ubuntu1804_manual_install_llvm.sh | 38 +++++ tests/python/ci/test_ci.py | 1 + .../test_meta_schedule_task_scheduler.py | 1 + tests/scripts/ci.py | 13 ++ tests/scripts/task_config_build_minimal.sh | 34 +++++ tests/scripts/task_cpp_unittest.sh | 24 +-- 15 files changed, 367 insertions(+), 14 deletions(-) create mode 100644 docker/Dockerfile.ci_minimal create mode 100755 docker/install/ubuntu1804_manual_install_llvm.sh create mode 100755 tests/scripts/task_config_build_minimal.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dd061954156..a321f64b3acd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -796,3 +796,5 @@ find_and_set_linker(${USE_ALTERNATIVE_LINKER}) if(${SUMMARIZE}) print_summary() endif() + +dump_options_to_file("${TVM_ALL_OPTIONS}") diff --git a/Jenkinsfile b/Jenkinsfile index dc857c316c1c..5656f7eb5337 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,6 +52,7 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils ci_lint = 'tlcpack/ci-lint:20220715-060127-37f9d3c49' ci_gpu = 'tlcpack/ci-gpu:20220801-060139-d332eb374' ci_cpu = 'tlcpack/ci-cpu:20220715-060127-37f9d3c49' +ci_minimal = 'tlcpack/ci-minimal:20220725-133226-d3cefdaf1' ci_wasm = 'tlcpack/ci-wasm:20220715-060127-37f9d3c49' ci_i386 = 'tlcpack/ci-i386:20220715-060127-37f9d3c49' ci_cortexm = 'tlcpack/ci-cortexm:v0.01' @@ -66,6 +67,7 @@ properties([ parameters([ string(name: 'ci_arm_param', defaultValue: ''), string(name: 'ci_cpu_param', defaultValue: ''), + string(name: 'ci_minimal_param', defaultValue: ''), string(name: 'ci_gpu_param', defaultValue: ''), string(name: 'ci_hexagon_param', defaultValue: ''), string(name: 'ci_i386_param', defaultValue: ''), @@ -79,6 +81,7 @@ properties([ // is used) built_ci_arm = null; built_ci_cpu = null; + built_ci_minimal = null; built_ci_gpu = null; built_ci_hexagon = null; built_ci_i386 = null; @@ -278,7 +281,7 @@ def prepare() { if (env.DETERMINE_DOCKER_IMAGES == 'yes') { sh( - script: "./tests/scripts/determine_docker_images.py ci_arm=${ci_arm} ci_cpu=${ci_cpu} ci_gpu=${ci_gpu} ci_hexagon=${ci_hexagon} ci_i386=${ci_i386} ci_lint=${ci_lint} ci_cortexm=${ci_cortexm} ci_wasm=${ci_wasm} ", + script: "./tests/scripts/determine_docker_images.py ci_arm=${ci_arm} ci_cpu=${ci_cpu} ci_minimal=${ci_minimal} ci_gpu=${ci_gpu} ci_hexagon=${ci_hexagon} ci_i386=${ci_i386} ci_lint=${ci_lint} ci_cortexm=${ci_cortexm} ci_wasm=${ci_wasm} ", label: 'Decide whether to use tlcpack or tlcpackstaging for Docker images', ) // Pull image names from the results of should_rebuild_docker.py @@ -292,6 +295,11 @@ def prepare() { label: "Find docker image name for ci_cpu", returnStdout: true, ).trim() + ci_minimal = sh( + script: "cat .docker-image-names/ci_minimal", + label: "Find docker image name for ci_minimal", + returnStdout: true, + ).trim() ci_gpu = sh( script: "cat .docker-image-names/ci_gpu", label: "Find docker image name for ci_gpu", @@ -326,6 +334,7 @@ def prepare() { ci_arm = params.ci_arm_param ?: ci_arm ci_cpu = params.ci_cpu_param ?: ci_cpu + ci_minimal = params.ci_minimal_param ?: ci_minimal ci_gpu = params.ci_gpu_param ?: ci_gpu ci_hexagon = params.ci_hexagon_param ?: ci_hexagon ci_i386 = params.ci_i386_param ?: ci_i386 @@ -337,6 +346,7 @@ def prepare() { echo "Docker images being used in this build:" echo " ci_arm = ${ci_arm}" echo " ci_cpu = ${ci_cpu}" + echo " ci_minimal = ${ci_minimal}" echo " ci_gpu = ${ci_gpu}" echo " ci_hexagon = ${ci_hexagon}" echo " ci_i386 = ${ci_i386}" @@ -488,6 +498,17 @@ def build_docker_images() { } } }, + 'ci_minimal': { + node('CPU') { + timeout(time: max_time, unit: 'MINUTES') { + init_git() + // We're purposefully not setting the built image here since they + // are not yet being uploaded to tlcpack + // ci_minimal = build_image('ci_minimal') + built_ci_minimal = build_image('ci_minimal'); + } + } + }, 'ci_gpu': { node('CPU') { timeout(time: max_time, unit: 'MINUTES') { @@ -636,7 +657,6 @@ def cpp_unittest(image) { ) } - def add_microtvm_permissions() { sh( script: 'find build/microtvm_template_projects -type f | grep qemu-hack | xargs chmod +x', @@ -827,6 +847,56 @@ stage('Build') { Utils.markStageSkippedForConditional('BUILD: CPU') } }, + 'BUILD: CPU MINIMAL': { + if (!skip_ci && is_docs_only_build != 1) { + node('CPU-SMALL') { + ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-cpu-minimal") { + docker_init(ci_minimal) + init_git() + sh ( + script: "${docker_run} ${ci_minimal} ./tests/scripts/task_config_build_minimal.sh build", + label: 'Create CPU minimal cmake config', + ) + make(ci_minimal, 'build', '-j2') + sh( + script: """ + set -eux + retry() { + local retries=\$1 + shift + + local count=0 + until "\$@"; do + exit=\$? + wait=\$((2 ** \$count)) + count=\$((\$count + 1)) + if [ \$count -lt \$retries ]; then + echo "Retry \$count/\$retries exited \$exit, retrying in \$wait seconds..." + sleep \$wait + else + echo "Retry \$count/\$retries exited \$exit, no more retries left." + return \$exit + fi + done + return 0 + } + + md5sum build/libtvm.so + retry 3 aws s3 cp --no-progress build/libtvm.so s3://${s3_prefix}/cpu-minimal/build/libtvm.so + md5sum build/libtvm_runtime.so + retry 3 aws s3 cp --no-progress build/libtvm_runtime.so s3://${s3_prefix}/cpu-minimal/build/libtvm_runtime.so + md5sum build/config.cmake + retry 3 aws s3 cp --no-progress build/config.cmake s3://${s3_prefix}/cpu-minimal/build/config.cmake + """, + label: 'Upload artifacts to S3', + ) + + } + } + } else { + Utils.markStageSkippedForConditional('BUILD: CPU MINIMAL') + } + }, 'BUILD: WASM': { if (!skip_ci && is_docs_only_build != 1) { node('CPU-SMALL') { @@ -4906,6 +4976,69 @@ def shard_run_test_Cortex_M_8_of_8() { } +def run_unittest_minimal() { + if (!skip_ci && is_docs_only_build != 1) { + node('CPU-SMALL') { + ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/ut-python-cpu-minimal") { + timeout(time: max_time, unit: 'MINUTES') { + try { + docker_init(ci_minimal) + init_git() + withEnv(['PLATFORM=minimal'], { + sh( + script: """ + set -eux + retry() { + local retries=\$1 + shift + + local count=0 + until "\$@"; do + exit=\$? + wait=\$((2 ** \$count)) + count=\$((\$count + 1)) + if [ \$count -lt \$retries ]; then + echo "Retry \$count/\$retries exited \$exit, retrying in \$wait seconds..." + sleep \$wait + else + echo "Retry \$count/\$retries exited \$exit, no more retries left." + return \$exit + fi + done + return 0 + } + + retry 3 aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/libtvm.so build/libtvm.so + md5sum build/libtvm.so + retry 3 aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/libtvm_runtime.so build/libtvm_runtime.so + md5sum build/libtvm_runtime.so + retry 3 aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/config.cmake build/config.cmake + md5sum build/config.cmake + """, + label: 'Download artifacts from S3', + ) + + cpp_unittest(ci_minimal) + python_unittest(ci_minimal) + }) + } finally { + sh( + script: """ + set -eux + aws s3 cp --no-progress build/pytest-results s3://${s3_prefix}/pytest-results/unittest_CPU_MINIMAL --recursive + """, + label: 'Upload JUnits to S3', + ) + + junit 'build/pytest-results/*.xml' + } + } + } + } + } else { + Utils.markStageSkippedForConditional('unittest: CPU MINIMAL') + } +} def test() { stage('Test') { @@ -5066,6 +5199,9 @@ stage('Test') { 'test: Cortex-M 8 of 8': { shard_run_test_Cortex_M_8_of_8() }, + 'unittest: CPU MINIMAL': { + run_unittest_minimal() + }, 'unittest: CPU': { if (!skip_ci && is_docs_only_build != 1) { node('CPU-SMALL') { @@ -5439,6 +5575,7 @@ def deploy() { def tag = "${date_Ymd_HMS}-${upstream_revision.substring(0, 8)}" update_docker(built_ci_arm, "tlcpackstaging/ci_arm:${tag}") update_docker(built_ci_cpu, "tlcpackstaging/ci_cpu:${tag}") + update_docker(built_ci_minimal, "tlcpackstaging/ci_minimal:${tag}") update_docker(built_ci_gpu, "tlcpackstaging/ci_gpu:${tag}") update_docker(built_ci_hexagon, "tlcpackstaging/ci_hexagon:${tag}") update_docker(built_ci_i386, "tlcpackstaging/ci_i386:${tag}") diff --git a/ci/jenkins/Build.groovy.j2 b/ci/jenkins/Build.groovy.j2 index a4316a268e9a..21b8b2c65f8b 100644 --- a/ci/jenkins/Build.groovy.j2 +++ b/ci/jenkins/Build.groovy.j2 @@ -33,7 +33,6 @@ def cpp_unittest(image) { ) } - def add_microtvm_permissions() { {% for folder in microtvm_template_projects %} sh( @@ -123,6 +122,24 @@ stage('Build') { Utils.markStageSkippedForConditional('BUILD: CPU') } }, + 'BUILD: CPU MINIMAL': { + if (!skip_ci && is_docs_only_build != 1) { + node('CPU-SMALL') { + ws({{ m.per_exec_ws('tvm/build-cpu-minimal') }}) { + docker_init(ci_minimal) + init_git() + sh ( + script: "${docker_run} ${ci_minimal} ./tests/scripts/task_config_build_minimal.sh build", + label: 'Create CPU minimal cmake config', + ) + make(ci_minimal, 'build', '-j2') + {{ m.upload_artifacts(tag='cpu-minimal', filenames=tvm_lib) }} + } + } + } else { + Utils.markStageSkippedForConditional('BUILD: CPU MINIMAL') + } + }, 'BUILD: WASM': { if (!skip_ci && is_docs_only_build != 1) { node('CPU-SMALL') { diff --git a/ci/jenkins/Jenkinsfile.j2 b/ci/jenkins/Jenkinsfile.j2 index 8d048f10dcd4..28ce2c8e1cfb 100644 --- a/ci/jenkins/Jenkinsfile.j2 +++ b/ci/jenkins/Jenkinsfile.j2 @@ -54,6 +54,7 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils ci_lint = 'tlcpack/ci-lint:20220715-060127-37f9d3c49' ci_gpu = 'tlcpack/ci-gpu:20220801-060139-d332eb374' ci_cpu = 'tlcpack/ci-cpu:20220715-060127-37f9d3c49' +ci_minimal = 'tlcpack/ci-minimal:20220725-133226-d3cefdaf1' ci_wasm = 'tlcpack/ci-wasm:20220715-060127-37f9d3c49' ci_i386 = 'tlcpack/ci-i386:20220715-060127-37f9d3c49' ci_cortexm = 'tlcpack/ci-cortexm:v0.01' diff --git a/ci/jenkins/Test.groovy.j2 b/ci/jenkins/Test.groovy.j2 index b2afdacad7d1..09550a469701 100644 --- a/ci/jenkins/Test.groovy.j2 +++ b/ci/jenkins/Test.groovy.j2 @@ -211,6 +211,19 @@ ) {% endcall %} +def run_unittest_minimal() { + {% call m.test_step_body( + name="unittest: CPU MINIMAL", + node="CPU-SMALL", + ws="tvm/ut-python-cpu-minimal", + platform="minimal", + docker_image="ci_minimal", + ) %} + {{ m.download_artifacts(tag='cpu-minimal', filenames=tvm_lib) }} + cpp_unittest(ci_minimal) + python_unittest(ci_minimal) + {% endcall %} +} def test() { stage('Test') { @@ -223,6 +236,9 @@ stage('Test') { {{ method_name }}() }, {% endfor %} + 'unittest: CPU MINIMAL': { + run_unittest_minimal() + }, {% call m.test_step( name="unittest: CPU", node="CPU-SMALL", diff --git a/ci/jenkins/generate.py b/ci/jenkins/generate.py index 82bf4e5aaa1f..3d0198ba6fd9 100644 --- a/ci/jenkins/generate.py +++ b/ci/jenkins/generate.py @@ -40,6 +40,10 @@ "name": "ci_cpu", "platform": "CPU", }, + { + "name": "ci_minimal", + "platform": "CPU", + }, { "name": "ci_gpu", "platform": "CPU", diff --git a/ci/jenkins/macros.j2 b/ci/jenkins/macros.j2 index a80e6b2851e4..1ecfa56d0c35 100644 --- a/ci/jenkins/macros.j2 +++ b/ci/jenkins/macros.j2 @@ -86,6 +86,29 @@ def {{ method_name }}() { {% endfor %} {% endmacro %} +{% macro test_step_body(name, node, ws, docker_image, platform) %} +{% set test_dir_name = name.replace(":", "").replace(" ", "-").replace("-", "_")|string %} + if (!skip_ci && is_docs_only_build != 1) { + node('{{ node }}') { + ws({{ per_exec_ws(ws) }}) { + timeout(time: max_time, unit: 'MINUTES') { + try { + docker_init({{ docker_image }}) + init_git() + withEnv(['PLATFORM={{ platform }}'], { + {{ caller() | indent(width=8) | trim }} + }) + } finally { + {{ junit_to_s3(test_dir_name) | indent(width=0) }} + junit 'build/pytest-results/*.xml' + } + } + } + } + } else { + Utils.markStageSkippedForConditional('{{ name }}') + } +{% endmacro %} {% macro test_step(name, node, ws, docker_image, platform) %} {% set test_dir_name = name.replace(":", "").replace(" ", "-").replace("-", "_")|string %} diff --git a/cmake/utils/Summary.cmake b/cmake/utils/Summary.cmake index 7059135fb22b..1b973f253a00 100644 --- a/cmake/utils/Summary.cmake +++ b/cmake/utils/Summary.cmake @@ -67,3 +67,10 @@ macro(print_summary) message(STATUS ${OUT} " : " ${OPTION_VALUE}) endforeach() endmacro() + +function(dump_options_to_file tvm_options) + file(REMOVE ${CMAKE_BINARY_DIR}/TVMBuildOptions.txt) + foreach(option ${tvm_options}) + file(APPEND ${CMAKE_BINARY_DIR}/TVMBuildOptions.txt "${option} ${${option}} \n") + endforeach() +endfunction() diff --git a/docker/Dockerfile.ci_minimal b/docker/Dockerfile.ci_minimal new file mode 100644 index 000000000000..cf548989eba2 --- /dev/null +++ b/docker/Dockerfile.ci_minimal @@ -0,0 +1,57 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# CI docker minimal CPU env +FROM ubuntu:18.04 + +COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear + +RUN apt-get update --fix-missing + +COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh +RUN bash /install/ubuntu_install_core.sh + +COPY install/ubuntu_install_googletest.sh /install/ubuntu_install_googletest.sh +RUN bash /install/ubuntu_install_googletest.sh + +COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh +RUN bash /install/ubuntu1804_install_python.sh + +# Globally disable pip cache +RUN pip config set global.no-cache-dir false + +COPY install/ubuntu_install_python_package.sh /install/ubuntu_install_python_package.sh +RUN bash /install/ubuntu_install_python_package.sh + +COPY install/ubuntu1804_manual_install_llvm.sh /install/ubuntu1804_manual_install_llvm.sh +RUN bash /install/ubuntu1804_manual_install_llvm.sh + +# Rust env (build early; takes a while) +COPY install/ubuntu_install_rust.sh /install/ubuntu_install_rust.sh +RUN bash /install/ubuntu_install_rust.sh +ENV RUSTUP_HOME /opt/rust +ENV CARGO_HOME /opt/rust +ENV PATH $PATH:$CARGO_HOME/bin + +# AutoTVM deps +COPY install/ubuntu_install_redis.sh /install/ubuntu_install_redis.sh +RUN bash /install/ubuntu_install_redis.sh + +# sccache +COPY install/ubuntu_install_sccache.sh /install/ubuntu_install_sccache.sh +RUN bash /install/ubuntu_install_sccache.sh +ENV PATH /opt/sccache:$PATH \ No newline at end of file diff --git a/docker/install/ubuntu1804_manual_install_llvm.sh b/docker/install/ubuntu1804_manual_install_llvm.sh new file mode 100755 index 000000000000..f0e9abd1d9fd --- /dev/null +++ b/docker/install/ubuntu1804_manual_install_llvm.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e +set -u +set -o pipefail + +git clone --depth 1 --branch release/11.x https://github.com/llvm/llvm-project.git +pushd llvm-project +mkdir build +pushd build +cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_ENABLE_ASSERTIONS=ON \ + -DLLVM_ENABLE_PROJECTS="llvm;clang" \ + ../llvm +ninja install +popd +popd +rm -rf llvm-project + diff --git a/tests/python/ci/test_ci.py b/tests/python/ci/test_ci.py index 5ab5e6950494..1c2ab1ffb787 100644 --- a/tests/python/ci/test_ci.py +++ b/tests/python/ci/test_ci.py @@ -914,6 +914,7 @@ def test_open_docker_update_pr( "ci_lint", "ci_gpu", "ci_cpu", + "ci_minimal", "ci_wasm", "ci_i386", "ci_cortexm", diff --git a/tests/python/unittest/test_meta_schedule_task_scheduler.py b/tests/python/unittest/test_meta_schedule_task_scheduler.py index fc2497f05303..3edd81ee9a11 100644 --- a/tests/python/unittest/test_meta_schedule_task_scheduler.py +++ b/tests/python/unittest/test_meta_schedule_task_scheduler.py @@ -23,6 +23,7 @@ import pytest import tvm import tvm.testing +from tvm.support import libinfo from tvm import meta_schedule as ms from tvm._ffi.base import TVMError from tvm.meta_schedule.testing.dummy_object import DummyBuilder, DummyRunner diff --git a/tests/scripts/ci.py b/tests/scripts/ci.py index f5c60c94502a..4cc19462c907 100755 --- a/tests/scripts/ci.py +++ b/tests/scripts/ci.py @@ -595,6 +595,19 @@ def add_subparser( "frontend": ("run frontend tests", ["./tests/scripts/task_python_frontend_cpu.sh"]), }, ), + generate_command( + name="minimal", + help="Run minimal CPU build and test(s)", + options={ + "cpp": CPP_UNITTEST, + "unittest": ( + "run unit tests", + [ + "./tests/scripts/task_python_unittest.sh", + ], + ), + }, + ), generate_command( name="i386", help="Run i386 build and test(s)", diff --git a/tests/scripts/task_config_build_minimal.sh b/tests/scripts/task_config_build_minimal.sh new file mode 100755 index 000000000000..651f54cea21b --- /dev/null +++ b/tests/scripts/task_config_build_minimal.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -euxo pipefail + +BUILD_DIR=$1 +mkdir -p "$BUILD_DIR" +cd "$BUILD_DIR" +cp ../cmake/config.cmake . + +echo set\(USE_SORT ON\) >> config.cmake +echo set\(USE_LLVM llvm-config\) >> config.cmake +echo set\(USE_RELAY_DEBUG ON\) >> config.cmake +echo set\(CMAKE_BUILD_TYPE=Debug\) >> config.cmake +echo set\(CMAKE_CXX_FLAGS \"-Werror -Wp,-D_GLIBCXX_ASSERTIONS\"\) >> config.cmake +echo set\(HIDE_PRIVATE_SYMBOLS ON\) >> config.cmake +echo set\(USE_LIBBACKTRACE ON\) >> config.cmake +echo set\(USE_CCACHE OFF\) >> config.cmake +echo set\(SUMMARIZE ON\) >> config.cmake diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index 8ae2e9b1109f..27899d06d703 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -45,20 +45,22 @@ python3 tests/scripts/task_build.py \ --cmake-target cpptest \ --build-dir "${BUILD_DIR}" -# crttest requires USE_MICRO to be enabled, which is currently the case -# with all CI configs -pushd "${BUILD_DIR}" -ninja crttest -popd - +# crttest requries USE_MICRO to be enabled. +if grep -Fq "USE_MICRO ON" ${BUILD_DIR}/TVMBuildOptions.txt; then + pushd "${BUILD_DIR}" + ninja crttest + popd +fi pushd "${BUILD_DIR}" ctest --gtest_death_test_style=threadsafe popd -# Test MISRA-C runtime -pushd apps/bundle_deploy -rm -rf build -make test_dynamic test_static -popd +# Test MISRA-C runtime. It requires USE_MICRO to be enabled. +if grep -Fq "USE_MICRO ON" ${BUILD_DIR}/TVMBuildOptions.txt; then + pushd apps/bundle_deploy + rm -rf build + make test_dynamic test_static + popd +fi