This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1254 from GabyCT/topic/final1.4
backport stable 1.4
- Loading branch information
Showing
19 changed files
with
439 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2019 IBM Limited | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -e | ||
|
||
CURRENT_QEMU_VERSION=$(get_version "assets.hypervisor.qemu.version") | ||
PACKAGED_QEMU="qemu-system-ppc" | ||
BUILT_QEMU="qemu-system-ppc64" | ||
|
||
get_packaged_qemu_version() { | ||
if [ "$ID" == "ubuntu" ]; then | ||
#output redirected to /dev/null | ||
sudo apt-get update > /dev/null | ||
qemu_version=$(apt-cache madison $PACKAGED_QEMU \ | ||
| awk '{print $3}' | cut -d':' -f2 | cut -d'+' -f1 | head -n 1 ) | ||
elif [ "$ID" == "fedora" ]; then | ||
qemu_version=$(sudo dnf --showduplicate list ${PACKAGED_QEMU}.${QEMU_ARCH} \ | ||
| awk '/'$PACKAGED_QEMU'/ {print $2}' | cut -d':' -f2 | cut -d'-' -f1 | head -n 1) | ||
qemu_version=${qemu_version%.*} | ||
elif [ "$ID" == "centos" ]; then | ||
qemu_version=$(sudo dnf --showduplicate list ${PACKAGED_QEMU}.${QEMU_ARCH} \ | ||
| awk '/'$PACKAGED_QEMU'/ {print $2}' | cut -d':' -f2 | cut -d'-' -f1 | head -n 1) | ||
fi | ||
|
||
if [ -z "$qemu_version" ]; then | ||
die "unknown qemu version" | ||
else | ||
echo "${qemu_version}" | ||
fi | ||
} | ||
|
||
install_packaged_qemu() { | ||
if [ "$ID" == "ubuntu" ]; then | ||
sudo apt install -y "$PACKAGED_QEMU" | ||
elif [ "$ID" == "fedora" ]; then | ||
sudo dnf install -y "$PACKAGED_QEMU" | ||
elif [ "$ID" == "centos" ]; then | ||
sudo yum install -y "$PACKAGED_QEMU" | ||
else | ||
die "Unrecognized distro" | ||
fi | ||
} | ||
|
||
build_and_install_qemu() { | ||
QEMU_REPO=$(get_version "assets.hypervisor.qemu.url") | ||
# Remove 'https://' from the repo url to be able to clone the repo using 'go get' | ||
QEMU_REPO=${QEMU_REPO/https:\/\//} | ||
PACKAGING_REPO="github.com/kata-containers/packaging" | ||
QEMU_CONFIG_SCRIPT="${GOPATH}/src/${PACKAGING_REPO}/scripts/configure-hypervisor.sh" | ||
|
||
go get -d "${QEMU_REPO}" || true | ||
go get -d "$PACKAGING_REPO" || true | ||
|
||
pushd "${GOPATH}/src/${QEMU_REPO}" | ||
git fetch | ||
git checkout "$CURRENT_QEMU_VERSION" | ||
[ -d "capstone" ] || git clone https://github.com/qemu/capstone.git capstone | ||
[ -d "ui/keycodemapdb" ] || git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb | ||
|
||
echo "Build Qemu" | ||
"${QEMU_CONFIG_SCRIPT}" "qemu" | xargs ./configure | ||
make -j $(nproc) | ||
|
||
echo "Install Qemu" | ||
sudo -E make install | ||
|
||
sudo ln -sf $(command -v ${BUILT_QEMU}) "/usr/bin/qemu-system-${QEMU_ARCH}" | ||
popd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2019 Intel Corporation. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Define any code owners for this repository. | ||
# The code owners lists are used to help automatically enforce | ||
# reviews and acks of the right groups on the right PRs. | ||
|
||
# Order in this file is important. Only the last match will be | ||
# used. See https://help.github.com/articles/about-code-owners/ | ||
|
||
*.md @kata-containers/documentation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) 2018 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package functional | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
. "github.com/kata-containers/tests" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/ginkgo/extensions/table" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var ( | ||
stateWorkload = []string{"true"} | ||
) | ||
|
||
const ( | ||
stateStopped = "stopped" | ||
stateWaitTime = 5 | ||
) | ||
|
||
var _ = Describe("state", func() { | ||
var ( | ||
container *Container | ||
err error | ||
) | ||
|
||
BeforeEach(func() { | ||
container, err = NewContainer(stateWorkload, true) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(container).NotTo(BeNil()) | ||
}) | ||
|
||
AfterEach(func() { | ||
Expect(container.Teardown()).To(Succeed()) | ||
}) | ||
|
||
DescribeTable("container", | ||
func(status string, waitTime int) { | ||
_, stderr, exitCode := container.Run() | ||
Expect(exitCode).To(Equal(0)) | ||
Expect(stderr).To(BeEmpty()) | ||
|
||
time.Sleep(time.Second * time.Duration(waitTime)) | ||
|
||
stdout, stderr, exitCode := container.State() | ||
Expect(exitCode).To(Equal(0)) | ||
Expect(stderr).To(BeEmpty()) | ||
subString := fmt.Sprintf("\"status\": \"%s\"", status) | ||
Expect(stdout).To(ContainSubstring(subString)) | ||
}, | ||
Entry(fmt.Sprintf("with workload %s, timeWait %d", stateWorkload, stateWaitTime), stateStopped, stateWaitTime), | ||
) | ||
}) |
Oops, something went wrong.