File tree 11 files changed +153
-1
lines changed 11 files changed +153
-1
lines changed Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " memory-hungry"
3
+ version = " 0.1.0"
4
+ authors = [
" Pietro Albini <[email protected] >" ]
5
+
6
+ [dependencies ]
7
+
8
+ [build-dependencies ]
9
+ rustc_version = " 0.2.3"
Original file line number Diff line number Diff line change
1
+ extern crate rustc_version;
2
+
3
+ #[ path = "src/allocate.rs" ]
4
+ mod allocate;
5
+
6
+ use rustc_version:: { version_meta, Channel } ;
7
+
8
+ fn main ( ) {
9
+ if let Channel :: Beta = version_meta ( ) . unwrap ( ) . channel {
10
+ // On the beta channel allocate in tests
11
+ println ! ( "cargo:rustc-cfg=channel_beta" ) ;
12
+ } else {
13
+ // On the stable channel allocate in build.rs
14
+ allocate:: allocate ( ) ;
15
+ }
16
+
17
+ // Rebuild the crate only if the build.rs file changes
18
+ println ! ( "cargo:rebuild-if-changed=build.rs" ) ;
19
+ }
Original file line number Diff line number Diff line change
1
+ const MAX_ALLOCATE : usize = 1_073_741_824 ;
2
+
3
+ pub fn allocate ( ) {
4
+ let data = [ 0u8 ; 4096 ] ;
5
+ let mut allocated = 0 ;
6
+
7
+ while allocated < MAX_ALLOCATE {
8
+ Box :: leak ( Box :: new ( data) ) ;
9
+ allocated += data. len ( ) ;
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ #[ cfg( channel_beta) ]
2
+ mod allocate;
3
+
4
+ fn main ( ) {
5
+ println ! ( "Hello world" ) ;
6
+ }
7
+
8
+ #[ test]
9
+ #[ cfg( channel_beta) ]
10
+ fn test_allocate ( ) {
11
+ allocate:: allocate ( ) ;
12
+ }
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " network-access"
3
+ version = " 0.1.0"
4
+ authors = [
" Pietro Albini <[email protected] >" ]
5
+
6
+ [dependencies ]
7
+
8
+ [build-dependencies ]
9
+ rustc_version = " 0.2.3"
Original file line number Diff line number Diff line change
1
+ extern crate rustc_version;
2
+
3
+ #[ path = "src/network.rs" ]
4
+ mod network;
5
+
6
+ use rustc_version:: { version_meta, Channel } ;
7
+
8
+ fn main ( ) {
9
+ if let Channel :: Beta = version_meta ( ) . unwrap ( ) . channel {
10
+ // On the beta channel connect to the network in tests
11
+ println ! ( "cargo:rustc-cfg=channel_beta" ) ;
12
+ } else {
13
+ // On the stable channel connect to the network in build.rs
14
+ network:: call ( ) ;
15
+ }
16
+
17
+ // Rebuild the crate only if the build.rs file changes
18
+ println ! ( "cargo:rebuild-if-changed=build.rs" ) ;
19
+ }
Original file line number Diff line number Diff line change
1
+ #[ cfg( channel_beta) ]
2
+ mod network;
3
+
4
+ fn main ( ) {
5
+ println ! ( "Hello, world!" ) ;
6
+ }
7
+
8
+ #[ cfg( channel_beta) ]
9
+ #[ test]
10
+ fn test_network_access ( ) {
11
+ network:: call ( ) ;
12
+ }
Original file line number Diff line number Diff line change
1
+ use std:: net:: TcpStream ;
2
+
3
+ pub fn call ( ) {
4
+ // Try to connect to www.rust-lang.org:80
5
+ // If network access is disabled even this should fail
6
+ let _ = TcpStream :: connect ( "www.rust-lang.org:80" ) . unwrap ( ) ;
7
+ }
Original file line number Diff line number Diff line change
1
+ [server ]
2
+ bot-acl = [
3
+ " pietroalbini" ,
4
+ ]
5
+
6
+ [server .labels ]
7
+ remove = " ^S-"
8
+ experiment-queued = " S-waiting-on-crater"
9
+ experiment-completed = " S-waiting-on-review"
10
+
11
+ [demo-crates ]
12
+ crates = [" lazy_static" ]
13
+ github-repos = [" brson/hello-rs" ]
14
+
15
+ [sandbox ]
16
+ memory-limit = " 512M"
17
+
18
+ [crates ]
19
+
20
+ [github-repos ]
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ fn run() {
22
22
// Create local list in the temp work dir
23
23
Command :: crater ( )
24
24
. args ( & [ "create-lists" , "local" ] )
25
+ . env ( "CRATER_CONFIG" , "tests/minicrater/config.toml" )
25
26
. assert ( )
26
27
. success ( ) ;
27
28
@@ -33,18 +34,21 @@ fn run() {
33
34
"stable" ,
34
35
"beta" ,
35
36
"--crate-select=local" ,
36
- ] ) . assert ( )
37
+ ] ) . env ( "CRATER_CONFIG" , "tests/minicrater/config.toml" )
38
+ . assert ( )
37
39
. success ( ) ;
38
40
39
41
// Execute the experiment
40
42
Command :: crater ( )
41
43
. args ( & [ "run-graph" , & ex_arg] )
44
+ . env ( "CRATER_CONFIG" , "tests/minicrater/config.toml" )
42
45
. assert ( )
43
46
. success ( ) ;
44
47
45
48
// Generate the report
46
49
Command :: crater ( )
47
50
. args ( & [ "gen-report" , & ex_arg] )
51
+ . env ( "CRATER_CONFIG" , "tests/minicrater/config.toml" )
48
52
. arg ( report_dir. path ( ) )
49
53
. assert ( )
50
54
. success ( ) ;
Original file line number Diff line number Diff line change 60
60
],
61
61
"url" : " https://github.com/rust-lang-nursery/crater/tree/master/local-crates/build-pass"
62
62
},
63
+ {
64
+ "name" : " memory-hungry (local)" ,
65
+ "res" : " Fixed" ,
66
+ "runs" : [
67
+ {
68
+ "log" : " stable/local/memory-hungry" ,
69
+ "res" : " BuildFail"
70
+ },
71
+ {
72
+ "log" : " beta/local/memory-hungry" ,
73
+ "res" : " TestFail"
74
+ }
75
+ ],
76
+ "url" : " https://github.com/rust-lang-nursery/crater/tree/master/local-crates/memory-hungry"
77
+ },
78
+ {
79
+ "name" : " network-access (local)" ,
80
+ "res" : " Fixed" ,
81
+ "runs" : [
82
+ {
83
+ "log" : " stable/local/network-access" ,
84
+ "res" : " BuildFail"
85
+ },
86
+ {
87
+ "log" : " beta/local/network-access" ,
88
+ "res" : " TestFail"
89
+ }
90
+ ],
91
+ "url" : " https://github.com/rust-lang-nursery/crater/tree/master/local-crates/network-access"
92
+ },
63
93
{
64
94
"name" : " test-fail (local)" ,
65
95
"res" : " SameTestFail" ,
You can’t perform that action at this time.
0 commit comments