Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions tests/scripts/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,14 @@ def fn(
if precheck is not None:
precheck()

build_dir = get_build_dir(name)

if skip_build:
scripts = []
else:
scripts = [
f"./tests/scripts/task_config_build_{name}.sh {get_build_dir(name)}",
f"./tests/scripts/task_build.py --build-dir {get_build_dir(name)}",
f"./tests/scripts/task_config_build_{name}.sh {build_dir}",
f"./tests/scripts/task_build.py --build-dir {build_dir}",
]

if post_build is not None:
Expand All @@ -394,7 +396,7 @@ def fn(
# Add named test suites
for option_name, (_, extra_scripts) in options.items():
if kwargs.get(option_name, False):
scripts += extra_scripts
scripts.extend(script.format(build_dir=build_dir) for script in extra_scripts)

docker(
name=gen_name(f"ci-{name}"),
Expand Down Expand Up @@ -553,7 +555,7 @@ def add_subparser(
return subparser


CPP_UNITTEST = ("run c++ unitests", ["./tests/scripts/task_cpp_unittest.sh"])
CPP_UNITTEST = ("run c++ unitests", ["./tests/scripts/task_cpp_unittest.sh {build_dir}"])

generated = [
generate_command(
Expand Down Expand Up @@ -610,7 +612,10 @@ def add_subparser(
generate_command(
name="wasm",
help="Run WASM build and test(s)",
options={"test": ("run WASM tests", ["./tests/scripts/task_web_wasm.sh"])},
options={
"cpp": CPP_UNITTEST,
"test": ("run WASM tests", ["./tests/scripts/task_web_wasm.sh"]),
},
),
generate_command(
name="qemu",
Expand Down
17 changes: 14 additions & 3 deletions tests/scripts/task_cpp_unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@

set -euxo pipefail

if [ $# -gt 0 ]; then
BUILD_DIR="$1"
elif [ -n "${TVM_BUILD_PATH:-}" ]; then
# TVM_BUILD_PATH may contain multiple space-separated paths. If
# so, use the first one.
BUILD_DIR=$(IFS=" "; set -- $TVM_BUILD_PATH; echo $1)
else
BUILD_DIR=build
fi

# Python is required by apps/bundle_deploy
source tests/scripts/setup-pytest-env.sh

Expand All @@ -32,16 +42,17 @@ export OMP_NUM_THREADS=1
# Build cpptest suite
python3 tests/scripts/task_build.py \
--sccache-bucket tvm-sccache-prod \
--cmake-target cpptest
--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
pushd "${BUILD_DIR}"
ninja crttest
popd


pushd build
pushd "${BUILD_DIR}"
ctest --gtest_death_test_style=threadsafe
popd

Expand Down