Skip to content

Run tidy on tests #12055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
tidy:
@$(call E, check: formatting)
$(Q)find $(S)src -name '*.r[sc]' \
| grep '^$(S)src/test' -v \
| grep '^$(S)src/libuv' -v \
| grep '^$(S)src/llvm' -v \
| grep '^$(S)src/gyp' -v \
Expand Down
22 changes: 19 additions & 3 deletions src/etc/tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

err=0
cols=100
cr_flag="xfail-tidy-cr"
tab_flag="xfail-tidy-tab"
linelength_flag="xfail-tidy-linelength"

# Be careful to support Python 2.4, 2.6, and 3.x here!
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],
Expand Down Expand Up @@ -46,12 +49,22 @@ def do_license_check(name, contents):

current_name = ""
current_contents = ""
check_tab = True
check_cr = True
check_linelength = True


try:
for line in fileinput.input(file_names,
openhook=fileinput.hook_encoded("utf-8")):

if fileinput.filename().find("tidy.py") == -1:
if line.find(cr_flag) != -1:
check_cr = False
if line.find(tab_flag) != -1:
check_tab = False
if line.find(linelength_flag) != -1:
check_linelength = False
if line.find("// XXX") != -1:
report_err("XXX is no longer necessary, use FIXME")
if line.find("TODO") != -1:
Expand All @@ -72,16 +85,16 @@ def do_license_check(name, contents):
if "SNAP" in line:
report_warn("unmatched SNAP line: " + line)

if (line.find('\t') != -1 and
if check_tab and (line.find('\t') != -1 and
fileinput.filename().find("Makefile") == -1):
report_err("tab character")
if not autocrlf and line.find('\r') != -1:
if check_cr and not autocrlf and line.find('\r') != -1:
report_err("CR character")
if line.endswith(" \n") or line.endswith("\t\n"):
report_err("trailing whitespace")
line_len = len(line)-2 if autocrlf else len(line)-1

if line_len > cols:
if check_linelength and line_len > cols:
report_err("line longer than %d chars" % cols)

if fileinput.isfirstline() and current_name != "":
Expand All @@ -90,6 +103,9 @@ def do_license_check(name, contents):
if fileinput.isfirstline():
current_name = fileinput.filename()
current_contents = ""
check_cr = True
check_tab = True
check_linelength = True

current_contents += line

Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/extern_mod_ordering_lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

#[crate_type="lib"];

pub mod extern_mod_ordering_lib {
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/impl_privacy_xc_1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

#[crate_type = "lib"];

pub struct Fish {
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/impl_privacy_xc_2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

#[crate_type = "lib"];

pub struct Fish {
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/issue_3907_1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

pub trait Foo {
fn bar();
}
10 changes: 10 additions & 0 deletions src/test/auxiliary/kinds_in_metadata.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */

Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/newtype_struct_xc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

#[crate_type="lib"];

pub struct Au(int);
10 changes: 10 additions & 0 deletions src/test/auxiliary/no_std_crate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

#[no_std];

pub fn foo() {}
10 changes: 10 additions & 0 deletions src/test/auxiliary/packed.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

#[packed]
pub struct S {
a: u8,
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/private_variant_xc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

pub enum Foo {
Bar,
priv Baz,
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/static_fn_trait_xc_aux.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

pub mod num {
pub trait Num2 {
fn from_int2(n: int) -> Self;
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/static_mut_xc.rs
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
// Copyright 2014 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.

pub static mut a: int = 3;
10 changes: 10 additions & 0 deletions src/test/auxiliary/trait_default_method_xc_aux.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

#[crate_id="trait_default_method_xc_aux"];

pub struct Something { x: int }
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/trait_default_method_xc_aux_2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

// aux-build:trait_default_method_xc_aux.rs

extern mod aux = "trait_default_method_xc_aux";
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/use_from_trait_xc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

pub trait Trait {
fn foo();
}
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/xc_private_method_lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

#[crate_type="lib"];

pub struct Struct {
Expand Down
10 changes: 10 additions & 0 deletions src/test/bench/noise.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

// Perlin noise benchmark from https://gist.github.com/1170424

use std::f64;
Expand Down
10 changes: 10 additions & 0 deletions src/test/bench/rt-messaging-ping-pong.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down
10 changes: 10 additions & 0 deletions src/test/bench/shootout-fannkuch-redux.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

// xfail-test reading from os::args()[1] - bogus!

use std::from_str::FromStr;
Expand Down
10 changes: 10 additions & 0 deletions src/test/bench/shootout-fasta-redux.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

// xfail-test reading from os::args()[1] - bogus!

use std::cast::transmute;
Expand Down
10 changes: 10 additions & 0 deletions src/test/bench/shootout-k-nucleotide.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

// xfail-test

extern mod extra;
Expand Down
10 changes: 10 additions & 0 deletions src/test/bench/shootout-nbody.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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::os;

static PI: f64 = 3.141592653589793;
Expand Down
10 changes: 10 additions & 0 deletions src/test/bench/task-perf-linked-failure.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright 2014 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.

// xfail-pretty
// xfail-test linked failure

Expand Down
3 changes: 2 additions & 1 deletion src/test/compile-fail/autoderef-full-lval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ fn main() {
assert_eq!(z, 21);
let forty: fish = fish{a: @40};
let two: fish = fish{a: @2};
let answer: int = forty.a + two.a; //~ ERROR binary operation `+` cannot be applied to type `@int`
let answer: int = forty.a + two.a;
//~^ ERROR binary operation `+` cannot be applied to type `@int`
info!("{:?}", answer);
assert_eq!(answer, 42);
}
5 changes: 3 additions & 2 deletions src/test/compile-fail/bad-char-literals3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-tidy-cr
fn main() {
// note that this is a literal "\r" byte
'';
//~^ ERROR: character constant must be escaped
'
'; //~^ ERROR: character constant must be escaped
}
Loading