Skip to content

Commit 6f6dd86

Browse files
committed
compiletest: configurable test dir for ARM
1 parent 3afd708 commit 6f6dd86

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

mk/tests.mk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,13 @@ ifeq ($(CFG_ADB_DEVICE),true)
502502
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
503503
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
504504
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
505-
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
506-
--aux-base $$(S)src/test/auxiliary/ \
505+
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
506+
--aux-base $$(S)src/test/auxiliary/ \
507507
--stage-id stage$(1)-$(2) \
508508
--host $(CFG_BUILD_TRIPLE) \
509509
--target $(2) \
510510
--adb-path=$(CFG_ADB_PATH) \
511+
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
511512
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
512513
$$(CTEST_TESTARGS)
513514

@@ -516,7 +517,7 @@ else
516517
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
517518
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
518519
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
519-
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
520+
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
520521
--aux-base $$(S)src/test/auxiliary/ \
521522
--stage-id stage$(1)-$(2) \
522523
--host $(CFG_BUILD_TRIPLE) \

src/compiletest/common.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ pub struct config {
7070
// Target System to be executed
7171
target: ~str,
7272

73-
// Extra parameter to run arm-linux-androideabi
73+
// Extra parameter to run adb on arm-linux-androideabi
7474
adb_path: ~str,
7575

76+
// Extra parameter to run test sute on arm-linux-androideabi
77+
adb_test_dir: ~str,
78+
7679
// check if can be run or not
7780
flag_runnable: bool,
7881

src/compiletest/compiletest.rc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ pub fn parse_config(args: ~[~str]) -> config {
6363
getopts::optflag(~"newrt"),
6464
getopts::optopt(~"host"),
6565
getopts::optopt(~"target"),
66-
getopts::optopt(~"adb-path")
66+
getopts::optopt(~"adb-path"),
67+
getopts::optopt(~"adb-test-dir")
6768
];
6869

6970
assert!(!args.is_empty());
@@ -100,6 +101,7 @@ pub fn parse_config(args: ~[~str]) -> config {
100101
host: opt_str(getopts::opt_maybe_str(matches, ~"host")),
101102
target: opt_str(getopts::opt_maybe_str(matches, ~"target")),
102103
adb_path: opt_str(getopts::opt_maybe_str(matches, ~"adb-path")),
104+
adb_test_dir: opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")),
103105
flag_runnable:
104106
if (getopts::opt_maybe_str(matches, ~"host") ==
105107
getopts::opt_maybe_str(matches, ~"target")) { true }
@@ -136,6 +138,7 @@ pub fn log_config(config: config) {
136138
logv(c, fmt!("host: %s", config.host));
137139
logv(c, fmt!("target: %s", config.target));
138140
logv(c, fmt!("adb_path: %s", config.adb_path));
141+
logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
139142
logv(c, fmt!("flag_runnable: %b", config.flag_runnable));
140143
logv(c, fmt!("verbose: %b", config.verbose));
141144
logv(c, fmt!("\n"));

src/compiletest/runtest.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ fn exec_compiled_test(config: config, props: TestProps,
512512

513513
// copy to target
514514
let copy_result = procsrv::run(~"", config.adb_path,
515-
~[~"push", args.prog, ~"/system/tmp"],
515+
~[~"push", args.prog, config.adb_test_dir],
516516
~[(~"",~"")], Some(~""));
517517

518518
if config.verbose {
@@ -534,16 +534,13 @@ fn exec_compiled_test(config: config, props: TestProps,
534534

535535
let mut newcmd_out = ~"";
536536
let mut newcmd_err = ~"";
537-
newcmd_out.push_str(~"LD_LIBRARY_PATH=/system/tmp; ");
538-
newcmd_err.push_str(~"LD_LIBRARY_PATH=/system/tmp; ");
539-
newcmd_out.push_str(~"export LD_LIBRARY_PATH; ");
540-
newcmd_err.push_str(~"export LD_LIBRARY_PATH; ");
541-
newcmd_out.push_str(~"cd /system/tmp; ");
542-
newcmd_err.push_str(~"cd /system/tmp; ");
543-
newcmd_out.push_str("./");
544-
newcmd_err.push_str("./");
545-
newcmd_out.push_str(prog_short);
546-
newcmd_err.push_str(prog_short);
537+
newcmd_out.push_str(fmt!(
538+
"LD_LIBRARY_PATH=%s; export LD_LIBRARY_PATH; cd %s; ./%s",
539+
config.adb_test_dir, config.adb_test_dir, prog_short));
540+
541+
newcmd_err.push_str(fmt!(
542+
"LD_LIBRARY_PATH=%s; export LD_LIBRARY_PATH; cd %s; ./%s",
543+
config.adb_test_dir, config.adb_test_dir, prog_short));
547544

548545
for vec::each(subargs) |tv| {
549546
newcmd_out.push_str(" ");
@@ -617,7 +614,7 @@ fn compose_and_run_compiler(
617614
if (file.filetype() == Some(~".so")) {
618615

619616
let copy_result = procsrv::run(~"", config.adb_path,
620-
~[~"push", file.to_str(), ~"/system/tmp"],
617+
~[~"push", file.to_str(), config.adb_test_dir],
621618
~[(~"",~"")], Some(~""));
622619

623620
if config.verbose {

0 commit comments

Comments
 (0)