Skip to content

Commit b2c74ab

Browse files
committed
add support for running binaries with remote-test-client on run-make
1 parent 9340e5c commit b2c74ab

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/test/run-make-fulldeps/tools.mk

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ endif
4040
# e.g. for `$(CC) -o $(RUN_BINFILE)`.
4141
RUN_BINFILE = $(TMPDIR)/$(1)
4242

43+
# Invoke the generated binary on the remote machine if a test address is
44+
# provided, otherwise run it on the current host.
45+
ifdef TEST_DEVICE_ADDR
46+
# FIXME: if a test requires additional files, this will need to be changed to
47+
# also push them (by changing the 0 to the number of additional files, and
48+
# providing the path of the additional files as the last arguments).
49+
EXECUTE = $(REMOTE_TEST_CLIENT) run 0 $(RUN_BINFILE)
50+
else
51+
EXECUTE = $(RUN_BINFILE)
52+
endif
53+
4354
# RUN and FAIL are basic way we will invoke the generated binary. On
4455
# non-windows platforms, they set the LD_LIBRARY_PATH environment
4556
# variable before running the binary.
@@ -50,16 +61,16 @@ BIN = $(1)
5061
UNAME = $(shell uname)
5162

5263
ifeq ($(UNAME),Darwin)
53-
RUN = $(TARGET_RPATH_ENV) $(RUN_BINFILE)
54-
FAIL = $(TARGET_RPATH_ENV) $(RUN_BINFILE) && exit 1 || exit 0
64+
RUN = $(TARGET_RPATH_ENV) $(EXECUTE)
65+
FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0
5566
DYLIB_GLOB = lib$(1)*.dylib
5667
DYLIB = $(TMPDIR)/lib$(1).dylib
5768
STATICLIB = $(TMPDIR)/lib$(1).a
5869
STATICLIB_GLOB = lib$(1)*.a
5970
else
6071
ifdef IS_WINDOWS
61-
RUN = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(RUN_BINFILE)
62-
FAIL = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(RUN_BINFILE) && exit 1 || exit 0
72+
RUN = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE)
73+
FAIL = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE) && exit 1 || exit 0
6374
DYLIB_GLOB = $(1)*.dll
6475
DYLIB = $(TMPDIR)/$(1).dll
6576
ifdef IS_MSVC
@@ -73,8 +84,8 @@ endif
7384
BIN = $(1).exe
7485
LLVM_FILECHECK := $(shell cygpath -u "$(LLVM_FILECHECK)")
7586
else
76-
RUN = $(TARGET_RPATH_ENV) $(RUN_BINFILE)
77-
FAIL = $(TARGET_RPATH_ENV) $(RUN_BINFILE) && exit 1 || exit 0
87+
RUN = $(TARGET_RPATH_ENV) $(EXECUTE)
88+
FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0
7889
DYLIB_GLOB = lib$(1)*.so
7990
DYLIB = $(TMPDIR)/lib$(1).so
8091
STATICLIB = $(TMPDIR)/lib$(1).a

src/tools/compiletest/src/runtest.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,6 +2987,10 @@ impl<'test> TestCx<'test> {
29872987
cmd.env("LLVM_BIN_DIR", llvm_bin_dir);
29882988
}
29892989

2990+
if let Some(ref remote_test_client) = self.config.remote_test_client {
2991+
cmd.env("REMOTE_TEST_CLIENT", remote_test_client);
2992+
}
2993+
29902994
// We don't want RUSTFLAGS set from the outside to interfere with
29912995
// compiler flags set in the test cases:
29922996
cmd.env_remove("RUSTFLAGS");

0 commit comments

Comments
 (0)