<commit_before>// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::env;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::path::{Path, PathBuf};

use common::Config;
use common;
use util;

use extract_gdb_version;

/// Properties which must be known very early, before actually running
/// the test.
pub struct EarlyProps {
    pub ignore: bool,
    pub should_fail: bool,
    pub aux: Vec<String>,
    pub revisions: Vec<String>,
}

impl EarlyProps {
    pub fn from_file(config: &Config, testfile: &Path) -> Self {
        let mut props = EarlyProps {
            ignore: false,
            should_fail: false,
            aux: Vec::new(),
            revisions: vec![],
        };

        iter_header(testfile,
                    None,
                    &mut |ln| {
            props.ignore =
                props.ignore ||
                config.parse_cfg_name_directive(ln, "ignore") ||
                (config.has_cfg_prefix(ln, "only") &&
                !config.parse_cfg_name_directive(ln, "only")) ||
                ignore_gdb(config, ln) ||
                ignore_lldb(config, ln) ||<commit_msg>add a comment about parsing only prefix in header.rs<commit_after>// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::env;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::path::{Path, PathBuf};

use common::Config;
use common;
use util;

use extract_gdb_version;

/// Properties which must be known very early, before actually running
/// the test.
pub struct EarlyProps {
    pub ignore: bool,
    pub should_fail: bool,
    pub aux: Vec<String>,
    pub revisions: Vec<String>,
}

impl EarlyProps {
    pub fn from_file(config: &Config, testfile: &Path) -> Self {
        let mut props = EarlyProps {
            ignore: false,
            should_fail: false,
            aux: Vec::new(),
            revisions: vec![],
        };

        iter_header(testfile,
                    None,
                    &mut |ln| {
            // we should check if any only-<platform> exists and if it exists
            // and does not matches the current platform, skip the test
            props.ignore =
                props.ignore ||
                config.parse_cfg_name_directive(ln, "ignore") ||
                (config.has_cfg_prefix(ln, "only") &&
                !config.parse_cfg_name_directive(ln, "only")) ||
                ignore_gdb(config, ln) ||
                ignore_lldb(config, ln) ||
{'fraction_non_alphanumeric': 0.12, 'fraction_numerical': 0.007218045112781955, 'mean_word_length': 2.3393574297188753, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7302464', 'n_tokens_mistral': 992, 'n_tokens_neox': 946, 'n_words': 305}