• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

google / alioth / 17385686062

01 Sep 2025 07:20PM UTC coverage: 18.016% (-0.1%) from 18.149%
17385686062

Pull #281

github

web-flow
Merge f6f978f6a into 6ec9a6d6b
Pull Request #281: Port to Apple Hypervisor framework

0 of 152 new or added lines in 11 files covered. (0.0%)

1323 existing lines in 30 files now uncovered.

1362 of 7560 relevant lines covered (18.02%)

18.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/alioth-cli/src/main.rs
1
// Copyright 2024 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
mod boot;
16
mod objects;
17
#[cfg(target_os = "linux")]
18
mod vu;
19

20
use std::path::PathBuf;
21

22
use clap::{Parser, Subcommand};
23
use flexi_logger::{FileSpec, Logger};
24

25
#[derive(Subcommand, Debug)]
26
enum Command {
27
    /// Create and boot a virtual machine.
28
    Boot(Box<boot::BootArgs>),
29
    #[cfg(target_os = "linux")]
30
    /// Start a vhost-user backend device.
31
    Vu(Box<vu::VuArgs>),
32
}
33

34
#[derive(Parser, Debug)]
35
#[command(author, version, about)]
36
struct Cli {
37
    #[arg(short, long, value_name = "SPEC")]
38
    /// Loglevel specification, see
39
    /// https://docs.rs/flexi_logger/latest/flexi_logger/struct.LogSpecification.html.
40
    /// If not set, environment variable $RUST_LOG is used.
41
    pub log_spec: Option<String>,
42

43
    /// Log to file instead of STDERR.
44
    #[arg(long)]
45
    pub log_to_file: bool,
46

47
    /// Path to a directory where the log file is stored.
48
    #[arg(long, value_name = "PATH")]
49
    pub log_dir: Option<PathBuf>,
50

51
    #[command(subcommand)]
52
    pub cmd: Command,
53
}
54

55
fn main() -> Result<(), Box<dyn std::error::Error>> {
×
56
    let cli = Cli::parse();
×
57
    let logger = if let Some(ref spec) = cli.log_spec {
×
58
        Logger::try_with_str(spec)
×
59
    } else {
60
        Logger::try_with_env_or_str("warn")
×
61
    }?;
62
    let logger = if cli.log_to_file {
×
63
        logger.log_to_file(
×
64
            FileSpec::default()
×
65
                .suppress_timestamp()
×
66
                .o_directory(cli.log_dir),
×
67
        )
68
    } else {
69
        logger
×
70
    };
71
    let _handle = logger.start()?;
×
72
    log::debug!(
×
73
        "{} {} started...",
74
        env!("CARGO_PKG_NAME"),
75
        env!("CARGO_PKG_VERSION"),
76
    );
77

78
    match cli.cmd {
×
79
        Command::Boot(args) => boot::boot(*args)?,
×
80
        #[cfg(target_os = "linux")]
UNCOV
81
        Command::Vu(args) => vu::start(*args)?,
82
    }
83
    Ok(())
×
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc