Skip to content

Commit d89b98a

Browse files
committed
run-make tests must distinguish between HOST_RPATH and TARGET_RPATH.
What this commit does: * Pass both of the (newly introduced) HOST and TARGET rpath setup vars to `maketest.py` * Update `maketest.py` to no longer update the LD_LIBRARY_PATH itself Instead, it passes along the HOST and TARGET rpath setup vars in environment variables `HOST_RPATH_ENV` and `TARGET_RPATH_ENV` * Cleanup: Distinguish in tools.mk between the command to run (`RUN`) and the file to generate to drive that command (`RUN_BINFILE`). The main thing this enables is that `RUN` can now setup the `TARGET_RPATH_ENV` without having to dirty up the runner code in each of the `run-make` Makefiles. I should have tried to fix rust-lang#13746 but I got distracted, and decided fixing that is orthgonal to the changes in this branch of work. Note that even with these changes, `make check-stage1` still does not work all the way to completion. (It just gets further than it did before, but still breaks down in the `run-make` tests.)
1 parent 2b267b1 commit d89b98a

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

mk/tests.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
908908
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
909909
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
910910
"$$(TESTNAME)" \
911-
"$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
911+
"$$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))" \
912+
"$$(TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3))"
912913
@touch $$@
913914
else
914915
# FIXME #11094 - The above rule doesn't work right for multiple targets

src/etc/maketest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
os.putenv('CC', sys.argv[5])
2424
os.putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
2525
filt = sys.argv[7]
26-
ldpath = sys.argv[8]
27-
if ldpath != '':
28-
os.putenv(ldpath.split('=')[0], ldpath.split('=')[1])
26+
os.putenv('HOST_RPATH_ENV', sys.argv[8]);
27+
host_ldpath = sys.argv[8]
28+
#if host_ldpath != '':
29+
# os.putenv(host_ldpath.split('=')[0], host_ldpath.split('=')[1])
30+
os.putenv('TARGET_RPATH_ENV', sys.argv[9]);
2931

3032
if not filt in sys.argv[1]:
3133
sys.exit(0)

src/test/run-make/bootstrap-from-c-with-green/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
all:
44
$(RUSTC) lib.rs
55
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
6-
$(CC) main.c -o $(call RUN,main) -lboot
6+
$(CC) main.c -o $(call RUN_BINFILE,main) -lboot
77
$(call RUN,main)
88
rm $(call DYLIB,boot)
99
$(call FAIL,main)

src/test/run-make/bootstrap-from-c-with-native/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
all:
44
$(RUSTC) lib.rs
55
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
6-
$(CC) main.c -o $(call RUN,main) -lboot
6+
$(CC) main.c -o $(call RUN_BINFILE,main) -lboot
77
$(call RUN,main)
88
rm $(call DYLIB,boot)
99
$(call FAIL,main)

src/test/run-make/c-link-to-rust-dylib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
all:
44
$(RUSTC) foo.rs
55
ln -s $(call DYLIB,foo-*) $(call DYLIB,foo)
6-
$(CC) bar.c -lfoo -o $(call RUN,bar) -Wl,-rpath,$(TMPDIR)
6+
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) -Wl,-rpath,$(TMPDIR)
77
$(call RUN,bar)
88
rm $(call DYLIB,foo)
99
$(call FAIL,bar)

src/test/run-make/c-link-to-rust-staticlib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ifneq ($(shell uname),FreeBSD)
99
all:
1010
$(RUSTC) foo.rs
1111
ln -s $(call STATICLIB,foo-*) $(call STATICLIB,foo)
12-
$(CC) bar.c -lfoo -o $(call RUN,bar) $(EXTRAFLAGS) -lstdc++
12+
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) $(EXTRAFLAGS) -lstdc++
1313
$(call RUN,bar)
1414
rm $(call STATICLIB,foo*)
1515
$(call RUN,bar)

src/test/run-make/lto-smoke-c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ CC := $(CC:-g=)
1515
all:
1616
$(RUSTC) foo.rs -Z lto
1717
ln -s $(call STATICLIB,foo-*) $(call STATICLIB,foo)
18-
$(CC) bar.c -lfoo -o $(call RUN,bar) $(EXTRAFLAGS) -lstdc++
18+
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) $(EXTRAFLAGS) -lstdc++
1919
$(call RUN,bar)

src/test/run-make/tools.mk

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ export DYLD_LIBRARY_PATH:=$(TMPDIR):$(DYLD_LIBRARY_PATH)
44
RUSTC := $(RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR)
55
CC := $(CC) -L $(TMPDIR)
66

7-
RUN = $(TMPDIR)/$(1)
8-
FAILS = $(TMPDIR)/$(1) && exit 1 || exit 0
7+
# This is the name of the binary we will generate and run; use this
8+
# e.g. for `$(CC) -o $(RUN_BINFILE)`.
9+
RUN_BINFILE = $(TMPDIR)/$(1)
10+
# This the basic way we will invoke the generated binary. It sets the
11+
# LD_LIBRARY_PATH environment variable before running the binary.
12+
RUN = $(TARGET_RPATH_ENV) $(RUN_BINFILE)
13+
FAILS = $(TARGET_RPATH_ENV) ( $(RUN_BINFILE) && exit 1 || exit 0 )
914

1015
RLIB_GLOB = lib$(1)*.rlib
1116
STATICLIB = $(TMPDIR)/lib$(1).a

0 commit comments

Comments
 (0)