about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-09-17 14:09:51 +0900
committerGitHub <noreply@github.com>2021-09-17 14:09:51 +0900
commit4d5bcbe957fa2f9b47aba81484d47206de742f3d (patch)
treebdf47d683a7b5bdf12486a1d5986f1d5a7d09da9
parent3cff47b608d68db3b59fd0cb8e8d34052f04dbff (diff)
parent67edf94416cdb8cef46360cd284efc358736d689 (diff)
downloadrust-4d5bcbe957fa2f9b47aba81484d47206de742f3d.tar.gz
rust-4d5bcbe957fa2f9b47aba81484d47206de742f3d.zip
Rollup merge of #89033 - cuviper:sysroot-lib-path, r=Mark-Simulacrum
Set the library path in sysroot-crates-are-unstable

Most of the `run-make-fulldeps` tests use a make-driven rustc command
that includes `HOST_RPATH_DIR` in the library path, but this particular
test runs from python instead. When the toolchain is built without
`rpath` enabled, we need that library path in the environment so it can
find its own libraries.
-rw-r--r--src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py
index f479bdabb9c..cb77eb34fef 100644
--- a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py
+++ b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py
@@ -17,6 +17,17 @@ def convert_to_string(s):
     return s
 
 
+def set_ld_lib_path():
+    var = os.environ.get("LD_LIB_PATH_ENVVAR")
+    rpath = os.environ.get("HOST_RPATH_DIR")
+    if var and rpath:
+        path = os.environ.get(var)
+        if path:
+            os.environ[var] = rpath + os.pathsep + path
+        else:
+            os.environ[var] = rpath
+
+
 def exec_command(command, to_input=None):
     child = None
     if to_input is None:
@@ -50,7 +61,9 @@ def get_all_libs(dir_path):
             if isfile(join(dir_path, f)) and f.endswith('.rlib') and f not in STABLE_CRATES]
 
 
+set_ld_lib_path()
 sysroot = exec_command([os.environ['RUSTC'], '--print', 'sysroot'])[0].replace('\n', '')
+assert sysroot, "Could not read the rustc sysroot!"
 libs = get_all_libs(join(sysroot, 'lib/rustlib/{}/lib'.format(os.environ['TARGET'])))
 
 ret = 0