about summary refs log tree commit diff
path: root/library/stdarch/crates/intrinsic-test/src/main.rs
blob: 538f317a2978b5754f58fb866a399771ae4fb129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#[macro_use]
extern crate log;

mod arm;
mod common;

use arm::ArmArchitectureTest;
use common::SupportedArchitectureTest;
use common::cli::{Cli, ProcessedCli};

fn main() {
    pretty_env_logger::init();
    let args: Cli = clap::Parser::parse();
    let processed_cli_options = ProcessedCli::new(args);

    let test_environment_result: Option<Box<dyn SupportedArchitectureTest>> =
        match processed_cli_options.target.as_str() {
            "aarch64-unknown-linux-gnu"
            | "armv7-unknown-linux-gnueabihf"
            | "aarch64_be-unknown-linux-gnu" => {
                Some(ArmArchitectureTest::create(processed_cli_options))
            }

            _ => None,
        };

    if test_environment_result.is_none() {
        std::process::exit(0);
    }

    let test_environment = test_environment_result.unwrap();

    info!("building C binaries");
    if !test_environment.build_c_file() {
        std::process::exit(2);
    }
    info!("building Rust binaries");
    if !test_environment.build_rust_file() {
        std::process::exit(3);
    }
    info!("comaparing outputs");
    if !test_environment.compare_outputs() {
        std::process::exit(1);
    }
}