<commit_before>//! Tests for the cache file for the rustc version info.

use cargo_test_support::paths::CargoPathExt;
use cargo_test_support::{basic_manifest, project};
use std::env;

#[cargo_test]
fn rustc_info_cache() {
    // TODO: need to gate this on nightly as soon as -Cbitcode-in-rlib lands in
    // nightly
    if true {
        return;
    }

    let p = project()
        .file("src/main.rs", r#"fn main() { println!("hello"); }"#)
        .build();

    let miss = "[..] rustc info cache miss[..]";
    let hit = "[..]rustc info cache hit[..]";
    let update = "[..]updated rustc info cache[..]";

    p.cargo("build")
        .env("CARGO_LOG", "cargo::util::rustc=debug")
        .with_stderr_contains("[..]failed to read rustc info cache[..]")
        .with_stderr_contains(miss)
        .with_stderr_does_not_contain(hit)
        .with_stderr_contains(update)
        .run();
<commit_msg>Auto merge of #8155 - alexcrichton:reenable-test, r=ehuss<commit_after>//! Tests for the cache file for the rustc version info.

use cargo_test_support::paths::CargoPathExt;
use cargo_test_support::{basic_manifest, project};
use std::env;

#[cargo_test]
fn rustc_info_cache() {
    // Needs `-Cbitcode-in-rlib` to ride to stable before this can be enabled
    // everywhere.
    if !cargo_test_support::is_nightly() {
        return;
    }

    let p = project()
        .file("src/main.rs", r#"fn main() { println!("hello"); }"#)
        .build();

    let miss = "[..] rustc info cache miss[..]";
    let hit = "[..]rustc info cache hit[..]";
    let update = "[..]updated rustc info cache[..]";

    p.cargo("build")
        .env("CARGO_LOG", "cargo::util::rustc=debug")
        .with_stderr_contains("[..]failed to read rustc info cache[..]")
        .with_stderr_contains(miss)
        .with_stderr_does_not_contain(hit)
        .with_stderr_contains(update)
        .run();

{'fraction_non_alphanumeric': 0.16286472148541115, 'fraction_numerical': 0.002122015915119363, 'mean_word_length': 2.880658436213992, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4210815', 'n_tokens_mistral': 655, 'n_tokens_neox': 648, 'n_words': 157}