about summary refs log tree commit diff
path: root/src/ci/docker/scripts
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-16 12:14:19 +0000
committerbors <bors@rust-lang.org>2024-10-16 12:14:19 +0000
commit0037048da8ed19feef7ee1437f123a88a7342b33 (patch)
tree9fd7bbde8810dca534b21abc753438f4ba9bbb71 /src/ci/docker/scripts
parentd829780c4e4ef11f5e09c1c5ed9684c12aad7236 (diff)
parente0e1e35a48202e5d73151cfb7bc4208adfce0856 (diff)
downloadrust-0037048da8ed19feef7ee1437f123a88a7342b33.tar.gz
rust-0037048da8ed19feef7ee1437f123a88a7342b33.zip
Auto merge of #131775 - Urgau:rollup-yc4a3sf, r=Urgau
Rollup of 10 pull requests

Successful merges:

 - #131582 (Add wasm32-unknown-emscripten platform support document)
 - #131694 (Make fuchsia-test-runner.py compatible with new JSON output from llvm-readelf)
 - #131700 (Fix match_same_arms in stable_mir)
 - #131712 (Mark the unstable LazyCell::into_inner const)
 - #131746 (Relax a memory order in `once_box`)
 - #131754 (Don't report bivariance error when nesting a struct with field errors into another struct)
 - #131760 (llvm: Match aarch64 data layout to new LLVM layout)
 - #131764 (Fix unnecessary nesting in run-make test output directories)
 - #131766 (Add mailmap entry for my dev-desktop setup)
 - #131771 (Handle gracefully true/false in `cfg(target(..))` compact)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/ci/docker/scripts')
-rwxr-xr-xsrc/ci/docker/scripts/fuchsia-test-runner.py42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/ci/docker/scripts/fuchsia-test-runner.py b/src/ci/docker/scripts/fuchsia-test-runner.py
index a5458b8645d..1aa9a4a1794 100755
--- a/src/ci/docker/scripts/fuchsia-test-runner.py
+++ b/src/ci/docker/scripts/fuchsia-test-runner.py
@@ -193,18 +193,38 @@ class TestEnvironment:
             stderr=subprocess.STDOUT,
         )
         if process.returncode:
-            self.env_logger.error(
-                f"llvm-readelf failed for binary {binary} with output {process.stdout}"
+            e = f"llvm-readelf failed for binary {binary} with output {process.stdout}"
+            self.env_logger.error(e)
+            raise Exception(e)
+
+        try:
+            elf_output = json.loads(process.stdout)
+        except Exception as e:
+            e.add_note(f"Failed to read JSON from llvm-readelf for binary {binary}")
+            e.add_note(f"stdout: {process.stdout}")
+            raise
+
+        try:
+            note_sections = elf_output[0]["NoteSections"]
+        except Exception as e:
+            e.add_note(
+                f'Failed to read "NoteSections" from llvm-readelf for binary {binary}'
             )
-            raise Exception(f"Unreadable build-id for binary {binary}")
-        data = json.loads(process.stdout)
-        if len(data) != 1:
-            raise Exception(f"Unreadable output from llvm-readelf for binary {binary}")
-        notes = data[0]["Notes"]
-        for note in notes:
-            note_section = note["NoteSection"]
-            if note_section["Name"] == ".note.gnu.build-id":
-                return note_section["Note"]["Build ID"]
+            e.add_note(f"elf_output: {elf_output}")
+            raise
+
+        for entry in note_sections:
+            try:
+                note_section = entry["NoteSection"]
+                if note_section["Name"] == ".note.gnu.build-id":
+                    return note_section["Notes"][0]["Build ID"]
+            except Exception as e:
+                e.add_note(
+                    f'Failed to read ".note.gnu.build-id" from NoteSections \
+                        entry in llvm-readelf for binary {binary}'
+                )
+                e.add_note(f"NoteSections: {note_sections}")
+                raise
         raise Exception(f"Build ID not found for binary {binary}")
 
     def generate_buildid_dir(