Skip to content

Commit 5099473

Browse files
committed
---
yaml --- r: 62961 b: refs/heads/snap-stage3 c: dee7c5a h: refs/heads/master i: 62959: ecad624 v: v3
1 parent 84cf27f commit 5099473

File tree

16 files changed

+366
-198
lines changed

16 files changed

+366
-198
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 5b09dca90be0b60ebc29998dc75cdc497d061796
4+
refs/heads/snap-stage3: dee7c5af6991b02c86e6a84b57551fd5cc71caaf
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/rustpkg.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ or the equivalent on Windows.
3030

3131
Each workspace may contain one or more packages.
3232

33-
When building code that contains one or more directives of the form `extern mod P`,
34-
rustpkg automatically searches for packages named `P` in the `RUST_PATH` (as described above).
35-
It builds those dependencies if necessary.
36-
Thus, when using rustpkg,
37-
there is no need for `-L` flags to tell the linker where to find libraries for external crates.
38-
3933
# Package structure
4034

4135
A valid workspace must contain each of the following subdirectories:
@@ -72,10 +66,6 @@ A package can be stored in a workspace on the local file system,
7266
or on a remote Web server, in which case the package ID resembles a URL.
7367
For example, `github.com/mozilla/rust` is a package ID
7468
that would refer to the git repository browsable at `http://github.com/mozilla/rust`.
75-
A package ID can also specify a version, like:
76-
`github.com/mozilla/rust#0.3`.
77-
In this case, `rustpkg` will check that the repository `github.com/mozilla/rust` has a tag named `0.3`,
78-
and report an error otherwise.
7969

8070
## Source files
8171

@@ -86,15 +76,6 @@ rustpkg searches for four different fixed filenames in order to determine the cr
8676
* `test.rs`: Assumed to contain tests declared with the `#[test]` attribute.
8777
* `bench.rs`: Assumed to contain benchmarks declared with the `#[bench]` attribute.
8878

89-
## Versions
90-
91-
`rustpkg` packages do not need to declare their versions with an attribute inside one of the source files,
92-
because `rustpkg` infers it from the version control system.
93-
When building a package that is in a `git` repository,
94-
`rustpkg` assumes that the most recent tag specifies the current version.
95-
When building a package that is not under version control,
96-
or that has no tags, `rustpkg` assumes the intended version is 0.1.
97-
9879
# Custom build scripts
9980

10081
A file called `pkg.rs` at the root level in a workspace is called a *package script*.

branches/snap-stage3/mk/tests.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,18 @@ CFG_ADB_TEST_DIR=/data/tmp
122122
$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
123123
$(shell adb remount 1>/dev/null) \
124124
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
125+
$(shell adb shell rm $(CFG_ADB_TEST_DIR)/*.so 1>/dev/null) \
126+
$(shell adb shell rm $(CFG_ADB_TEST_DIR)/*-arm-linux-androideabi 1>/dev/null) \
127+
$(shell adb shell rm $(CFG_ADB_TEST_DIR)/*-arm-linux-androideabi.* 1>/dev/null) \
128+
$(shell adb push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
125129
$(shell adb push $(CFG_ANDROID_CROSS_PATH)/arm-linux-androideabi/lib/armv7-a/libgnustl_shared.so \
126130
$(CFG_ADB_TEST_DIR) 1>/dev/null) \
131+
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD_TRIPLE))/$(CFG_RUNTIME_arm-linux-androideabi) \
132+
$(CFG_ADB_TEST_DIR)) \
133+
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD_TRIPLE))/$(STDLIB_GLOB_arm-linux-androideabi) \
134+
$(CFG_ADB_TEST_DIR)) \
135+
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD_TRIPLE))/$(EXTRALIB_GLOB_arm-linux-androideabi) \
136+
$(CFG_ADB_TEST_DIR)) \
127137
)
128138
else
129139
CFG_ADB_TEST_DIR=

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -753,53 +753,62 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
753753
copy_result.out, copy_result.err));
754754
}
755755

756-
// execute program
757756
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
758757

759-
// adb shell dose not forward stdout and stderr of internal result
760-
// to stdout and stderr separately but to stdout only
761-
let mut newargs_out = ~[];
762-
let mut newargs_err = ~[];
763-
newargs_out.push(~"shell");
764-
newargs_err.push(~"shell");
758+
let mut runargs = ~[];
765759

766-
let mut newcmd_out = ~"";
767-
let mut newcmd_err = ~"";
760+
// run test via adb_run_wrapper
761+
runargs.push(~"shell");
762+
runargs.push(fmt!("%s/adb_run_wrapper.sh", config.adb_test_dir));
763+
runargs.push(fmt!("%s", config.adb_test_dir));
764+
runargs.push(fmt!("%s", prog_short));
768765

769-
newcmd_out.push_str(fmt!("LD_LIBRARY_PATH=%s %s/%s",
770-
config.adb_test_dir, config.adb_test_dir, prog_short));
766+
for args.args.each |tv| {
767+
runargs.push(tv.to_owned());
768+
}
771769

772-
newcmd_err.push_str(fmt!("LD_LIBRARY_PATH=%s %s/%s",
773-
config.adb_test_dir, config.adb_test_dir, prog_short));
770+
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~""));
774771

775-
for args.args.each |tv| {
776-
newcmd_out.push_str(" ");
777-
newcmd_err.push_str(" ");
778-
newcmd_out.push_str(*tv);
779-
newcmd_err.push_str(*tv);
772+
// get exitcode of result
773+
runargs = ~[];
774+
runargs.push(~"shell");
775+
runargs.push(~"cat");
776+
runargs.push(fmt!("%s/%s.exitcode", config.adb_test_dir, prog_short));
777+
778+
let procsrv::Result{ out: exitcode_out, err: _, status: _ } =
779+
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")],
780+
Some(~""));
781+
782+
let mut exitcode : int = 0;
783+
for str::each_char(exitcode_out) |c| {
784+
if !c.is_digit() { break; }
785+
exitcode = exitcode * 10 + match c {
786+
'0' .. '9' => c as int - ('0' as int),
787+
_ => 101,
788+
}
780789
}
781790

782-
newcmd_out.push_str(" 2>/dev/null");
783-
newcmd_err.push_str(" 1>/dev/null");
791+
// get stdout of result
792+
runargs = ~[];
793+
runargs.push(~"shell");
794+
runargs.push(~"cat");
795+
runargs.push(fmt!("%s/%s.stdout", config.adb_test_dir, prog_short));
784796

785-
newargs_out.push(newcmd_out);
786-
newargs_err.push(newcmd_err);
797+
let procsrv::Result{ out: stdout_out, err: _, status: _ } =
798+
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~""));
787799

788-
let procsrv::Result{ out: out_out, err: _out_err, status: out_status } =
789-
procsrv::run("", config.adb_path, newargs_out, ~[(~"",~"")],
790-
Some(~""));
791-
let procsrv::Result{ out: err_out, err: _err_err, status: _err_status } =
792-
procsrv::run("", config.adb_path, newargs_err, ~[(~"",~"")],
793-
Some(~""));
800+
// get stderr of result
801+
runargs = ~[];
802+
runargs.push(~"shell");
803+
runargs.push(~"cat");
804+
runargs.push(fmt!("%s/%s.stderr", config.adb_test_dir, prog_short));
794805

795-
dump_output(config, testfile, out_out, err_out);
806+
let procsrv::Result{ out: stderr_out, err: _, status: _ } =
807+
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~""));
796808

797-
match err_out {
798-
~"" => ProcRes {status: out_status, stdout: out_out,
799-
stderr: err_out, cmdline: cmdline },
800-
_ => ProcRes {status: 101, stdout: out_out,
801-
stderr: err_out, cmdline: cmdline }
802-
}
809+
dump_output(config, testfile, stdout_out, stderr_out);
810+
811+
ProcRes {status: exitcode, stdout: stdout_out, stderr: stderr_out, cmdline: cmdline }
803812
}
804813

805814
fn _dummy_exec_compiled_test(config: &config, props: &TestProps,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# usage : adb_run_wrapper [test dir - where test executables exist] [test executable]
3+
#
4+
5+
# Sometimes android shell produce exitcode "1 : Text File Busy"
6+
# Retry after $WAIT seconds, expecting resource cleaned-up
7+
WAIT=10
8+
PATH=$1
9+
if [ -d "$PATH" ]
10+
then
11+
shift
12+
RUN=$1
13+
14+
if [ ! -z "$RUN" ]
15+
then
16+
shift
17+
18+
L_RET=1
19+
L_COUNT=0
20+
while [ $L_RET -eq 1 ]
21+
do
22+
LD_LIBRARY_PATH=$PATH $PATH/$RUN $@ 1>$PATH/$RUN.stdout 2>$PATH/$RUN.stderr
23+
L_RET=$?
24+
if [ $L_COUNT -gt 0 ]
25+
then
26+
/system/bin/sleep $WAIT
27+
/system/bin/sync
28+
fi
29+
L_COUNT=`expr $L_COUNT+1`
30+
done
31+
32+
echo $L_RET > $PATH/$RUN.exitcode
33+
34+
fi
35+
fi

branches/snap-stage3/src/libextra/arc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ use core::cast;
4848
use core::unstable::sync::UnsafeAtomicRcBox;
4949
use core::ptr;
5050
use core::task;
51+
use core::borrow;
5152

5253
/// As sync::condvar, a mechanism for unlock-and-descheduling and signaling.
5354
pub struct Condvar<'self> {
@@ -425,7 +426,7 @@ impl<T:Const + Owned> RWARC<T> {
425426
// of this cast is removing the mutability.)
426427
let new_data = cast::transmute_immut(data);
427428
// Downgrade ensured the token belonged to us. Just a sanity check.
428-
assert!(ptr::ref_eq(&(*state).data, new_data));
429+
assert!(borrow::ref_eq(&(*state).data, new_data));
429430
// Produce new token
430431
RWReadMode {
431432
data: new_data,

branches/snap-stage3/src/libextra/sync.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use core::prelude::*;
1919

20+
use core::borrow;
2021
use core::comm;
2122
use core::ptr;
2223
use core::task;
@@ -589,7 +590,7 @@ impl RWlock {
589590
/// To be called inside of the write_downgrade block.
590591
pub fn downgrade<'a>(&self, token: RWlockWriteMode<'a>)
591592
-> RWlockReadMode<'a> {
592-
if !ptr::ref_eq(self, token.lock) {
593+
if !borrow::ref_eq(self, token.lock) {
593594
fail!("Can't downgrade() with a different rwlock's write_mode!");
594595
}
595596
unsafe {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Borrowed pointer utilities
12+
13+
#[cfg(not(test))]
14+
use prelude::*;
15+
16+
/// Cast a region pointer - &T - to a uint.
17+
#[inline(always)]
18+
pub fn to_uint<T>(thing: &T) -> uint {
19+
thing as *T as uint
20+
}
21+
22+
/// Determine if two borrowed pointers point to the same thing.
23+
#[inline(always)]
24+
pub fn ref_eq<'a, 'b, T>(thing: &'a T, other: &'b T) -> bool {
25+
to_uint(thing) == to_uint(other)
26+
}
27+
28+
// Equality for region pointers
29+
#[cfg(not(test))]
30+
impl<'self, T: Eq> Eq for &'self T {
31+
#[inline(always)]
32+
fn eq(&self, other: & &'self T) -> bool {
33+
*(*self) == *(*other)
34+
}
35+
#[inline(always)]
36+
fn ne(&self, other: & &'self T) -> bool {
37+
*(*self) != *(*other)
38+
}
39+
}
40+
41+
// Comparison for region pointers
42+
#[cfg(not(test))]
43+
impl<'self, T: Ord> Ord for &'self T {
44+
#[inline(always)]
45+
fn lt(&self, other: & &'self T) -> bool {
46+
*(*self) < *(*other)
47+
}
48+
#[inline(always)]
49+
fn le(&self, other: & &'self T) -> bool {
50+
*(*self) <= *(*other)
51+
}
52+
#[inline(always)]
53+
fn ge(&self, other: & &'self T) -> bool {
54+
*(*self) >= *(*other)
55+
}
56+
#[inline(always)]
57+
fn gt(&self, other: & &'self T) -> bool {
58+
*(*self) > *(*other)
59+
}
60+
}

branches/snap-stage3/src/libstd/core.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ pub mod ascii;
125125
pub mod ptr;
126126
pub mod owned;
127127
pub mod managed;
128+
pub mod borrow;
128129

129130

130131
/* Core language traits */

branches/snap-stage3/src/libstd/prelude.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub use path::PosixPath;
4545
pub use path::WindowsPath;
4646
pub use ptr::Ptr;
4747
pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr};
48-
pub use str::{StrSlice, OwnedStr, StrUtil};
48+
pub use str::{StrVector, StrSlice, OwnedStr, StrUtil};
4949
pub use from_str::{FromStr};
5050
pub use to_bytes::IterBytes;
5151
pub use to_str::{ToStr, ToStrConsume};
@@ -56,7 +56,7 @@ pub use tuple::{CloneableTuple10, CloneableTuple11, CloneableTuple12};
5656
pub use tuple::{ImmutableTuple2, ImmutableTuple3, ImmutableTuple4, ImmutableTuple5};
5757
pub use tuple::{ImmutableTuple6, ImmutableTuple7, ImmutableTuple8, ImmutableTuple9};
5858
pub use tuple::{ImmutableTuple10, ImmutableTuple11, ImmutableTuple12};
59-
pub use vec::{CopyableVector, ImmutableVector};
59+
pub use vec::{VectorVector, CopyableVector, ImmutableVector};
6060
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
6161
pub use vec::{OwnedVector, OwnedCopyableVector, MutableVector};
6262
pub use io::{Reader, ReaderUtil, Writer, WriterUtil};

branches/snap-stage3/src/libstd/ptr.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,6 @@ pub fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T {
255255
thing as *mut T
256256
}
257257

258-
/// Cast a region pointer - &T - to a uint.
259-
#[inline(always)]
260-
pub fn to_uint<T>(thing: &T) -> uint {
261-
thing as *T as uint
262-
}
263-
264-
/// Determine if two borrowed pointers point to the same thing.
265-
#[inline(always)]
266-
pub fn ref_eq<'a,'b,T>(thing: &'a T, other: &'b T) -> bool {
267-
to_uint(thing) == to_uint(other)
268-
}
269-
270258
/**
271259
Given a **T (pointer to an array of pointers),
272260
iterate through each *T, up to the provided `len`,
@@ -411,40 +399,6 @@ impl<T> Ord for *const T {
411399
}
412400
}
413401

414-
// Equality for region pointers
415-
#[cfg(not(test))]
416-
impl<'self,T:Eq> Eq for &'self T {
417-
#[inline(always)]
418-
fn eq(&self, other: & &'self T) -> bool {
419-
*(*self) == *(*other)
420-
}
421-
#[inline(always)]
422-
fn ne(&self, other: & &'self T) -> bool {
423-
*(*self) != *(*other)
424-
}
425-
}
426-
427-
// Comparison for region pointers
428-
#[cfg(not(test))]
429-
impl<'self,T:Ord> Ord for &'self T {
430-
#[inline(always)]
431-
fn lt(&self, other: & &'self T) -> bool {
432-
*(*self) < *(*other)
433-
}
434-
#[inline(always)]
435-
fn le(&self, other: & &'self T) -> bool {
436-
*(*self) <= *(*other)
437-
}
438-
#[inline(always)]
439-
fn ge(&self, other: & &'self T) -> bool {
440-
*(*self) >= *(*other)
441-
}
442-
#[inline(always)]
443-
fn gt(&self, other: & &'self T) -> bool {
444-
*(*self) > *(*other)
445-
}
446-
}
447-
448402
#[cfg(test)]
449403
pub mod ptr_tests {
450404
use super::*;

0 commit comments

Comments
 (0)