Ensure containerd is used from installed location.

Currently, if containerd is installed locally via tools/installers/containerd,
then it will not necessarily be used if containerd is installed in the system
path. This means that the existing containerd tests are all likely broken.

Also, use libbtrfs-dev instead of btrfs-tools, which is not actually required.

PiperOrigin-RevId: 344879109
This commit is contained in:
Adin Scannell 2020-11-30 13:38:31 -08:00 committed by gVisor bot
parent 4fd71a7b20
commit 3a60bc47a0
2 changed files with 23 additions and 4 deletions

View File

@ -54,14 +54,20 @@ func ResolvePath(executable string) string {
}
}
// Favor /usr/local/bin, if it exists.
localBin := fmt.Sprintf("/usr/local/bin/%s", executable)
if _, err := os.Stat(localBin); err == nil {
return localBin
}
// Try to find via the path.
guess, err := exec.LookPath(executable)
guess, _ := exec.LookPath(executable)
if err == nil {
return guess
}
// Return a default path.
return fmt.Sprintf("/usr/local/bin/%s", executable)
// Return a bare path; this generates a suitable error.
return executable
}
// NewCrictl returns a Crictl configured with a timeout and an endpoint over

View File

@ -43,10 +43,23 @@ install_helper() {
make install)
}
# Figure out were btrfs headers are.
#
# Ubuntu 16.04 has only btrfs-tools, while 18.04 has a transitional package,
# and later versions no longer have the transitional package.
source /etc/os-release
declare BTRFS_DEV
if [[ "${ID}" == "ubuntu" ]] && [[ "${VERSION_ID%.*}" -le "18" ]]; then
BTRFS_DEV="btrfs-tools"
else
BTRFS_DEV="btrfs-dev"
fi
readonly BTRFS_DEV
# Install dependencies for the crictl tests.
while true; do
if (apt-get update && apt-get install -y \
btrfs-tools \
"${BTRFS_DEV}" \
libseccomp-dev); then
break
fi