Skip to content

Commit 7422e3e

Browse files
committed
tooling: Do not build vtd plugin by default
This also allows us to run smoketests in the Docker container, since we no longer require VTD to be available to run the smoketests.
1 parent a380a86 commit 7422e3e

11 files changed

+1815
-292
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ doxygen:
6868
doxygen Doxyfile
6969

7070
smoketest:
71+
# Call this target with WITH_VTD=1 to include VTD binding tests.
7172
$(call print_header, "Running smoke tests...")
7273
@${CLOE_LAUNCH} clean -P conanfile.py
7374
@\time -f "\nTotal smoketest time (real) = %e sec" bats tests

Makefile.all

+5-5
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ CONAN_OPTIONS :=
8181
WITH_ENGINE := 1
8282

8383
## WITH_VTD
84-
## Usage: make WITH_VTD=0 <targets>
85-
## Default: 1
84+
## Usage: make WITH_VTD=1 <targets>
85+
## Default: 0
8686
##
87-
WITH_VTD := 1
87+
WITH_VTD := 0
8888

8989
## BUILD_TESTS
9090
## Usage: make BUILD_TESTS=0 package
@@ -139,9 +139,9 @@ ALL_PKGS := $(filter-out engine, ${ALL_PKGS})
139139
CONAN_OPTIONS += -o cloe:with_engine=False
140140
endif
141141

142-
ifeq (${WITH_VTD},0)
142+
ifeq (${WITH_VTD},1)
143143
ALL_PKGS := $(filter-out plugins/vtd, ${ALL_PKGS})
144-
CONAN_OPTIONS += -o cloe:with_vtd=False
144+
CONAN_OPTIONS += -o cloe:with_vtd=True
145145
endif
146146

147147
ifeq (${BUILD_TESTS},0)

Makefile.setup

+20-16
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,39 @@ APT_ARGS := --no-install-recommends -y
1616
PACMAN := $(shell command -v pacman 2>/dev/null)
1717
PACMAN_ARGS := --noconfirm --needed
1818

19-
PIPX := $(shell command -v pipx 2>/dev/null)
20-
PIPX_INSTALL_ARGS :=
21-
2219
PIP := $(or \
23-
$(shell command -v pipx 2>/dev/null), \
2420
$(shell command -v pip3 2>/dev/null), \
2521
$(shell command -v pip 2>/dev/null) \
2622
)
27-
ifndef PIPX
23+
ifeq (${VIRTUAL_ENV}, )
2824
PIP_INSTALL_ARGS := --user --upgrade
2925
else
30-
PIP_INSTALL_ARGS := ${PIPX_INSTALL_ARGS}
26+
PIP_INSTALL_ARGS := --upgrade
27+
endif
28+
29+
PIPX := $(shell command -v pipx 2>/dev/null)
30+
PIPX_INSTALL_ARGS :=
31+
ifndef PIPX
32+
PIPX := ${PIP}
33+
PIPX_INSTALL_ARGS := ${PIP_INSTALL_ARGS}
3134
endif
3235

3336
.PHONY: help
3437
.DEFAULT: help
3538
.SILENT: help
3639
help::
3740
echo "Available setup targets:"
38-
echo " setup to perform Git repository setup"
39-
echo " install-system-deps to install build (and development) system requirements"
40-
echo " install-python-deps to install build (and development) Python requirements"
41+
echo " setup to perform Git repository setup"
42+
echo " install-system-deps to install build (and development) system requirements"
43+
echo " install-python-deps to install Python runtime requirements with ${PIP}"
44+
echo " install-python-tools to install Python development tools with ${PIPX}"
4145
echo
4246

4347
.PHONY: setup
4448
setup:
4549
git config --local core.hooksPath .git-hooks/
4650

47-
.PHONY: install-system-deps install-ubuntu-deps install-archlinux-deps install-python-deps
51+
.PHONY: install-system-deps install-ubuntu-deps install-archlinux-deps install-python-deps install-python-tools
4852
install-system-deps::
4953

5054
# Ubuntu ----------------------------------------------------------------------
@@ -112,19 +116,20 @@ endif
112116

113117
# Python ----------------------------------------------------------------------
114118
ifdef PIP
115-
install-deps:: install-python-deps
119+
install-deps:: install-python-deps install-python-tools
116120
endif
117121

118122
install-python-deps::
119123
command -v ${PIP} >/dev/null 2>&1
120124
${PIP} install ${PIP_INSTALL_ARGS} \
125+
click \
121126
conan \
122127
libtmux \
128+
toml \
123129
;
124130

125-
ifndef WITHOUT_DEV_DEPS
126-
install-python-deps::
127-
command -v ${PIP} >/dev/null 2>&1
131+
install-python-tools::
132+
command -v ${PIPX} >/dev/null 2>&1
128133
for pkg in \
129134
black \
130135
mypy \
@@ -134,6 +139,5 @@ install-python-deps::
134139
yq \
135140
; \
136141
do \
137-
${PIP} install ${PIP_INSTALL_ARGS} $${pkg}; \
142+
${PIPX} install ${PIPX_INSTALL_ARGS} $${pkg}; \
138143
done
139-
endif

conanfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Cloe(ConanFile):
1818
default_options = {
1919
"test": True,
2020
"pedantic": True,
21-
"with_vtd": True,
21+
"with_vtd": False,
2222
"with_engine": True,
2323
}
2424
generators = "cmake"

dist/docker/Dockerfile.archlinux

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN pacman -Syu --noconfirm --needed make && \
1818

1919
RUN pip3 install --upgrade pip && \
2020
make -f /cloe/Makefile.setup \
21-
WITHOUT_DEV_DEPS=yes PIP_INSTALL_ARGS="" \
21+
PIP_INSTALL_ARGS="" \
2222
install-python-deps
2323

2424
# Install and Setup Conan
@@ -33,8 +33,10 @@ RUN conan profile new --detect default && \
3333
# Build and Install Cloe
3434
WORKDIR /cloe
3535
COPY . /cloe
36-
RUN make export-vtd export && \
36+
RUN make export-vendor export && \
3737
make WITH_VTD=0 package-all && \
38+
export LC_ALL=C.UTF-8 LANG=C.UTF-8 && \
39+
make WITH_VTD=0 smoketest && \
3840
make WITH_VTD=0 INSTALL_DIR="/deploy" deploy && \
3941
conan remove \* -b -f
4042

dist/docker/Dockerfile.ubuntu

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN apt-get update && \
2626

2727
RUN pip3 install --upgrade pip && \
2828
make -f /cloe/Makefile.setup \
29-
WITHOUT_DEV_DEPS=yes PIP_INSTALL_ARGS="" \
29+
PIP_INSTALL_ARGS="" \
3030
install-python-deps
3131

3232
# Install and Setup Conan
@@ -58,6 +58,9 @@ RUN \
5858
# You can specify more than one package here, see the Makefile for more
5959
# information on the WITH_*, PACKAGES, NOBUILD_PKGS, and BUILD_PKGS variables.
6060
make WITH_VTD=0 package-all && \
61+
# Run smoketests.
62+
export LC_ALL=C.UTF-8 LANG=C.UTF-8 && \
63+
make WITH_VTD=0 smoketest && \
6164
# Deploy all the Cloe packages to INSTALL_DIR, which is /usr/local by
6265
# default. This will also populate BUILD_DIR, so that should be removed
6366
# afterwards to prevent this image from getting too big.

tests/setup_bats.bash

+14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ cloe_engine() {
3737
for var in ${CLOE_OVERRIDE_ENV[@]}; do
3838
cloe_launch_args+=(--override-env=${var})
3939
done
40+
if [[ "${WITH_VTD}" -eq "1" ]]; then
41+
cloe_launch_args+=(-o)
42+
cloe_launch_args+=("with_vtd=True")
43+
fi
44+
for var in ${CLOE_LAUNCH_ARGS[@]}; do
45+
cloe_launch_args+=(${var})
46+
done
4047

4148
local user_args=()
4249
while [[ $# -ne 0 ]]; do
@@ -75,6 +82,13 @@ cloe_shell() {
7582
for var in ${CLOE_OVERRIDE_ENV[@]}; do
7683
cloe_launch_args+=(--override-env=${var})
7784
done
85+
if [[ "${WITH_VTD}" -eq "1" ]]; then
86+
cloe_launch_args+=(-o)
87+
cloe_launch_args+=("with_vtd=True")
88+
fi
89+
for var in ${CLOE_LAUNCH_ARGS[@]}; do
90+
cloe_launch_args+=(${var})
91+
done
7892

7993
local user_args=("$@")
8094

tests/test_engine.bats

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,21 @@
22

33
load setup_bats
44

5+
test_vtd_plugin_exists() {
6+
# VTD_ROOT is only available in the shell.
7+
cloe_shell -c 'test -d "${VTD_ROOT}"'
8+
}
9+
510
@test "Expect schema equality : test_engine_json_schema.json" {
611
if ! type diff &>/dev/null; then
712
skip "required program diff not present"
813
fi
914

10-
diff <(cloe_engine usage -j 2>/dev/null) test_engine_json_schema.json
15+
if test_vtd_plugin_exists; then
16+
diff <(cloe_engine usage -j 2>/dev/null) test_engine_json_schema_with_vtd.json
17+
else
18+
diff <(cloe_engine usage -j 2>/dev/null) test_engine_json_schema.json
19+
fi
1120
}
1221

1322
@test "Expect check success : test_engine_smoketest.json" {

0 commit comments

Comments
 (0)