about summary refs log tree commit diff
path: root/src/ci/docker
diff options
context:
space:
mode:
authorTshepang Mbambo <hopsi@tuta.io>2025-07-28 08:45:28 +0200
committerGitHub <noreply@github.com>2025-07-28 08:45:28 +0200
commit466198cfaf2ea988a98aee08df10ed1198a3874a (patch)
treee9c9a7f48ae84ba9e277f06252ebdfbe076694e9 /src/ci/docker
parent9c99623b8ade68ae07a6226018732f2512526d34 (diff)
parent645b85e3d508123d45d79dc6e526a06648666c68 (diff)
downloadrust-466198cfaf2ea988a98aee08df10ed1198a3874a.tar.gz
rust-466198cfaf2ea988a98aee08df10ed1198a3874a.zip
Merge pull request #2519 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'src/ci/docker')
-rw-r--r--src/ci/docker/host-x86_64/pr-check-1/Dockerfile1
-rw-r--r--src/ci/docker/host-x86_64/test-various/Dockerfile5
-rw-r--r--src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock16
-rw-r--r--src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.toml10
-rwxr-xr-xsrc/ci/docker/host-x86_64/test-various/uefi_qemu_test/run.py140
-rw-r--r--src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs46
6 files changed, 4 insertions, 214 deletions
diff --git a/src/ci/docker/host-x86_64/pr-check-1/Dockerfile b/src/ci/docker/host-x86_64/pr-check-1/Dockerfile
index d3c3cd1b63e..f7d51fba861 100644
--- a/src/ci/docker/host-x86_64/pr-check-1/Dockerfile
+++ b/src/ci/docker/host-x86_64/pr-check-1/Dockerfile
@@ -40,6 +40,7 @@ COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/
 # We disable optimized compiler built-ins because that requires a C toolchain for the target.
 # We also skip the x86_64-unknown-linux-gnu target as it is well-tested by other jobs.
 ENV SCRIPT \
+  python3 ../x.py check bootstrap && \
   /scripts/check-default-config-profiles.sh && \
   python3 ../x.py build src/tools/build-manifest && \
   python3 ../x.py test --stage 0 src/tools/compiletest && \
diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile
index 4d09bea69c0..662a26400ce 100644
--- a/src/ci/docker/host-x86_64/test-various/Dockerfile
+++ b/src/ci/docker/host-x86_64/test-various/Dockerfile
@@ -79,7 +79,6 @@ ENV MUSL_TARGETS=x86_64-unknown-linux-musl \
     CXX_x86_64_unknown_linux_musl=x86_64-linux-musl-g++
 ENV MUSL_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $MUSL_TARGETS
 
-COPY host-x86_64/test-various/uefi_qemu_test /uefi_qemu_test
 ENV UEFI_TARGETS=aarch64-unknown-uefi,i686-unknown-uefi,x86_64-unknown-uefi \
     CC_aarch64_unknown_uefi=clang-11 \
     CXX_aarch64_unknown_uefi=clang++-11 \
@@ -88,6 +87,8 @@ ENV UEFI_TARGETS=aarch64-unknown-uefi,i686-unknown-uefi,x86_64-unknown-uefi \
     CC_x86_64_unknown_uefi=clang-11 \
     CXX_x86_64_unknown_uefi=clang++-11
 ENV UEFI_SCRIPT python3 /checkout/x.py --stage 2 build --host='' --target $UEFI_TARGETS && \
-  python3 -u /uefi_qemu_test/run.py
+  python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target aarch64-unknown-uefi && \
+  python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target i686-unknown-uefi && \
+  python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target x86_64-unknown-uefi
 
 ENV SCRIPT $WASM_SCRIPT && $NVPTX_SCRIPT && $MUSL_SCRIPT && $UEFI_SCRIPT
diff --git a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock
deleted file mode 100644
index 8b6a664ad93..00000000000
--- a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock
+++ /dev/null
@@ -1,16 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 4
-
-[[package]]
-name = "r-efi"
-version = "5.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
-
-[[package]]
-name = "uefi_qemu_test"
-version = "0.0.0"
-dependencies = [
- "r-efi",
-]
diff --git a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.toml b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.toml
deleted file mode 100644
index 1a8d0d94368..00000000000
--- a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.toml
+++ /dev/null
@@ -1,10 +0,0 @@
-[package]
-name = "uefi_qemu_test"
-version = "0.0.0"
-edition = "2021"
-
-[workspace]
-resolver = "2"
-
-[dependencies]
-r-efi = "5.2.0"
diff --git a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/run.py b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/run.py
deleted file mode 100755
index 4f877389fbc..00000000000
--- a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/run.py
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import shutil
-import subprocess
-import sys
-import tempfile
-
-from pathlib import Path
-
-TARGET_AARCH64 = "aarch64-unknown-uefi"
-TARGET_I686 = "i686-unknown-uefi"
-TARGET_X86_64 = "x86_64-unknown-uefi"
-
-
-def run(*cmd, capture=False, check=True, env=None, timeout=None):
-    """Print and run a command, optionally capturing the output."""
-    cmd = [str(p) for p in cmd]
-    print(" ".join(cmd))
-    return subprocess.run(
-        cmd, capture_output=capture, check=check, env=env, text=True, timeout=timeout
-    )
-
-
-def build_and_run(tmp_dir, target):
-    if target == TARGET_AARCH64:
-        boot_file_name = "bootaa64.efi"
-        ovmf_dir = Path("/usr/share/AAVMF")
-        ovmf_code = "AAVMF_CODE.fd"
-        ovmf_vars = "AAVMF_VARS.fd"
-        qemu = "qemu-system-aarch64"
-        machine = "virt"
-        cpu = "cortex-a72"
-    elif target == TARGET_I686:
-        boot_file_name = "bootia32.efi"
-        ovmf_dir = Path("/usr/share/OVMF")
-        ovmf_code = "OVMF32_CODE_4M.secboot.fd"
-        ovmf_vars = "OVMF32_VARS_4M.fd"
-        # The i686 target intentionally uses 64-bit qemu; the important
-        # difference is that the OVMF code provides a 32-bit environment.
-        qemu = "qemu-system-x86_64"
-        machine = "q35"
-        cpu = "qemu64"
-    elif target == TARGET_X86_64:
-        boot_file_name = "bootx64.efi"
-        ovmf_dir = Path("/usr/share/OVMF")
-        ovmf_code = "OVMF_CODE.fd"
-        ovmf_vars = "OVMF_VARS.fd"
-        qemu = "qemu-system-x86_64"
-        machine = "q35"
-        cpu = "qemu64"
-    else:
-        raise KeyError("invalid target")
-
-    host_artifacts = Path("/checkout/obj/build/x86_64-unknown-linux-gnu")
-    stage0 = host_artifacts / "stage0/bin"
-    stage2 = host_artifacts / "stage2/bin"
-
-    env = dict(os.environ)
-    env["PATH"] = "{}:{}:{}".format(stage2, stage0, env["PATH"])
-
-    # Copy the test create into `tmp_dir`.
-    test_crate = Path(tmp_dir) / "uefi_qemu_test"
-    shutil.copytree("/uefi_qemu_test", test_crate)
-
-    # Build the UEFI executable.
-    run(
-        "cargo",
-        "build",
-        "--manifest-path",
-        test_crate / "Cargo.toml",
-        "--target",
-        target,
-        env=env,
-    )
-
-    # Create a mock EFI System Partition in a subdirectory.
-    esp = test_crate / "esp"
-    boot = esp / "efi/boot"
-    os.makedirs(boot, exist_ok=True)
-
-    # Copy the executable into the ESP.
-    src_exe_path = test_crate / "target" / target / "debug/uefi_qemu_test.efi"
-    shutil.copy(src_exe_path, boot / boot_file_name)
-    print(src_exe_path, boot / boot_file_name)
-
-    # Select the appropriate EDK2 build.
-    ovmf_code = ovmf_dir / ovmf_code
-    ovmf_vars = ovmf_dir / ovmf_vars
-
-    # Make a writable copy of the vars file. aarch64 doesn't boot
-    # correctly with read-only vars.
-    ovmf_rw_vars = Path(tmp_dir) / "vars.fd"
-    shutil.copy(ovmf_vars, ovmf_rw_vars)
-
-    # Run the executable in QEMU and capture the output.
-    output = run(
-        qemu,
-        "-machine",
-        machine,
-        "-cpu",
-        cpu,
-        "-display",
-        "none",
-        "-serial",
-        "stdio",
-        "-drive",
-        f"if=pflash,format=raw,readonly=on,file={ovmf_code}",
-        "-drive",
-        f"if=pflash,format=raw,readonly=off,file={ovmf_rw_vars}",
-        "-drive",
-        f"format=raw,file=fat:rw:{esp}",
-        capture=True,
-        check=True,
-        # Set a timeout to kill the VM in case something goes wrong.
-        timeout=60,
-    ).stdout
-
-    if "Hello World!" in output:
-        print("VM produced expected output")
-    else:
-        print("unexpected VM output:")
-        print("---start---")
-        print(output)
-        print("---end---")
-        sys.exit(1)
-
-
-def main():
-    targets = [TARGET_AARCH64, TARGET_I686, TARGET_X86_64]
-
-    for target in targets:
-        # Create a temporary directory so that we have a writeable
-        # workspace.
-        with tempfile.TemporaryDirectory() as tmp_dir:
-            build_and_run(tmp_dir, target)
-
-
-if __name__ == "__main__":
-    main()
diff --git a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs
deleted file mode 100644
index 89e4393cb5c..00000000000
--- a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-// Code is adapted from this hello world example:
-// https://doc.rust-lang.org/nightly/rustc/platform-support/unknown-uefi.html
-
-#![no_main]
-#![no_std]
-
-use core::{panic, ptr};
-
-use r_efi::efi::{Char16, Handle, RESET_SHUTDOWN, Status, SystemTable};
-
-#[panic_handler]
-fn panic_handler(_info: &panic::PanicInfo) -> ! {
-    loop {}
-}
-
-#[export_name = "efi_main"]
-pub extern "C" fn main(_h: Handle, st: *mut SystemTable) -> Status {
-    let s = [
-        0x0048u16, 0x0065u16, 0x006cu16, 0x006cu16, 0x006fu16, // "Hello"
-        0x0020u16, //                                             " "
-        0x0057u16, 0x006fu16, 0x0072u16, 0x006cu16, 0x0064u16, // "World"
-        0x0021u16, //                                             "!"
-        0x000au16, //                                             "\n"
-        0x0000u16, //                                             NUL
-    ];
-
-    // Print "Hello World!".
-    let r = unsafe { ((*(*st).con_out).output_string)((*st).con_out, s.as_ptr() as *mut Char16) };
-    if r.is_error() {
-        return r;
-    }
-
-    // Shut down.
-    unsafe {
-        ((*((*st).runtime_services)).reset_system)(
-            RESET_SHUTDOWN,
-            Status::SUCCESS,
-            0,
-            ptr::null_mut(),
-        );
-    }
-
-    // This should never be reached because `reset_system` should never
-    // return, so fail with an error if we get here.
-    Status::UNSUPPORTED
-}