1
Fork 0

improve bootstrap tests structure

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2023-10-07 23:35:02 +03:00
parent acef1c2c57
commit c68ab9347e
3 changed files with 10 additions and 10 deletions

View file

@ -1,6 +1,6 @@
use super::*; use super::*;
use crate::config::{Config, DryRun, TargetSelection}; use crate::core::config::{Config, DryRun, TargetSelection};
use crate::doc::DocumentationFormat; use crate::core::build_steps::doc::DocumentationFormat;
use std::thread; use std::thread;
fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config { fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
@ -158,7 +158,7 @@ fn alias_and_path_for_library() {
#[test] #[test]
fn test_beta_rev_parsing() { fn test_beta_rev_parsing() {
use crate::extract_beta_rev; use crate::utils::helpers::extract_beta_rev;
// single digit revision // single digit revision
assert_eq!(extract_beta_rev("1.99.9-beta.7 (xxxxxx)"), Some("7".to_string())); assert_eq!(extract_beta_rev("1.99.9-beta.7 (xxxxxx)"), Some("7".to_string()));
@ -174,7 +174,7 @@ fn test_beta_rev_parsing() {
mod defaults { mod defaults {
use super::{configure, first, run_build}; use super::{configure, first, run_build};
use crate::builder::*; use crate::core::builder::*;
use crate::Config; use crate::Config;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
@ -285,7 +285,7 @@ mod defaults {
mod dist { mod dist {
use super::{first, run_build, Config}; use super::{first, run_build, Config};
use crate::builder::*; use crate::core::builder::*;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
fn configure(host: &[&str], target: &[&str]) -> Config { fn configure(host: &[&str], target: &[&str]) -> Config {

View file

@ -1,6 +1,6 @@
use crate::config::TomlConfig; use crate::core::config::TomlConfig;
use super::{Config, Flags}; use super::{Config, Flags};
use clap::CommandFactory; use clap::CommandFactory;
use serde::Deserialize; use serde::Deserialize;
use std::{ use std::{
@ -18,7 +18,7 @@ fn parse(config: &str) -> Config {
#[test] #[test]
fn download_ci_llvm() { fn download_ci_llvm() {
if crate::llvm::is_ci_llvm_modified(&parse("")) { if crate::core::build_steps::llvm::is_ci_llvm_modified(&parse("")) {
eprintln!("Detected LLVM as non-available: running in CI and modified LLVM in this change"); eprintln!("Detected LLVM as non-available: running in CI and modified LLVM in this change");
return; return;
} }
@ -137,7 +137,7 @@ build-config = {}
assert_eq!(config.change_id, Some(1), "setting top-level value"); assert_eq!(config.change_id, Some(1), "setting top-level value");
assert_eq!( assert_eq!(
config.rust_lto, config.rust_lto,
crate::config::RustcLto::Fat, crate::core::config::RustcLto::Fat,
"setting string value without quotes" "setting string value without quotes"
); );
assert_eq!(config.gdb, Some("bar".into()), "setting string value with quotes"); assert_eq!(config.gdb, Some("bar".into()), "setting string value with quotes");
@ -175,7 +175,7 @@ fn profile_user_dist() {
"profile = \"user\"".to_owned() "profile = \"user\"".to_owned()
} else { } else {
assert!(file.ends_with("config.dist.toml")); assert!(file.ends_with("config.dist.toml"));
std::fs::read_to_string(dbg!(file)).unwrap() std::fs::read_to_string(file).unwrap()
}; };
toml::from_str(&contents) toml::from_str(&contents)
.and_then(|table: toml::Value| TomlConfig::deserialize(table)) .and_then(|table: toml::Value| TomlConfig::deserialize(table))