Skip to content

Commit e3b6307

Browse files
committed
---
yaml --- r: 89659 b: refs/heads/master c: fdc830d h: refs/heads/master i: 89657: 3073e6f 89655: c70e6b6 v: v3
1 parent bc0dbd3 commit e3b6307

File tree

71 files changed

+299
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+299
-52
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 71acc543ca0858a064c4bed848b507325c383939
2+
refs/heads/master: fdc830df31df205c8edc5e11268a011d44c8bc09
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/src/compiletest/compiletest.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,19 @@ pub fn mode_str(mode: mode) -> ~str {
220220
}
221221

222222
pub fn run_tests(config: &config) {
223+
if config.target == ~"arm-linux-androideabi" {
224+
match config.mode{
225+
mode_debug_info => {
226+
println("arm-linux-androideabi debug-info \
227+
test uses tcp 5039 port. please reserve it");
228+
//arm-linux-androideabi debug-info test uses remote debugger
229+
//so, we test 1 task at once
230+
os::setenv("RUST_TEST_TASKS","1");
231+
}
232+
_ =>{}
233+
}
234+
}
235+
223236
let opts = test_opts(config);
224237
let tests = make_tests(config);
225238
// sadly osx needs some file descriptor limits raised for running tests in

trunk/src/compiletest/procsrv.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,26 @@ pub fn run(lib_path: &str,
6767
err: str::from_utf8(output.error)
6868
}
6969
}
70+
71+
pub fn run_background(lib_path: &str,
72+
prog: &str,
73+
args: &[~str],
74+
env: ~[(~str, ~str)],
75+
input: Option<~str>) -> run::Process {
76+
77+
let env = env + target_env(lib_path, prog);
78+
let mut process = run::Process::new(prog, args, run::ProcessOptions {
79+
env: Some(env),
80+
dir: None,
81+
in_fd: None,
82+
out_fd: None,
83+
err_fd: None
84+
});
85+
86+
for input in input.iter() {
87+
process.input().write(input.as_bytes());
88+
}
89+
90+
return process;
91+
}
92+

trunk/src/compiletest/runtest.rs

Lines changed: 112 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ use std::rt::io::File;
2626
use std::os;
2727
use std::str;
2828
use std::vec;
29+
use std::rt::io::net::tcp;
30+
use std::rt::io::net::ip::{Ipv4Addr, SocketAddr};
31+
use std::task;
32+
use std::rt::io::timer;
2933

3034
use extra::test::MetricMap;
3135

@@ -245,6 +249,7 @@ actual:\n\
245249
}
246250

247251
fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
252+
248253
// do not optimize debuginfo tests
249254
let mut config = match config.rustcflags {
250255
Some(ref flags) => config {
@@ -254,39 +259,125 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
254259
None => (*config).clone()
255260
};
256261
let config = &mut config;
257-
let cmds = props.debugger_cmds.connect("\n");
258262
let check_lines = &props.check_lines;
263+
let mut cmds = props.debugger_cmds.connect("\n");
259264

260265
// compile test file (it shoud have 'compile-flags:-g' in the header)
261266
let mut ProcRes = compile_test(config, props, testfile);
262267
if ProcRes.status != 0 {
263268
fatal_ProcRes(~"compilation failed!", &ProcRes);
264269
}
265270

266-
// write debugger script
267-
let script_str = [~"set charset UTF-8",
268-
cmds,
269-
~"quit\n"].connect("\n");
270-
debug!("script_str = {}", script_str);
271-
dump_output_file(config, testfile, script_str, "debugger.script");
272-
273-
// run debugger script with gdb
274-
#[cfg(windows)]
275-
fn debugger() -> ~str { ~"gdb.exe" }
276-
#[cfg(unix)]
277-
fn debugger() -> ~str { ~"gdb" }
278-
let debugger_script = make_out_name(config, testfile, "debugger.script");
279271
let exe_file = make_exe_name(config, testfile);
280-
// FIXME (#9639): This needs to handle non-utf8 paths
281-
let debugger_opts = ~[~"-quiet", ~"-batch", ~"-nx",
282-
~"-command=" + debugger_script.as_str().unwrap().to_owned(),
283-
exe_file.as_str().unwrap().to_owned()];
284-
let ProcArgs = ProcArgs {prog: debugger(), args: debugger_opts};
285-
ProcRes = compose_and_run(config, testfile, ProcArgs, ~[], "", None);
272+
273+
let mut ProcArgs;
274+
match config.target {
275+
~"arm-linux-androideabi" => {
276+
if (config.adb_device_status) {
277+
278+
cmds = cmds.replace("run","continue");
279+
280+
// write debugger script
281+
let script_str = [~"set charset UTF-8",
282+
format!("file {}",exe_file.as_str().unwrap().to_owned()),
283+
~"target remote :5039",
284+
cmds,
285+
~"quit"].connect("\n");
286+
debug!("script_str = {}", script_str);
287+
dump_output_file(config, testfile, script_str, "debugger.script");
288+
289+
290+
procsrv::run("", config.adb_path.clone(),
291+
[~"push", exe_file.as_str().unwrap().to_owned(), config.adb_test_dir.clone()],
292+
~[(~"",~"")], Some(~""));
293+
294+
procsrv::run("", config.adb_path,
295+
[~"forward", ~"tcp:5039", ~"tcp:5039"],
296+
~[(~"",~"")], Some(~""));
297+
298+
let adb_arg = format!("export LD_LIBRARY_PATH={}; gdbserver :5039 {}/{}",
299+
config.adb_test_dir.clone(), config.adb_test_dir.clone(),
300+
str::from_utf8(exe_file.filename().unwrap())).clone();
301+
302+
let mut process = procsrv::run_background("", config.adb_path.clone(),
303+
[~"shell",adb_arg.clone()],~[(~"",~"")], Some(~""));
304+
loop {
305+
//waiting 1 second for gdbserver start
306+
timer::sleep(1000);
307+
let result = do task::try {
308+
tcp::TcpStream::connect(
309+
SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 5039 });
310+
};
311+
if result.is_err() {
312+
continue;
313+
}
314+
break;
315+
}
316+
317+
let args = split_maybe_args(&config.rustcflags);
318+
let mut tool_path:~str = ~"";
319+
for arg in args.iter() {
320+
if arg.contains("--android-cross-path=") {
321+
tool_path = arg.replace("--android-cross-path=","");
322+
break;
323+
}
324+
}
325+
326+
if tool_path.equals(&~"") {
327+
fatal(~"cannot found android cross path");
328+
}
329+
330+
let debugger_script = make_out_name(config, testfile, "debugger.script");
331+
// FIXME (#9639): This needs to handle non-utf8 paths
332+
let debugger_opts = ~[~"-quiet", ~"-batch", ~"-nx",
333+
"-command=" + debugger_script.as_str().unwrap().to_owned()];
334+
335+
let procsrv::Result{ out, err, status }=
336+
procsrv::run("",
337+
tool_path.append("/bin/arm-linux-androideabi-gdb"),
338+
debugger_opts, ~[(~"",~"")], None);
339+
let cmdline = {
340+
let cmdline = make_cmdline("", "arm-linux-androideabi-gdb", debugger_opts);
341+
logv(config, format!("executing {}", cmdline));
342+
cmdline
343+
};
344+
345+
ProcRes = ProcRes {status: status,
346+
stdout: out,
347+
stderr: err,
348+
cmdline: cmdline};
349+
process.force_destroy();
350+
}
351+
}
352+
353+
_=> {
354+
// write debugger script
355+
let script_str = [~"set charset UTF-8",
356+
cmds,
357+
~"quit\n"].connect("\n");
358+
debug!("script_str = {}", script_str);
359+
dump_output_file(config, testfile, script_str, "debugger.script");
360+
361+
// run debugger script with gdb
362+
#[cfg(windows)]
363+
fn debugger() -> ~str { ~"gdb.exe" }
364+
#[cfg(unix)]
365+
fn debugger() -> ~str { ~"gdb" }
366+
367+
let debugger_script = make_out_name(config, testfile, "debugger.script");
368+
369+
// FIXME (#9639): This needs to handle non-utf8 paths
370+
let debugger_opts = ~[~"-quiet", ~"-batch", ~"-nx",
371+
"-command=" + debugger_script.as_str().unwrap().to_owned(),
372+
exe_file.as_str().unwrap().to_owned()];
373+
ProcArgs = ProcArgs {prog: debugger(), args: debugger_opts};
374+
ProcRes = compose_and_run(config, testfile, ProcArgs, ~[], "", None);
375+
}
376+
}
377+
286378
if ProcRes.status != 0 {
287379
fatal(~"gdb failed to execute");
288380
}
289-
290381
let num_check_lines = check_lines.len();
291382
if num_check_lines > 0 {
292383
// Allow check lines to leave parts unspecified (e.g., uninitialized
@@ -834,7 +925,6 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
834925
for tv in args.args.iter() {
835926
runargs.push(tv.to_owned());
836927
}
837-
838928
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~""));
839929
840930
// get exitcode of result

trunk/src/librustc/back/rpath.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn get_rpath_relative_to_output(os: session::Os,
118118
let prefix = match os {
119119
session::OsAndroid | session::OsLinux | session::OsFreebsd
120120
=> "$ORIGIN",
121-
session::OsMacos => "@executable_path",
121+
session::OsMacos => "@loader_path",
122122
session::OsWin32 => unreachable!()
123123
};
124124

@@ -241,7 +241,7 @@ mod test {
241241
let res = get_rpath_relative_to_output(o,
242242
&Path::new("bin/rustc"),
243243
&Path::new("lib/libstd.so"));
244-
assert_eq!(res.as_slice(), "@executable_path/../lib");
244+
assert_eq!(res.as_slice(), "@loader_path/../lib");
245245
}
246246
247247
#[test]

trunk/src/libstd/fmt/parse.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<'self> Iterator<Piece<'self>> for Parser<'self> {
180180
}
181181
Some((_, '}')) if self.depth == 0 => {
182182
self.cur.next();
183-
self.err(~"unmatched `}` found");
183+
self.err("unmatched `}` found");
184184
None
185185
}
186186
Some((_, '}')) | None => { None }
@@ -204,8 +204,8 @@ impl<'self> Parser<'self> {
204204
/// Notifies of an error. The message doesn't actually need to be of type
205205
/// ~str, but I think it does when this eventually uses conditions so it
206206
/// might as well start using it now.
207-
fn err(&self, msg: ~str) {
208-
parse_error::cond.raise(msg);
207+
fn err(&self, msg: &str) {
208+
parse_error::cond.raise("invalid format string: " + msg);
209209
}
210210

211211
/// Optionally consumes the specified character. If the character is not at
@@ -230,11 +230,11 @@ impl<'self> Parser<'self> {
230230
self.cur.next();
231231
}
232232
Some((_, other)) => {
233-
parse_error::cond.raise(
233+
self.err(
234234
format!("expected `{}` but found `{}`", c, other));
235235
}
236236
None => {
237-
parse_error::cond.raise(
237+
self.err(
238238
format!("expected `{}` but string was terminated", c));
239239
}
240240
}
@@ -267,7 +267,7 @@ impl<'self> Parser<'self> {
267267
c
268268
}
269269
None => {
270-
self.err(~"expected an escape sequence, but format string was \
270+
self.err("expected an escape sequence, but format string was \
271271
terminated");
272272
' '
273273
}
@@ -411,7 +411,7 @@ impl<'self> Parser<'self> {
411411
Some(self.plural())
412412
}
413413
"" => {
414-
self.err(~"expected method after comma");
414+
self.err("expected method after comma");
415415
return None;
416416
}
417417
method => {
@@ -430,7 +430,7 @@ impl<'self> Parser<'self> {
430430
self.ws();
431431
let selector = self.word();
432432
if selector == "" {
433-
self.err(~"cannot have an empty selector");
433+
self.err("cannot have an empty selector");
434434
break
435435
}
436436
self.must_consume('{');
@@ -440,7 +440,7 @@ impl<'self> Parser<'self> {
440440
self.must_consume('}');
441441
if selector == "other" {
442442
if !other.is_none() {
443-
self.err(~"multiple `other` statements in `select");
443+
self.err("multiple `other` statements in `select");
444444
}
445445
other = Some(pieces);
446446
} else {
@@ -456,7 +456,7 @@ impl<'self> Parser<'self> {
456456
let other = match other {
457457
Some(arm) => { arm }
458458
None => {
459-
self.err(~"`select` statement must provide an `other` case");
459+
self.err("`select` statement must provide an `other` case");
460460
~[]
461461
}
462462
};
@@ -488,7 +488,7 @@ impl<'self> Parser<'self> {
488488
match self.integer() {
489489
Some(i) => { offset = Some(i); }
490490
None => {
491-
self.err(~"offset must be an integer");
491+
self.err("offset must be an integer");
492492
}
493493
}
494494
}
@@ -506,8 +506,8 @@ impl<'self> Parser<'self> {
506506
match self.integer() {
507507
Some(i) => Right(i),
508508
None => {
509-
self.err(~"plural `=` selectors must be followed by an \
510-
integer");
509+
self.err("plural `=` selectors must be followed by an \
510+
integer");
511511
Right(0)
512512
}
513513
}
@@ -538,7 +538,7 @@ impl<'self> Parser<'self> {
538538
self.must_consume('}');
539539
if isother {
540540
if !other.is_none() {
541-
self.err(~"multiple `other` statements in `select");
541+
self.err("multiple `other` statements in `select");
542542
}
543543
other = Some(pieces);
544544
} else {
@@ -554,7 +554,7 @@ impl<'self> Parser<'self> {
554554
let other = match other {
555555
Some(arm) => { arm }
556556
None => {
557-
self.err(~"`plural` statement must provide an `other` case");
557+
self.err("`plural` statement must provide an `other` case");
558558
~[]
559559
}
560560
};

0 commit comments

Comments
 (0)