mirror of
https://github.com/containers/podman.git
synced 2025-06-25 20:26:51 +08:00
Merge pull request #2267 from giuseppe/allow-override-oci-runtime
tests: allow to override the OCI runtime
This commit is contained in:
9
Makefile
9
Makefile
@ -25,6 +25,7 @@ ifneq (,$(findstring varlink,$(BUILDTAGS)))
|
|||||||
PODMAN_VARLINK_DEPENDENCIES = cmd/podman/varlink/iopodman.go
|
PODMAN_VARLINK_DEPENDENCIES = cmd/podman/varlink/iopodman.go
|
||||||
endif
|
endif
|
||||||
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
|
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
|
||||||
|
OCI_RUNTIME ?= ""
|
||||||
|
|
||||||
BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions
|
BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions
|
||||||
OCIUMOUNTINSTALLDIR=$(PREFIX)/share/oci-umount/oci-umount.d
|
OCIUMOUNTINSTALLDIR=$(PREFIX)/share/oci-umount/oci-umount.d
|
||||||
@ -148,10 +149,10 @@ dbuild: libpodimage
|
|||||||
${CONTAINER_RUNTIME} run --name=${LIBPOD_INSTANCE} --privileged -v ${PWD}:/go/src/${PROJECT} --rm ${LIBPOD_IMAGE} make all
|
${CONTAINER_RUNTIME} run --name=${LIBPOD_INSTANCE} --privileged -v ${PWD}:/go/src/${PROJECT} --rm ${LIBPOD_IMAGE} make all
|
||||||
|
|
||||||
test: libpodimage
|
test: libpodimage
|
||||||
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make clean all localunit install.catatonit localintegration
|
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e OCI_RUNTIME -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make clean all localunit install.catatonit localintegration
|
||||||
|
|
||||||
integration: libpodimage
|
integration: libpodimage
|
||||||
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make clean all install.catatonit localintegration
|
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e OCI_RUNTIME -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make clean all install.catatonit localintegration
|
||||||
|
|
||||||
integration.fedora:
|
integration.fedora:
|
||||||
DIST=Fedora sh .papr_prepare.sh
|
DIST=Fedora sh .papr_prepare.sh
|
||||||
@ -160,10 +161,10 @@ integration.centos:
|
|||||||
DIST=CentOS sh .papr_prepare.sh
|
DIST=CentOS sh .papr_prepare.sh
|
||||||
|
|
||||||
shell: libpodimage
|
shell: libpodimage
|
||||||
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e CGROUP_MANAGER=cgroupfs -e TESTFLAGS -e TRAVIS -it --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} sh
|
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e CGROUP_MANAGER=cgroupfs -e TESTFLAGS -e OCI_RUNTIME -e TRAVIS -it --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} sh
|
||||||
|
|
||||||
testunit: libpodimage
|
testunit: libpodimage
|
||||||
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make localunit
|
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e CGROUP_MANAGER=cgroupfs -e OCI_RUNTIME -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make localunit
|
||||||
|
|
||||||
localunit: test/goecho/goecho varlink_generate
|
localunit: test/goecho/goecho varlink_generate
|
||||||
$(GO) test -tags "$(BUILDTAGS)" -cover $(PACKAGES)
|
$(GO) test -tags "$(BUILDTAGS)" -cover $(PACKAGES)
|
||||||
|
@ -34,7 +34,7 @@ type PodmanTestIntegration struct {
|
|||||||
ConmonBinary string
|
ConmonBinary string
|
||||||
CrioRoot string
|
CrioRoot string
|
||||||
CNIConfigDir string
|
CNIConfigDir string
|
||||||
RunCBinary string
|
OCIRuntime string
|
||||||
RunRoot string
|
RunRoot string
|
||||||
StorageOptions string
|
StorageOptions string
|
||||||
SignaturePolicyPath string
|
SignaturePolicyPath string
|
||||||
@ -136,12 +136,16 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
|
|||||||
cgroupManager = "cgroupfs"
|
cgroupManager = "cgroupfs"
|
||||||
}
|
}
|
||||||
|
|
||||||
runCBinary, err := exec.LookPath("runc")
|
ociRuntime := os.Getenv("OCI_RUNTIME")
|
||||||
|
if ociRuntime == "" {
|
||||||
|
var err error
|
||||||
|
ociRuntime, err = exec.LookPath("runc")
|
||||||
// If we cannot find the runc binary, setting to something static as we have no way
|
// If we cannot find the runc binary, setting to something static as we have no way
|
||||||
// to return an error. The tests will fail and point out that the runc binary could
|
// to return an error. The tests will fail and point out that the runc binary could
|
||||||
// not be found nicely.
|
// not be found nicely.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
runCBinary = "/usr/bin/runc"
|
ociRuntime = "/usr/bin/runc"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CNIConfigDir := "/etc/cni/net.d"
|
CNIConfigDir := "/etc/cni/net.d"
|
||||||
@ -156,7 +160,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
|
|||||||
ConmonBinary: conmonBinary,
|
ConmonBinary: conmonBinary,
|
||||||
CrioRoot: filepath.Join(tempDir, "crio"),
|
CrioRoot: filepath.Join(tempDir, "crio"),
|
||||||
CNIConfigDir: CNIConfigDir,
|
CNIConfigDir: CNIConfigDir,
|
||||||
RunCBinary: runCBinary,
|
OCIRuntime: ociRuntime,
|
||||||
RunRoot: filepath.Join(tempDir, "crio-run"),
|
RunRoot: filepath.Join(tempDir, "crio-run"),
|
||||||
StorageOptions: storageOptions,
|
StorageOptions: storageOptions,
|
||||||
SignaturePolicyPath: filepath.Join(INTEGRATION_ROOT, "test/policy.json"),
|
SignaturePolicyPath: filepath.Join(INTEGRATION_ROOT, "test/policy.json"),
|
||||||
|
@ -164,7 +164,7 @@ func (p *PodmanTestIntegration) makeOptions(args []string) []string {
|
|||||||
//MakeOptions assembles all the podman main options
|
//MakeOptions assembles all the podman main options
|
||||||
func getVarlinkOptions(p *PodmanTestIntegration, args []string) []string {
|
func getVarlinkOptions(p *PodmanTestIntegration, args []string) []string {
|
||||||
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
|
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
|
||||||
p.CrioRoot, p.RunRoot, p.RunCBinary, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
|
p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
|
||||||
if os.Getenv("HOOK_OPTION") != "" {
|
if os.Getenv("HOOK_OPTION") != "" {
|
||||||
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
|
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
|
|||||||
//MakeOptions assembles all the podman main options
|
//MakeOptions assembles all the podman main options
|
||||||
func (p *PodmanTestIntegration) makeOptions(args []string) []string {
|
func (p *PodmanTestIntegration) makeOptions(args []string) []string {
|
||||||
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
|
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
|
||||||
p.CrioRoot, p.RunRoot, p.RunCBinary, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
|
p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
|
||||||
if os.Getenv("HOOK_OPTION") != "" {
|
if os.Getenv("HOOK_OPTION") != "" {
|
||||||
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
|
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user