From d94a40516efd42e0ed6d92645866959ad04e95eb Mon Sep 17 00:00:00 2001 From: Miguel Flores Ruiz de Eguino <1889916+miguelfrde@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:48:30 -0700 Subject: [fuchsia-test-runner] Remove usage of kw_only We are still at Python 3.8 in Fuchsia infra. This was introduced at Python 3.10. --- src/ci/docker/scripts/fuchsia-test-runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ci/docker/scripts') diff --git a/src/ci/docker/scripts/fuchsia-test-runner.py b/src/ci/docker/scripts/fuchsia-test-runner.py index 115ee69a589..6db25ff1a80 100755 --- a/src/ci/docker/scripts/fuchsia-test-runner.py +++ b/src/ci/docker/scripts/fuchsia-test-runner.py @@ -112,7 +112,7 @@ def atomic_link(link: Path, target: Path): os.remove(tmp_file) -@dataclass(kw_only=True) +@dataclass class TestEnvironment: rust_build_dir: Path sdk_dir: Path -- cgit 1.4.1-3-g733a5 From 03d73fa6baa2523c695081d9f4f8b32a8ea7fbcf Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Tue, 5 Mar 2024 16:04:02 +0800 Subject: ci: Add support for dist-loongarch64-musl --- src/ci/docker/README.md | 16 ++++++++++ .../host-x86_64/dist-loongarch64-musl/Dockerfile | 35 ++++++++++++++++++++++ .../loongarch64-unknown-linux-musl.defconfig | 15 ++++++++++ src/ci/docker/scripts/crosstool-ng-git.sh | 17 +++++++++++ src/ci/github-actions/jobs.yml | 3 ++ 5 files changed, 86 insertions(+) create mode 100644 src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile create mode 100644 src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig create mode 100644 src/ci/docker/scripts/crosstool-ng-git.sh (limited to 'src/ci/docker/scripts') diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 824c904e17f..985e3b37422 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -271,6 +271,22 @@ For targets: `loongarch64-unknown-linux-gnu` - C compiler > gcc version = 13.2.0 - C compiler > C++ = ENABLE -- to cross compile LLVM +### `loongarch64-linux-musl.defconfig` + +For targets: `loongarch64-unknown-linux-musl` + +- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET} +- Path and misc options > Use a mirror = ENABLE +- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc +- Target options > Target Architecture = loongarch +- Target options > Bitness = 64-bit +- Operating System > Target OS = linux +- Operating System > Linux kernel version = 5.19.16 +- Binary utilities > Version of binutils = 2.41 +- C-library > musl version = 1.2.5 +- C compiler > gcc version = 13.2.0 +- C compiler > C++ = ENABLE -- to cross compile LLVM + ### `mips-linux-gnu.defconfig` For targets: `mips-unknown-linux-gnu` diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile new file mode 100644 index 00000000000..560adf971ba --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:22.04 + +COPY scripts/cross-apt-packages.sh /scripts/ +RUN sh /scripts/cross-apt-packages.sh + +COPY scripts/crosstool-ng-git.sh /scripts/ +RUN sh /scripts/crosstool-ng-git.sh + +COPY scripts/rustbuild-setup.sh /scripts/ +RUN sh /scripts/rustbuild-setup.sh +WORKDIR /tmp + +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh + +COPY scripts/sccache.sh /scripts/ +RUN sh /scripts/sccache.sh + +ENV PATH=$PATH:/x-tools/loongarch64-unknown-linux-musl/bin + +ENV CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \ + AR_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-ar \ + CXX_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-g++ + +ENV HOSTS=loongarch64-unknown-linux-musl + +ENV RUST_CONFIGURE_ARGS \ + --enable-extended \ + --enable-lld \ + --disable-docs \ + --set target.loongarch64-unknown-linux-musl.crt-static=false \ + --musl-root-loongarch64=/x-tools/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot/usr + +ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig new file mode 100644 index 00000000000..3ab676ed971 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig @@ -0,0 +1,15 @@ +CT_CONFIG_VERSION="4" +CT_EXPERIMENTAL=y +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_LOONGARCH=y +# CT_DEMULTILIB is not set +CT_ARCH_USE_MMU=y +CT_ARCH_ARCH="loongarch64" +CT_KERNEL_LINUX=y +CT_LINUX_V_5_19=y +CT_LIBC_MUSL=y +CT_CC_GCC_ENABLE_DEFAULT_PIE=y +CT_CC_LANG_CXX=y +CT_GETTEXT_NEEDED=y diff --git a/src/ci/docker/scripts/crosstool-ng-git.sh b/src/ci/docker/scripts/crosstool-ng-git.sh new file mode 100644 index 00000000000..2a10e262df8 --- /dev/null +++ b/src/ci/docker/scripts/crosstool-ng-git.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -ex + +URL=https://github.com/crosstool-ng/crosstool-ng +REV=c64500d94be92ed1bcdfdef911048a14e216a5e1 + +mkdir crosstool-ng +cd crosstool-ng +git init +git fetch --depth=1 ${URL} ${REV} +git reset --hard FETCH_HEAD +./bootstrap +./configure --prefix=/usr/local +make -j$(nproc) +make install +cd .. +rm -rf crosstool-ng diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 4366a92fbcd..e3903c3dd5a 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -144,6 +144,9 @@ auto: - image: dist-loongarch64-linux <<: *job-linux-4c + - image: dist-loongarch64-musl + <<: *job-linux-4c + - image: dist-ohos <<: *job-linux-4c -- cgit 1.4.1-3-g733a5 From 54aa9e8ba2efe68bfcf5c407a5a9cf1a8d17b354 Mon Sep 17 00:00:00 2001 From: Charles Celerier Date: Sat, 6 Jul 2024 05:15:38 +0000 Subject: [fuchsia-test-runner] Remove runner logs from stdout and stderr Many tests use stdout and stderr to validate whether the test emitted the correct output. Because fuchsia-test-runner.py was sending all logs, including test output, to stdout, tests could not validate output properly. This change removes the runner logs from stdout and stderr entirely with the exception of output from the test. All runner logs are still available in the "log" file. Fixed: https://fxbug.dev/351356417 --- src/ci/docker/scripts/fuchsia-test-runner.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/ci/docker/scripts') diff --git a/src/ci/docker/scripts/fuchsia-test-runner.py b/src/ci/docker/scripts/fuchsia-test-runner.py index 6db25ff1a80..1a2e69712a9 100755 --- a/src/ci/docker/scripts/fuchsia-test-runner.py +++ b/src/ci/docker/scripts/fuchsia-test-runner.py @@ -271,13 +271,6 @@ class TestEnvironment: logfile_handler.setLevel(logging.DEBUG) logfile_handler.setFormatter(fs) logging.getLogger().addHandler(logfile_handler) - stream_handler = logging.StreamHandler(sys.stdout) - stream_handler.setFormatter(fs) - if self.verbose: - stream_handler.setLevel(logging.DEBUG) - else: - stream_handler.setLevel(logging.INFO) - logging.getLogger().addHandler(stream_handler) logging.getLogger().setLevel(logging.DEBUG) @property @@ -927,7 +920,7 @@ class TestEnvironment: ) else: with open(stdout_path, encoding="utf-8", errors="ignore") as f: - runner_logger.info(f.read()) + sys.stdout.write(f.read()) if stderr_path is not None: if not os.path.exists(stderr_path): runner_logger.error( @@ -935,7 +928,7 @@ class TestEnvironment: ) else: with open(stderr_path, encoding="utf-8", errors="ignore") as f: - runner_logger.error(f.read()) + sys.stderr.write(f.read()) runner_logger.info("Done!") return return_code -- cgit 1.4.1-3-g733a5 From 3d5b4d8f7cd721ded6589edc2e6e350a8575848f Mon Sep 17 00:00:00 2001 From: Charles Celerier Date: Sun, 7 Jul 2024 15:33:31 +0000 Subject: [fuchsia-test-runner] Reformat fuchsia-test-runner.py Applied formatting suggestions from isort and black via pylsp. --- src/ci/docker/scripts/fuchsia-test-runner.py | 52 ++++++++-------------------- 1 file changed, 15 insertions(+), 37 deletions(-) (limited to 'src/ci/docker/scripts') diff --git a/src/ci/docker/scripts/fuchsia-test-runner.py b/src/ci/docker/scripts/fuchsia-test-runner.py index 1a2e69712a9..00269e68422 100755 --- a/src/ci/docker/scripts/fuchsia-test-runner.py +++ b/src/ci/docker/scripts/fuchsia-test-runner.py @@ -8,8 +8,6 @@ https://doc.rust-lang.org/stable/rustc/platform-support/fuchsia.html#aarch64-unk """ import argparse -from concurrent.futures import ThreadPoolExecutor -from dataclasses import dataclass import glob import io import json @@ -20,6 +18,8 @@ import shlex import shutil import subprocess import sys +from concurrent.futures import ThreadPoolExecutor +from dataclasses import dataclass from pathlib import Path from typing import ClassVar, List, Optional @@ -42,12 +42,8 @@ def check_call_with_logging( for line in pipe: handler(line.rstrip()) - executor_out = executor.submit( - exhaust_pipe, stdout_handler, process.stdout - ) - executor_err = executor.submit( - exhaust_pipe, stderr_handler, process.stderr - ) + executor_out = executor.submit(exhaust_pipe, stdout_handler, process.stdout) + executor_err = executor.submit(exhaust_pipe, stderr_handler, process.stderr) executor_out.result() executor_err.result() retcode = process.poll() @@ -203,9 +199,7 @@ class TestEnvironment: 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}" - ) + raise Exception(f"Unreadable output from llvm-readelf for binary {binary}") notes = data[0]["Notes"] for note in notes: note_section = note["NoteSection"] @@ -265,9 +259,7 @@ class TestEnvironment: def setup_logging(self, log_to_file=False): fs = logging.Formatter("%(asctime)s %(levelname)s:%(name)s:%(message)s") if log_to_file: - logfile_handler = logging.FileHandler( - self.tmp_dir().joinpath("log") - ) + logfile_handler = logging.FileHandler(self.tmp_dir().joinpath("log")) logfile_handler.setLevel(logging.DEBUG) logfile_handler.setFormatter(fs) logging.getLogger().addHandler(logfile_handler) @@ -447,9 +439,7 @@ class TestEnvironment: # Initialize temp directory os.makedirs(self.tmp_dir(), exist_ok=True) if len(os.listdir(self.tmp_dir())) != 0: - raise Exception( - f"Temp directory is not clean (in {self.tmp_dir()})" - ) + raise Exception(f"Temp directory is not clean (in {self.tmp_dir()})") self.setup_logging(log_to_file=True) os.mkdir(self.output_dir) @@ -486,9 +476,7 @@ class TestEnvironment: shutil.rmtree(self.local_pb_path, ignore_errors=True) # Look up the product bundle transfer manifest. - self.env_logger.info( - "Looking up the product bundle transfer manifest..." - ) + self.env_logger.info("Looking up the product bundle transfer manifest...") product_name = "minimal." + self.triple_to_arch(self.target) sdk_version = self.read_sdk_version() @@ -510,9 +498,7 @@ class TestEnvironment: ) try: - transfer_manifest_url = json.loads(output)[ - "transfer_manifest_url" - ] + transfer_manifest_url = json.loads(output)["transfer_manifest_url"] except Exception as e: print(e) raise Exception("Unable to parse transfer manifest") from e @@ -762,9 +748,7 @@ class TestEnvironment: # Use /tmp as the test temporary directory env_vars += '\n "RUST_TEST_TMPDIR=/tmp",' - cml.write( - self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name) - ) + cml.write(self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name)) runner_logger.info("Compiling CML...") @@ -915,17 +899,13 @@ class TestEnvironment: if stdout_path is not None: if not os.path.exists(stdout_path): - runner_logger.error( - f"stdout file {stdout_path} does not exist." - ) + runner_logger.error(f"stdout file {stdout_path} does not exist.") else: with open(stdout_path, encoding="utf-8", errors="ignore") as f: sys.stdout.write(f.read()) if stderr_path is not None: if not os.path.exists(stderr_path): - runner_logger.error( - f"stderr file {stderr_path} does not exist." - ) + runner_logger.error(f"stderr file {stderr_path} does not exist.") else: with open(stderr_path, encoding="utf-8", errors="ignore") as f: sys.stderr.write(f.read()) @@ -1030,7 +1010,7 @@ class TestEnvironment: f"--symbol-path={self.rust_dir}/lib/rustlib/{self.target}/lib", ] - # Add rust source if it's available + # Add rust source if it's available rust_src_map = None if args.rust_src is not None: # This matches the remapped prefix used by compiletest. There's no @@ -1203,7 +1183,7 @@ def main(): start_parser.add_argument( "--use-local-product-bundle-if-exists", help="if the product bundle already exists in the local path, use " - "it instead of downloading it again", + "it instead of downloading it again", action="store_true", ) start_parser.set_defaults(func=start) @@ -1239,9 +1219,7 @@ def main(): ) cleanup_parser.set_defaults(func=cleanup) - syslog_parser = subparsers.add_parser( - "syslog", help="prints the device syslog" - ) + syslog_parser = subparsers.add_parser("syslog", help="prints the device syslog") syslog_parser.set_defaults(func=syslog) debug_parser = subparsers.add_parser( -- cgit 1.4.1-3-g733a5