Skip to content

Commit

Permalink
Merge branch 'main' into clippy_cast_lossless
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Woollett-Light authored Oct 31, 2022
2 parents 78f6458 + 9ba0862 commit 095cd00
Show file tree
Hide file tree
Showing 14 changed files with 573 additions and 120 deletions.
5 changes: 4 additions & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ Andrei Sandu <sandreim@amazon.com> <54316454+sandreim@users.noreply.github.com>
Diana Popa <dpopa@amazon.com> <dpopa@38f9d3563971.ant.amazon.com>
Alexandru Cihodaru <cihodar@amazon.com>
Liviu Berciu <lberciu@amazon.com>
Jonathan Woollett-Light <jonathanwoollettlight@gmail.com> <jonthanwoollettlight@gmail.com>
Jonathan Woollett-Light <jcawl@amazon.co.uk> <jonathanwoollettlight@gmail.com>
Jonathan Woollett-Light <jcawl@amazon.co.uk> <jonthanwoollettlight@gmail.com>
karthik nedunchezhiyan <karthik.n@zohocorp.com>
Babis Chalios <bchalios@amazon.es> <babis.chalios@gmail.com>
Pablo Barbáchano <pablob@amazon.com>
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
and mitigations, the Guest vCPU will apear to look like a Skylake CPU,
making it safe to snapshot uVMs running on a newer host CPU (Cascade Lake)
and restore on a host that has a Skylake CPU.

- Added a new CLI option `--metrics-path PATH`. It accepts a file parameter
where metrics will be sent to.
- A MAC address is generated if one is not explicitly specified while adding
Expand Down
2 changes: 1 addition & 1 deletion docs/kernel-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ registers incompatibility.
<tr>
<th>Load snapshot on host 4.15</th>
<td style="background-color:mediumseagreen">successful</td>
<td style="background-color:mediumseagreen">successful</td>
<td style="background-color:mediumseagreen">unsuccessful due to mismatch in MSRs</td>
</tr>
<tr>
<th>Load snapshot on host 5.10</th>
Expand Down
2 changes: 1 addition & 1 deletion src/api_server/swagger/firecracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1227,4 +1227,4 @@ definitions:
description: Path to UNIX domain socket, used to proxy vsock connections.
vsock_id:
type: string
description: This parameter has been deprecated since v1.1.0.
description: This parameter has been deprecated since v1.0.0.
4 changes: 2 additions & 2 deletions tests/integration_tests/functional/test_snapshot_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ def test_5_inc_snapshots(
# Testing matrix:
# - Guest kernel: All supported ones
# - Rootfs: Ubuntu 18.04
# - Microvm: 2vCPU with 4096 MB RAM
# - Microvm: 2vCPU with 512MB RAM
# TODO: Multiple microvm sizes must be tested in the async pipeline.
microvm_artifacts = ArtifactSet(artifacts.microvms(keyword="2vcpu_4096mb"))
microvm_artifacts = ArtifactSet(artifacts.microvms(keyword="2vcpu_512mb"))
kernel_artifacts = ArtifactSet(artifacts.kernels())
disk_artifacts = ArtifactSet(artifacts.disks(keyword="ubuntu"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
BASELINES = {
"Intel": {
"serialize": {
"no-crc": {"target": 0.150, "delta": 0.036}, # milliseconds # milliseconds
"no-crc": {"target": 0.205, "delta": 0.050}, # milliseconds # milliseconds
"crc": {"target": 0.244, "delta": 0.44}, # milliseconds # milliseconds
},
"deserialize": {
"no-crc": {"target": 0.056, "delta": 0.02}, # milliseconds # milliseconds
"crc": {"target": 0.046, "delta": 0.035}, # milliseconds # milliseconds
"crc": {"target": 0.075, "delta": 0.030}, # milliseconds # milliseconds
},
},
"AMD": {
Expand Down
5 changes: 5 additions & 0 deletions tests/integration_tests/style/test_licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""Tests checking against the existence of licenses in each file."""

import datetime

from framework import utils

AMAZON_COPYRIGHT_YEARS = range(2018, datetime.datetime.now().year + 1)
Expand Down Expand Up @@ -105,3 +106,7 @@ def test_for_valid_licenses():
if _validate_license(file) is False:
error_msg.append("{}".format(str(file)))
assert not error_msg, "Files {} have invalid licenses".format((error_msg))


if __name__ == "__main__":
test_for_valid_licenses()
124 changes: 13 additions & 111 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ DEVCTR_IMAGE_TAG="v44"
# (Yet another step on our way to reproducible builds.)
DEVCTR_IMAGE="${DEVCTR_IMAGE_NO_TAG}:${DEVCTR_IMAGE_TAG}"

# Naming things is hard
MY_NAME="Firecracker $(basename "$0")"

# Full path to the Firecracker tools dir on the host.
FC_TOOLS_DIR=$(cd "$(dirname "$0")" && pwd)
source "$FC_TOOLS_DIR/functions"

# Full path to the Firecracker sources dir on the host.
FC_ROOT_DIR=$(cd "${FC_TOOLS_DIR}/.." && pwd)
Expand Down Expand Up @@ -159,57 +157,6 @@ DEFAULT_TEST_SESSION_ROOT_PATH=/srv
DEFAULT_RAMDISK_PATH=/mnt/devtool-ramdisk


# Send a decorated message to stdout, followed by a new line
#
say() {
[ -t 1 ] && [ -n "$TERM" ] \
&& echo "$(tput setaf 2)[$MY_NAME]$(tput sgr0) $*" \
|| echo "[$MY_NAME] $*"
}

# Send a decorated message to stdout, without a trailing new line
#
say_noln() {
[ -t 1 ] && [ -n "$TERM" ] \
&& echo -n "$(tput setaf 2)[$MY_NAME]$(tput sgr0) $*" \
|| echo "[$MY_NAME] $*"
}

# Send a text message to stderr
#
say_err() {
[ -t 2 ] && [ -n "$TERM" ] \
&& echo -e "$(tput setaf 1)[$MY_NAME] $*$(tput sgr0)" 1>&2 \
|| echo -e "[$MY_NAME] $*" 1>&2
}

# Send a warning-highlighted text to stdout
say_warn() {
[ -t 1 ] && [ -n "$TERM" ] \
&& echo "$(tput setaf 3)[$MY_NAME] $*$(tput sgr0)" \
|| echo "[$MY_NAME] $*"
}

# Exit with an error message and (optional) code
# Usage: die [-c <error code>] <error message>
#
die() {
code=1
[[ "$1" = "-c" ]] && {
code="$2"
shift 2
}
say_err "$@"
exit $code
}

# Exit with an error message if the last exit code is not 0
#
ok_or_die() {
code=$?
[[ $code -eq 0 ]] || die -c $code "$@"
}

# Check if Docker is available and exit if it's not.
# Upon returning from this call, the caller can be certain Docker is available.
#
Expand Down Expand Up @@ -278,14 +225,6 @@ ensure_devctr() {
}
}

# Check if /dev/kvm exists. Exit if it doesn't.
# Upon returning from this call, the caller can be certain /dev/kvm is
# available.
#
ensure_kvm() {
[[ -c /dev/kvm ]] || die "/dev/kvm not found. Aborting."
}

# Make sure the build/ dirs are available. Exit if we can't create them.
# Upon returning from this call, the caller can be certain the build/ dirs exist.
#
Expand Down Expand Up @@ -380,50 +319,6 @@ cmd_build_devctr() {
copy_poetry_lockfile
}

# Prompt the user for confirmation before proceeding.
# Args:
# $1 prompt text.
# Default: Continue? (y/n)
# $2 confirmation input.
# Default: y
# Return:
# exit code 0 for successful confirmation
# exit code != 0 if the user declined
#
get_user_confirmation() {

# Pass if running unattended
[[ "$OPT_UNATTENDED" = true ]] && return 0

# Fail if STDIN is not a terminal (there's no user to confirm anything)
[[ -t 0 ]] || return 1

# Otherwise, ask the user
#
msg=$([ -n "$1" ] && echo -n "$1" || echo -n "Continue? (y/n) ")
yes=$([ -n "$2" ] && echo -n "$2" || echo -n "y")
say_noln "$msg"
read c && [ "$c" = "$yes" ] && return 0
return 1
}

# Validate the user supplied version number.
# It must start with 3 groups of integers separated by dot and
# must not contain `wip` or `dirty`.
validate_version() {
declare version_regex="^([0-9]+\.){2}[0-9]+"
version="$1"

if [ -z "$version" ]; then
die "Version cannot be empty."
elif [[ ! "$version" =~ $version_regex ]]; then
die "Invalid version number: $version. Version should start with \$Major.\$Minor.\$Build, see
https://github.com/firecracker-microvm/firecracker/blob/main/docs/RELEASE_POLICY.md for more information."
elif [[ "$version" == *"wip"* ]] || [[ "$version" == *"dirty"* ]]; then
die "Invalid version number: $version. Version should not contain \`wip\` or \`dirty\`."
fi
}

# Validate that the repo targetted for a release exists.
#
validate_repo() {
Expand Down Expand Up @@ -972,6 +867,16 @@ cmd_build() {
return $ret
}

function cmd_make_release {
cmd_test || die "Tests failed!"

run_devctr \
--user "$(id -u):$(id -g)" \
--workdir "$CTR_FC_ROOT_DIR" \
-- \
./tools/release.sh --libc musl --profile release --make-release
}

cmd_distclean() {
# List of folders to remove.
dirs=("build" "test_results")
Expand Down Expand Up @@ -1180,11 +1085,6 @@ copy_release_artifact() {
fi
}

get_swagger_version() {
local file="$1"
grep -oP 'version: \K.*' "$file"
}

mount_ramdisk() {
local ramdisk_size="$1"
umount_ramdisk
Expand Down Expand Up @@ -1278,6 +1178,8 @@ cmd_test() {

ret=$?

say "$(date -u +'%F %H:%M:%S %Z')"
say "Finished test run ..."

if [[ $ramdisk = true ]]; then
umount_ramdisk
Expand Down
Loading

0 comments on commit 095cd00

Please sign in to comment.