Skip to content

Commit fe1e456

Browse files
committed
---
yaml --- r: 140641 b: refs/heads/try2 c: 7a4c6e5 h: refs/heads/master i: 140639: 594a443 v: v3
1 parent 8f956a3 commit fe1e456

File tree

487 files changed

+20242
-8543
lines changed

Some content is hidden

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

487 files changed

+20242
-8543
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 1b4e375046be94629dd537993dbb28896aa2ff66
8+
refs/heads/try2: 7a4c6e587d631c0316d51c9b4a50d406f38221cd
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ endif
101101

102102
ifdef CFG_ENABLE_DEBUG
103103
$(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
104-
CFG_RUSTC_FLAGS +=
104+
CFG_RUSTC_FLAGS += --cfg debug
105105
CFG_GCCISH_CFLAGS += -DRUST_DEBUG
106106
else
107107
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
@@ -110,6 +110,9 @@ endif
110110
ifdef SAVE_TEMPS
111111
CFG_RUSTC_FLAGS += --save-temps
112112
endif
113+
ifdef ASM_COMMENTS
114+
CFG_RUSTC_FLAGS += -z asm-comments
115+
endif
113116
ifdef TIME_PASSES
114117
CFG_RUSTC_FLAGS += -Z time-passes
115118
endif

branches/try2/configure

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ then
439439
probe CFG_ZCAT zcat
440440
fi
441441

442+
step_msg "looking for target specific programs"
443+
444+
probe CFG_ADB adb
445+
442446
if [ ! -z "$CFG_PANDOC" ]
443447
then
444448
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc ' |

branches/try2/doc/tutorial-ffi.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub struct Unique<T> {
157157
priv ptr: *mut T
158158
}
159159
160-
pub impl<'self, T: Owned> Unique<T> {
160+
pub impl<T: Owned> Unique<T> {
161161
fn new(value: T) -> Unique<T> {
162162
unsafe {
163163
let ptr = malloc(core::sys::size_of::<T>() as size_t) as *mut T;
@@ -168,14 +168,14 @@ pub impl<'self, T: Owned> Unique<T> {
168168
}
169169
}
170170
171-
// the 'self lifetime results in the same semantics as `&*x` with ~T
172-
fn borrow(&self) -> &'self T {
173-
unsafe { cast::transmute(self.ptr) }
171+
// the 'r lifetime results in the same semantics as `&*x` with ~T
172+
fn borrow<'r>(&'r self) -> &'r T {
173+
unsafe { cast::copy_lifetime(self, &*self.ptr) }
174174
}
175175
176-
// the 'self lifetime results in the same semantics as `&mut *x` with ~T
177-
fn borrow_mut(&mut self) -> &'self mut T {
178-
unsafe { cast::transmute(self.ptr) }
176+
// the 'r lifetime results in the same semantics as `&mut *x` with ~T
177+
fn borrow_mut<'r>(&'r mut self) -> &'r mut T {
178+
unsafe { cast::copy_mut_lifetime(self, &mut *self.ptr) }
179179
}
180180
}
181181

branches/try2/mk/host.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ $$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
130130
$$(HBIN$(2)_H_$(4))/:
131131
mkdir -p $$@
132132

133+
ifneq ($(CFG_LIBDIR),bin)
133134
$$(HLIB$(2)_H_$(4))/:
134135
mkdir -p $$@
136+
endif
135137

136138
endef
137139

branches/try2/mk/install.mk

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,76 @@ uninstall:
154154
done
155155
$(Q)rm -Rf $(PHL)/rustc
156156
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rustc.1
157+
158+
# target platform specific variables
159+
# for arm-linux-androidabi
160+
define DEF_ADB_DEVICE_STATUS
161+
CFG_ADB_DEVICE_STATUS=$(1)
162+
endef
163+
164+
$(foreach target,$(CFG_TARGET_TRIPLES), \
165+
$(if $(findstring $(target),"arm-linux-androideabi"), \
166+
$(if $(findstring adb,$(CFG_ADB)), \
167+
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
168+
$(info install: install-runtime-target for $(target) enabled \
169+
$(info install: android device attached) \
170+
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
171+
$(info install: install-runtime-target for $(target) disabled \
172+
$(info install: android device not attached) \
173+
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
174+
), \
175+
$(info install: install-runtime-target for $(target) disabled \
176+
$(info install: adb not found) \
177+
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
178+
), \
179+
) \
180+
)
181+
182+
ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
183+
$(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
184+
L_TOKEN := $(word 2,$(MAKECMDGOALS))
185+
ifeq ($(L_TOKEN),)
186+
CFG_RUNTIME_PUSH_DIR=/system/lib
187+
else
188+
CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
189+
endif
190+
191+
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
192+
ifdef VERBOSE
193+
ADB = adb $(1)
194+
ADB_PUSH = adb push $(1) $(2)
195+
ADB_SHELL = adb shell $(1) $(2)
196+
else
197+
ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
198+
ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
199+
ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
200+
endif
201+
202+
define INSTALL_RUNTIME_TARGET_N
203+
install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
204+
$(Q)$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
205+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CFG_RUNTIME_$(1)),$(CFG_RUNTIME_PUSH_DIR))
206+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CORELIB_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR))
207+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(STDLIB_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR))
208+
endef
209+
210+
define INSTALL_RUNTIME_TARGET_CLEANUP_N
211+
install-runtime-target-$(1)-cleanup:
212+
$(Q)$(call ADB,remount)
213+
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(CFG_RUNTIME_$(1)))
214+
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(CORELIB_GLOB_$(1)))
215+
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(STDLIB_GLOB_$(1)))
216+
endef
217+
218+
$(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD_TRIPLE)))
219+
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
220+
221+
install-runtime-target: \
222+
install-runtime-target-arm-linux-androideabi-cleanup \
223+
install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD_TRIPLE)
224+
else
225+
install-runtime-target:
226+
@echo "No device to install runtime library"
227+
@echo
228+
endif
229+
endif

branches/try2/mk/rt.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ endif
163163
ifdef CFG_WINDOWSY_$(1)
164164
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
165165
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
166-
CFLAGS="$$(CFG_GCCISH_CFLAGS)" \
167-
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS)" \
168166
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
169167
OS=mingw \
170168
V=$$(VERBOSE)

branches/try2/mk/target.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ endif
8686
$$(TBIN$(1)_T_$(2)_H_$(3))/:
8787
mkdir -p $$@
8888

89+
ifneq ($(CFG_LIBDIR),bin)
8990
$$(TLIB$(1)_T_$(2)_H_$(3))/:
9091
mkdir -p $$@
92+
endif
9193

9294
endef
9395

branches/try2/mk/tests.mk

Lines changed: 87 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,43 @@ endef
9292
$(foreach target,$(CFG_TARGET_TRIPLES), \
9393
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
9494

95+
# Target platform specific variables
96+
# for arm-linux-androidabi
97+
define DEF_ADB_DEVICE_STATUS
98+
CFG_ADB_DEVICE_STATUS=$(1)
99+
endef
100+
101+
$(foreach target,$(CFG_TARGET_TRIPLES), \
102+
$(if $(findstring $(target),"arm-linux-androideabi"), \
103+
$(if $(findstring adb,$(CFG_ADB)), \
104+
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
105+
$(info check: $(target) test enabled \
106+
$(info check: android device attached) \
107+
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
108+
$(info check: $(target) test disabled \
109+
$(info check: android device not attached) \
110+
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
111+
), \
112+
$(info check: $(target) test disabled \
113+
$(info check: adb not found) \
114+
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
115+
), \
116+
) \
117+
)
118+
119+
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
120+
CFG_ADB_TEST_DIR=/data/tmp
121+
122+
$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
123+
$(shell adb remount 1>/dev/null) \
124+
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
125+
$(shell adb push $(CFG_ANDROID_CROSS_PATH)/arm-linux-androideabi/lib/armv7-a/libgnustl_shared.so \
126+
$(CFG_ADB_TEST_DIR) 1>/dev/null) \
127+
)
128+
else
129+
CFG_ADB_TEST_DIR=
130+
endif
131+
95132

96133
######################################################################
97134
# Main test targets
@@ -319,11 +356,53 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
319356
&& touch $$@
320357
endef
321358

359+
define DEF_TEST_CRATE_RULES_arm-linux-androideabi
360+
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
361+
362+
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
363+
$(3)/test/$(4)test.stage$(1)-$(2)$$(X_$(2))
364+
@$$(call E, run: $$< via adb)
365+
@$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
366+
@$(CFG_ADB) shell LD_LIBRARY_PATH=$(CFG_ADB_TEST_DIR) \
367+
$(CFG_ADB_TEST_DIR)/`echo $$< | sed 's/.*\///'` \
368+
--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log > \
369+
tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
370+
@cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
371+
@touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
372+
@$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
373+
@$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
374+
@if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
375+
then \
376+
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
377+
touch $$@; \
378+
else \
379+
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
380+
exit 101; \
381+
fi
382+
endef
383+
384+
define DEF_TEST_CRATE_RULES_null
385+
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
386+
387+
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
388+
$(3)/test/$(4)test.stage$(1)-$(2)$$(X_$(2))
389+
@$$(call E, run: skipped $$< )
390+
@touch $$@
391+
endef
392+
322393
$(foreach host,$(CFG_HOST_TRIPLES), \
323394
$(foreach target,$(CFG_TARGET_TRIPLES), \
324395
$(foreach stage,$(STAGES), \
325396
$(foreach crate, $(TEST_CRATES), \
326-
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate)))))))
397+
$(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
398+
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
399+
$(if $(findstring $(target),"arm-linux-androideabi"), \
400+
$(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
401+
$(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
402+
$(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
403+
), \
404+
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
405+
))))))
327406

328407

329408
######################################################################
@@ -420,6 +499,9 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
420499
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
421500
--aux-base $$(S)src/test/auxiliary/ \
422501
--stage-id stage$(1)-$(2) \
502+
--target $(2) \
503+
--adb-path=$(CFG_ADB) \
504+
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
423505
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
424506
$$(CTEST_TESTARGS)
425507

@@ -454,7 +536,7 @@ ifeq ($$(CTEST_DISABLE_$(4)),)
454536
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
455537
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
456538
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
457-
@$$(call E, run $(4): $$<)
539+
@$$(call E, run $(4) [$(2)]: $$<)
458540
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
459541
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
460542
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
@@ -465,7 +547,7 @@ else
465547
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
466548
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
467549
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
468-
@$$(call E, run $(4): $$<)
550+
@$$(call E, run $(4) [$(2)]: $$<)
469551
@$$(call E, warning: tests disabled: $$(CTEST_DISABLE_$(4)))
470552
touch $$@
471553

@@ -506,7 +588,7 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
506588
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
507589
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
508590
$$(PRETTY_DEPS_$(4))
509-
@$$(call E, run pretty-rpass: $$<)
591+
@$$(call E, run pretty-rpass [$(2)]: $$<)
510592
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
511593
$$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
512594
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
@@ -533,7 +615,7 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3)
533615
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): \
534616
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
535617
doc-$(4)-extract$(3)
536-
@$$(call E, run doc-$(4): $$<)
618+
@$$(call E, run doc-$(4) [$(2)]: $$<)
537619
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
538620
$$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4)) \
539621
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),doc-$(4)) \

branches/try2/src/compiletest/common.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ pub struct config {
6464
// Run tests using the new runtime
6565
newrt: bool,
6666

67+
// Target system to be tested
68+
target: ~str,
69+
70+
// Extra parameter to run adb on arm-linux-androideabi
71+
adb_path: ~str,
72+
73+
// Extra parameter to run test sute on arm-linux-androideabi
74+
adb_test_dir: ~str,
75+
76+
// status whether android device available or not
77+
adb_device_status: bool,
78+
6779
// Explain what's going on
6880
verbose: bool
6981

branches/try2/src/compiletest/compiletest.rc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ pub fn parse_config(args: ~[~str]) -> config {
6060
getopts::optflag(~"verbose"),
6161
getopts::optopt(~"logfile"),
6262
getopts::optflag(~"jit"),
63-
getopts::optflag(~"newrt")];
63+
getopts::optflag(~"newrt"),
64+
getopts::optopt(~"target"),
65+
getopts::optopt(~"adb-path"),
66+
getopts::optopt(~"adb-test-dir")
67+
];
6468

6569
assert!(!args.is_empty());
6670
let args_ = vec::tail(args);
@@ -93,6 +97,18 @@ pub fn parse_config(args: ~[~str]) -> config {
9397
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
9498
jit: getopts::opt_present(matches, ~"jit"),
9599
newrt: getopts::opt_present(matches, ~"newrt"),
100+
target: opt_str(getopts::opt_maybe_str(matches, ~"target")),
101+
adb_path: opt_str(getopts::opt_maybe_str(matches, ~"adb-path")),
102+
adb_test_dir: opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")),
103+
adb_device_status:
104+
if (opt_str(getopts::opt_maybe_str(matches, ~"target")) ==
105+
~"arm-linux-androideabi") {
106+
if (opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
107+
~"(none)" &&
108+
opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
109+
~"") { true }
110+
else { false }
111+
} else { false },
96112
verbose: getopts::opt_present(matches, ~"verbose")
97113
}
98114
}
@@ -113,6 +129,10 @@ pub fn log_config(config: config) {
113129
logv(c, fmt!("rustcflags: %s", opt_str(config.rustcflags)));
114130
logv(c, fmt!("jit: %b", config.jit));
115131
logv(c, fmt!("newrt: %b", config.newrt));
132+
logv(c, fmt!("target: %s", config.target));
133+
logv(c, fmt!("adb_path: %s", config.adb_path));
134+
logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
135+
logv(c, fmt!("adb_device_status: %b", config.adb_device_status));
116136
logv(c, fmt!("verbose: %b", config.verbose));
117137
logv(c, fmt!("\n"));
118138
}

0 commit comments

Comments
 (0)