Skip to content

Commit

Permalink
Merge branch 'main' into prepare-1-5
Browse files Browse the repository at this point in the history
  • Loading branch information
pb8o authored Oct 9, 2023
2 parents a62a783 + c723745 commit 7c289ee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/firecracker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ fn main_exec() -> Result<(), MainError> {
.arg(
Argument::new("id")
.takes_value(true)
.default_value(vmm::logger::DEFAULT_INSTANCE_ID)
.help("MicroVM unique identifier."),
)
.arg(
Expand Down Expand Up @@ -262,8 +263,6 @@ fn main_exec() -> Result<(), MainError> {
return Ok(());
}

info!("Running Firecracker v{FIRECRACKER_VERSION}");

register_signal_handlers().map_err(MainError::RegisterSignalHandlers)?;

#[cfg(target_arch = "aarch64")]
Expand Down Expand Up @@ -298,11 +297,9 @@ fn main_exec() -> Result<(), MainError> {
app_name: "Firecracker".to_string(),
};

let id = arguments
.single_value("id")
.map(|s| s.as_str())
.unwrap_or(vmm::logger::DEFAULT_INSTANCE_ID);
let id = arguments.single_value("id").map(|s| s.as_str()).unwrap();
vmm::logger::INSTANCE_ID.set(String::from(id)).unwrap();
info!("Running Firecracker v{FIRECRACKER_VERSION}");

// Apply the logger configuration.
let log_path = arguments.single_value("log-path").map(PathBuf::from);
Expand Down
16 changes: 16 additions & 0 deletions tests/integration_tests/functional/test_cmd_line_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""Tests that ensure the correctness of the command line parameters."""

import platform
import subprocess
from pathlib import Path

import pytest
Expand Down Expand Up @@ -130,3 +131,18 @@ def test_cli_metrics_if_resume_no_metrics(uvm_plain, microvm_factory):
# Then: the old metrics configuration does not exist
metrics2 = Path(uvm2.jailer.chroot_path()) / metrics_path.name
assert not metrics2.exists()


def test_cli_no_params():
"""
Test running firecracker with no parameters should work
"""

fc_binary, _ = get_firecracker_binaries()
process = subprocess.Popen(fc_binary)
try:
process.communicate(timeout=3)
assert process.returncode is None
except subprocess.TimeoutExpired:
# The good case
process.kill()

0 comments on commit 7c289ee

Please sign in to comment.