From e342b91a08075266ac371ae1bfc9aa7dea71b5cf Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 23 Aug 2023 02:17:12 +0200 Subject: [PATCH 01/10] configs: sandbox64: Enable legacy image format support Align the sandbox64 defconfig with sandbox defconfig. Enable missing legacy image format support. This fixes ut_bootstd_bootflow_cmd_menu test. Suggested-by: Jonas Karlman Signed-off-by: Marek Vasut --- configs/sandbox64_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 55a01b7eb9d..b97380544a3 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -13,6 +13,7 @@ CONFIG_SYS_MEMTEST_END=0x00101000 CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y +CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y From ed48da33927c78e6523753f0969f696cf7bf6f9e Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 23 Aug 2023 21:37:44 +0200 Subject: [PATCH 02/10] test: dm: test-fdt: Use fdtdec_get_int() in dm_check_devices() The current fdtdec_get_addr() takes into consideration #address-cells and #size-cells for "ping-expect" property which is clearly neither. Use fdtdec_get_int() instead and return negative one in case the property is not in DT or the platform under test is not DT based, i.e. mimic the current fdtdec_get_addr() behavior. This fixes ut dm dm_test_bus_children test. Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- test/dm/test-fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index eeecd1dc2de..72d0eb57e21 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -135,8 +135,8 @@ int dm_check_devices(struct unit_test_state *uts, int num_devices) * want to test the code that sets that up * (testfdt_drv_probe()). */ - base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), - "ping-expect"); + base = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), + "ping-expect", -1); debug("dev=%d, base=%d: %s\n", i, base, fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL)); From 8b3694aab3a54b9d9571bffd56831cf2abc5edd1 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 25 Aug 2023 10:19:40 +0200 Subject: [PATCH 03/10] test: print: Fix hexdump test on 64bit systems Use the following regex to make this test compatible with both 32bit and 64bit systems. The trick is to use %0*lx format string for the address prefix in the test. " s@\(ut_assert_nextline("\)0\+\([^:]\+\)\(:.*"\)\();\)@\1%0*lx\3, IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x\2UL\4 " Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- test/print_ut.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/test/print_ut.c b/test/print_ut.c index 47a6ce57840..b26f6281b01 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -283,16 +283,21 @@ static int print_do_hex_dump(struct unit_test_state *uts) /* bytes */ console_record_reset(); print_hex_dump_bytes("", DUMP_PREFIX_ADDRESS, buf, 0x12); - ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ..\"3DUfw........"); - ut_assert_nextline("00000010: 10 00 .."); + ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ..\"3DUfw........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 10 00 ..", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); /* line length */ console_record_reset(); print_hex_dump("", DUMP_PREFIX_ADDRESS, 8, 1, buf, 0x12, true); - ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 ..\"3DUfw"); - ut_assert_nextline("00000008: 88 99 aa bb cc dd ee ff ........"); - ut_assert_nextline("00000010: 10 00 .."); + ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 ..\"3DUfw", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 88 99 aa bb cc dd ee ff ........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x8UL); + ut_assert_nextline("%0*lx: 10 00 ..", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); unmap_sysmem(buf); @@ -300,31 +305,39 @@ static int print_do_hex_dump(struct unit_test_state *uts) console_record_reset(); buf[0x41] = 0x41; print_hex_dump("", DUMP_PREFIX_ADDRESS, 0x40, 1, buf, 0x42, true); - ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..\"3DUfw........................................................"); - ut_assert_nextline("00000040: 00 41 .A"); + ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..\"3DUfw........................................................", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 00 41 .A", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x40UL); ut_assert_console_end(); /* 16-bit */ console_record_reset(); print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 2, buf, 0x12, true); - ut_assert_nextline("00000000: 1100 3322 5544 7766 9988 bbaa ddcc ffee ..\"3DUfw........"); - ut_assert_nextline("00000010: 0010 .."); + ut_assert_nextline("%0*lx: 1100 3322 5544 7766 9988 bbaa ddcc ffee ..\"3DUfw........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 0010 ..", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); unmap_sysmem(buf); /* 32-bit */ console_record_reset(); print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 4, buf, 0x14, true); - ut_assert_nextline("00000000: 33221100 77665544 bbaa9988 ffeeddcc ..\"3DUfw........"); - ut_assert_nextline("00000010: 00000010 ...."); + ut_assert_nextline("%0*lx: 33221100 77665544 bbaa9988 ffeeddcc ..\"3DUfw........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 00000010 ....", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); unmap_sysmem(buf); /* 64-bit */ console_record_reset(); print_hex_dump("", DUMP_PREFIX_ADDRESS, 16, 8, buf, 0x18, true); - ut_assert_nextline("00000000: 7766554433221100 ffeeddccbbaa9988 ..\"3DUfw........"); - ut_assert_nextline("00000010: 0000000000000010 ........"); + ut_assert_nextline("%0*lx: 7766554433221100 ffeeddccbbaa9988 ..\"3DUfw........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 0000000000000010 ........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); unmap_sysmem(buf); @@ -337,7 +350,8 @@ static int print_do_hex_dump(struct unit_test_state *uts) buf[4 + i] = 126 + i; buf[8] = 255; print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 1, buf, 10, true); - ut_assert_nextline("00000000: 00 1f 20 21 7e 7f 80 81 ff 99 .. !~....."); + ut_assert_nextline("%0*lx: 00 1f 20 21 7e 7f 80 81 ff 99 .. !~.....", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); ut_assert_console_end(); unmap_sysmem(buf); From 9aeac898da66dda24c4b79fb485af40655353c97 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 20 Aug 2023 13:31:27 -0400 Subject: [PATCH 04/10] Azure: Rework build the world jobs Now that we have 3600 minutes per build job, condense and rework things such that our overall time largely doesn't change, but we can also largely avoid having to re-tweak this job to avoid timeouts. Given that we have 10 threads, we also move a few of the specific sandbox test builds to a prior stage. Note that while sandbox builds with address sanitization enabled (ASAN) not all tests pass, so we limit ourselves to just checking that the version test passes for now. Link: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#timeouts Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- .azure-pipelines.yml | 100 +++++++++++-------------------------------- 1 file changed, 25 insertions(+), 75 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index d137d71dd5b..978d666238e 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -254,9 +254,17 @@ stages: matrix: sandbox: TEST_PY_BD: "sandbox" + sandbox_asan: + TEST_PY_BD: "sandbox" + OVERRIDE: "-a ASAN" + TEST_PY_TEST_SPEC: "version" sandbox_clang: TEST_PY_BD: "sandbox" OVERRIDE: "-O clang-16" + sandbox_clang_asan: + TEST_PY_BD: "sandbox" + OVERRIDE: "-O clang-16 -a ASAN" + TEST_PY_TEST_SPEC: "version" sandbox_nolto: TEST_PY_BD: "sandbox" BUILD_ENV: "NO_LTO=1" @@ -476,84 +484,26 @@ stages: # Use almost the same target division in .travis.yml, only merged # 3 small build jobs (arc/microblaze/xtensa) into one. matrix: - arc_nios2_m68k_microblaze_xtensa: - BUILDMAN: "arc nios2 microblaze m68k xtensa" - amlogic: - BUILDMAN: "amlogic" - arm11_arm7_arm920t_arm946es: - BUILDMAN: "arm11 arm7 arm920t arm946es" - arm926ejs: - BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,omap" - at91_non_armv7: - BUILDMAN: "at91 -x armv7" - at91_non_arm926ejs: - BUILDMAN: "at91 -x arm926ejs" - boundary_engicam_toradex: - BUILDMAN: "boundary engicam toradex" - arm_bcm: - BUILDMAN: "bcm -x mips" - nxp_arm32: - BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216" - nxp_ls101x_ls108x: - BUILDMAN: "freescale&ls101 freescale&ls108" - nxp_ls102x: - BUILDMAN: "freescale&ls102 -x keymile" - nxp_ls104x: - BUILDMAN: "freescale&ls104" - nxp_ls20xx_lx216x: - BUILDMAN: "freescale&ls20 freescale&lx216" - imx6: - BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex" + am33xx_at91_kirkwood_mvebu_omap: + BUILDMAN: "am33xx at91_kirkwood mvebu omap -x siemens" + amlogic_bcm_boundary_engicam_siemens_technexion_oradex: + BUILDMAN: "amlogic bcm boundary engicam siemens technexion toradex -x mips" + arm_nxp_minus_imx: + BUILDMAN: "freescale -x powerpc,m68k,imx,mx" imx: - BUILDMAN: "mx -x mx6,imx8,freescale,technexion,toradex" - imx8_imx9: - BUILDMAN: "imx8 imx9 -x engicam,technexion,toradex" - keymiles_siemens_technexion: - BUILDMAN: "keymile siemens technexion" - keystone2_keystone3: - BUILDMAN: "k2 k3 -x siemens,toradex" - sandbox_asan: - BUILDMAN: "sandbox" - OVERRIDE: "-a ASAN" - sandbox_clang_asan: - BUILDMAN: "sandbox" - OVERRIDE: "-O clang-16 -a ASAN" - samsung_socfpga_renesas: - BUILDMAN: "samsung socfpga renesas" - sun4i_sun9i: - BUILDMAN: "sun4i sun9i" - sun5i_sun6i: - BUILDMAN: "sun5i sun6i" - sun7i: - BUILDMAN: "sun7i" - sun8i: - BUILDMAN: "sun8i" - sun50i: - BUILDMAN: "sun50i" - arm_catch_all: - BUILDMAN: "arm -x arm11,arm7,arm9,aarch64,at91,bcm,freescale,kirkwood,mvebu,renesas,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,toradex,socfpga,k2,k3,zynq" - sandbox_x86: - BUILDMAN: "sandbox x86" - kirkwood_mvebu_uniphier: - BUILDMAN: "kirkwood mvebu uniphier" - mips: - BUILDMAN: "mips" + BUILDMAN: "mx imx -x boundary,engicam,technexion,toradex" + rk: + BUILDMAN: "rk" + sunxi: + BUILDMAN: "sunxi" powerpc: - BUILDMAN: "powerpc -x keymile" - tegra: - BUILDMAN: "tegra -x toradex" - am33xx_omap: - BUILDMAN: "am33xx omap -x siemens" + BUILDMAN: "powerpc" + arm_catch_all: + BUILDMAN: "arm -x aarch64,am33xx,at91,bcm,ls1,kirkwood,mvebu,omap,rk,siemens,mx,sunxi,technexion,toradex" aarch64_catch_all: - BUILDMAN: "aarch64 -x amlogic,bcm,imx8,imx9,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,renesas,sunxi,samsung,socfpga,rk,versal,zynq" - rk_non_rockchip_64bit: - BUILDMAN: "rk&aarch64 -x rockchip" - rk_rockchip_64bit: - BUILDMAN: "rk&aarch64&rockchip" - zynq_zynqmp_versal: - BUILDMAN: "zynq&armv7 versal zynqmp&aarch64" - riscv: - BUILDMAN: "riscv" + BUILDMAN: "aarch64 -x amlogic,bcm,engicam,imx,ls1,ls2,lx216,mvebu,rk,siemens,sunxi,toradex" + everything_but_arm_and_powerpc: + BUILDMAN: "-x arm,powerpc" steps: - script: | cat << EOF > build.sh From 562ed115e7b62fc8cdf61a9ea4577588d705086b Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 20 Aug 2023 13:31:28 -0400 Subject: [PATCH 05/10] CI: Combine tools-only and envtools jobs These jobs are to confirm specific build targets, on a Linux host. We can safely combine these two build tests, with a make mrproper in between. Signed-off-by: Tom Rini --- .azure-pipelines.yml | 13 ++----------- .gitlab-ci.yml | 12 ++++-------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 978d666238e..9dfb07d3c7c 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -126,7 +126,7 @@ stages: ./tools/buildman/buildman --maintainer-check || exit 0 - job: tools_only - displayName: 'Ensure host tools build' + displayName: 'Ensure host tools and env tools build' pool: vmImage: $(ubuntu_vm) container: @@ -135,16 +135,7 @@ stages: steps: - script: | make tools-only_config tools-only -j$(nproc) - - - job: envtools - displayName: 'Ensure env tools build' - pool: - vmImage: $(ubuntu_vm) - container: - image: $(ci_runner_image) - options: $(container_option) - steps: - - script: | + make mrproper make tools-only_config envtools -j$(nproc) - job: utils diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d7ffdd1bbc..51553a1660e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -190,16 +190,12 @@ Check for configs without MAINTAINERS entry: - ./tools/buildman/buildman --maintainer-check || exit 0 # Ensure host tools build -Build tools-only: +Build tools-only and envtools: stage: testsuites script: - - make tools-only_config tools-only -j$(nproc) - -# Ensure env tools build -Build envtools: - stage: testsuites - script: - - make tools-only_config envtools -j$(nproc) + - make tools-only_config tools-only -j$(nproc); + make mrproper; + make tools-only_config envtools -j$(nproc) Run binman, buildman, dtoc, Kconfig and patman testsuites: stage: testsuites From b87f904709fa86e485c6f424ea2a380999910db0 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 20 Aug 2023 13:31:29 -0400 Subject: [PATCH 06/10] CI: Drop some jobs we didn't really utilize - We have added more TODO/etc comments since this task was created and never focused on removing them. - The output of sloccount isn't preserved or looked at, and if desired should be in the release stats pages instead somehow. - The results of cppcheck aren't investigated and require modeling work to be useful to start with. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- .azure-pipelines.yml | 32 -------------------------------- .gitlab-ci.yml | 22 ---------------------- tools/docker/Dockerfile | 2 -- 3 files changed, 56 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 9dfb07d3c7c..0e348c8f1eb 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -67,16 +67,6 @@ stages: :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0 - - job: cppcheck - displayName: 'Static code analysis with cppcheck' - pool: - vmImage: $(ubuntu_vm) - container: - image: $(ci_runner_image) - options: $(container_option) - steps: - - script: cppcheck -j$(nproc) --force --quiet --inline-suppr . - - job: docs displayName: 'Build documentation' pool: @@ -92,28 +82,6 @@ stages: make htmldocs KDOC_WERROR=1 make infodocs - - job: todo - displayName: 'Search for TODO within source tree' - pool: - vmImage: $(ubuntu_vm) - container: - image: $(ci_runner_image) - options: $(container_option) - steps: - - script: grep -r TODO . - - script: grep -r FIXME . - - script: grep -r HACK . | grep -v HACKKIT - - - job: sloccount - displayName: 'Some statistics about the code base' - pool: - vmImage: $(ubuntu_vm) - container: - image: $(ci_runner_image) - options: $(container_option) - steps: - - script: sloccount . - - job: maintainers displayName: 'Ensure all configs have MAINTAINERS entries' pool: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51553a1660e..8171c1d619b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -151,22 +151,6 @@ check for new CONFIG symbols outside Kconfig: :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0 -# QA jobs for code analytics -# static code analysis with cppcheck (we can add --enable=all later) -cppcheck: - stage: testsuites - script: - - cppcheck -j$(nproc) --force --quiet --inline-suppr . - -# search for TODO within source tree -grep TODO/FIXME/HACK: - stage: testsuites - script: - - grep -r TODO . - - grep -r FIXME . - # search for HACK within source tree and ignore HACKKIT board - - grep -r HACK . | grep -v HACKKIT - # build documentation docs: stage: testsuites @@ -177,12 +161,6 @@ docs: - make htmldocs KDOC_WERROR=1 - make infodocs -# some statistics about the code base -sloccount: - stage: testsuites - script: - - sloccount . - # ensure all configs have MAINTAINERS entries Check for configs without MAINTAINERS entry: stage: testsuites diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 279b3a3504c..1acb5413c7e 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -43,7 +43,6 @@ RUN apt-get update && apt-get install -y \ clang-16 \ coreutils \ cpio \ - cppcheck \ curl \ device-tree-compiler \ dosfstools \ @@ -105,7 +104,6 @@ RUN apt-get update && apt-get install -y \ python3-virtualenv \ rpm2cpio \ sbsigntool \ - sloccount \ socat \ softhsm2 \ sparse \ From 8ae5feca187823a8fd1a0c780c944752a44e5c54 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 1 Sep 2023 16:41:41 -0400 Subject: [PATCH 07/10] Azure: Rework test_py job to publish its wrapper script Both to aide in debugging of any test.py issues as well as to make it easier to split the current matrix in two, have a new job that creates and publishes the current wrapper script we use for test.py jobs. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- .azure-pipelines.yml | 161 ++++++++++++++++++++++++------------------- 1 file changed, 90 insertions(+), 71 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 0e348c8f1eb..7dc5f2848ae 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -203,6 +203,83 @@ stages: steps: - script: make pip + - job: create_test_py_wrapper_script + displayName: 'Create and stage a wrapper for test.py runs' + pool: + vmImage: $(ubuntu_vm) + steps: + - checkout: none + - script: | + cat << EOF > test.sh + #!/bin/bash + set -ex + # the below corresponds to .gitlab-ci.yml "before_script" + cd \${WORK_DIR} + git config --global --add safe.directory \${WORK_DIR} + git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks + ln -s travis-ci /tmp/uboot-test-hooks/bin/\`hostname\` + ln -s travis-ci /tmp/uboot-test-hooks/py/\`hostname\` + grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + if [[ "\${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then + wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ; + export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin; + fi + if [[ "\${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "\${TEST_PY_BD}" == "sifive_unleashed" ]]; then + wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ; + export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin; + fi + # the below corresponds to .gitlab-ci.yml "script" + cd \${WORK_DIR} + export UBOOT_TRAVIS_BUILD_DIR=/tmp/\${TEST_PY_BD} + if [ -n "\${BUILD_ENV}" ]; then + export \${BUILD_ENV}; + fi + pip install -r tools/buildman/requirements.txt + tools/buildman/buildman -o \${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board \${TEST_PY_BD} \${OVERRIDE} + cp ~/grub_x86.efi \${UBOOT_TRAVIS_BUILD_DIR}/ + cp ~/grub_x64.efi \${UBOOT_TRAVIS_BUILD_DIR}/ + cp /opt/grub/grubriscv64.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi + cp /opt/grub/grubaa64.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi + cp /opt/grub/grubarm.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi + # create sdcard / spi-nor images for sifive unleashed using genimage + if [[ "\${TEST_PY_BD}" == "sifive_unleashed" ]]; then + mkdir -p root; + cp \${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .; + cp \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .; + rm -rf tmp; + genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg; + cp images/sdcard.img \${UBOOT_TRAVIS_BUILD_DIR}/; + rm -rf tmp; + genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg; + cp images/spi-nor.img \${UBOOT_TRAVIS_BUILD_DIR}/; + fi + if [[ "\${TEST_PY_BD}" == "coreboot" ]]; then + wget -O - "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |xz -dc >\${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom; + wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >cbfstool; + chmod a+x cbfstool; + ./cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000; + fi + virtualenv -p /usr/bin/python3 /tmp/venv + . /tmp/venv/bin/activate + pip install -r test/py/requirements.txt + pip install pytest-azurepipelines + export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:\${PATH} + export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci + # "\${var:+"-k \$var"}" expands to "" if \$var is empty, "-k \$var" if not + ./test/py/test.py -ra -o cache_dir="\$UBOOT_TRAVIS_BUILD_DIR"/.pytest_cache --bd \${TEST_PY_BD} \${TEST_PY_ID} \${TEST_PY_TEST_SPEC:+"-k \${TEST_PY_TEST_SPEC}"} --build-dir "\$UBOOT_TRAVIS_BUILD_DIR" --report-dir "\$UBOOT_TRAVIS_BUILD_DIR" + # the below corresponds to .gitlab-ci.yml "after_script" + rm -rf /tmp/uboot-test-hooks /tmp/venv + EOF + - task: CopyFiles@2 + displayName: 'Copy test.sh for later usage' + inputs: + contents: 'test.sh' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - publish: '$(Build.ArtifactStagingDirectory)/test.sh' + displayName: 'Publish test.sh' + artifact: testsh + - stage: test_py jobs: - job: test_py @@ -339,81 +416,14 @@ stages: TEST_PY_ID: "--id qemu" TEST_PY_TEST_SPEC: "not sleep" steps: + - download: current + artifact: testsh - script: | - cat << EOF > test.sh - set -ex - # make environment variables available as tests are running inside a container - export WORK_DIR="${WORK_DIR}" - export TEST_PY_BD="${TEST_PY_BD}" - export TEST_PY_ID="${TEST_PY_ID}" - export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}" - export OVERRIDE="${OVERRIDE}" - export BUILD_ENV="${BUILD_ENV}" - EOF - cat << "EOF" >> test.sh - # the below corresponds to .gitlab-ci.yml "before_script" - cd ${WORK_DIR} - git config --global --add safe.directory ${WORK_DIR} - git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname` - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname` - grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd - grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then - wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ; - export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin; - fi - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then - wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ; - export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin; - fi - # the below corresponds to .gitlab-ci.yml "script" - cd ${WORK_DIR} - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}; - if [ -n "${BUILD_ENV}" ]; then - export ${BUILD_ENV}; - fi - pip install -r tools/buildman/requirements.txt - tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE} - cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/ - cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/ - cp /opt/grub/grubriscv64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi - cp /opt/grub/grubaa64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi - cp /opt/grub/grubarm.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi - # create sdcard / spi-nor images for sifive unleashed using genimage - if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then - mkdir -p root; - cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .; - cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .; - rm -rf tmp; - genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg; - cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/; - rm -rf tmp; - genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg; - cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/; - fi - if [[ "${TEST_PY_BD}" == "coreboot" ]]; then - wget -O - "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |xz -dc >${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom; - wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >cbfstool; - chmod a+x cbfstool; - ./cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000; - fi - virtualenv -p /usr/bin/python3 /tmp/venv - . /tmp/venv/bin/activate - pip install -r test/py/requirements.txt - pip install pytest-azurepipelines - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH}; - export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci; - # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not - ./test/py/test.py -ra -o cache_dir="$UBOOT_TRAVIS_BUILD_DIR"/.pytest_cache --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR" --report-dir "$UBOOT_TRAVIS_BUILD_DIR"; - # the below corresponds to .gitlab-ci.yml "after_script" - rm -rf /tmp/uboot-test-hooks /tmp/venv - EOF - cat test.sh # make current directory writeable to uboot user inside the container # as sandbox testing need create files like spi flash images, etc. # (TODO: clean up this in the future) chmod 777 . + chmod 755 $(Pipeline.Workspace)/testsh/test.sh # Filesystem tests need extra docker args to run set -- if [[ "${TEST_PY_BD}" == "sandbox" ]]; then @@ -429,7 +439,16 @@ stages: set -- "$@" --security-opt apparmor=unconfined fi # Some tests using libguestfs-tools need the fuse device to run - docker run "$@" --device /dev/fuse:/dev/fuse -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh + docker run "$@" --device /dev/fuse:/dev/fuse \ + -v $PWD:$(work_dir) \ + -v $(Pipeline.Workspace):$(Pipeline.Workspace) \ + -e WORK_DIR="${WORK_DIR}" \ + -e TEST_PY_BD="${TEST_PY_BD}" \ + -e TEST_PY_ID="${TEST_PY_ID}" \ + -e TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}" \ + -e OVERRIDE="${OVERRIDE}" \ + -e BUILD_ENV="${BUILD_ENV}" $(ci_runner_image) \ + $(Pipeline.Workspace)/testsh/test.sh retryCountOnTaskFailure: 2 # QEMU may be too slow, etc. - stage: world_build From c9836c0fb743a6aa88b8ba8aa41e461ef8340453 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 1 Sep 2023 16:41:42 -0400 Subject: [PATCH 08/10] Azure: Split sandbox and qemu test.py runs Currently, most sandbox runs take a long time (due to running so many tests) while QEMu based test.py runs are fairly short. Split the pipeline here so that we get more consistent average run times. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- .azure-pipelines.yml | 61 ++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 7dc5f2848ae..c127fd3ca2f 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -280,10 +280,10 @@ stages: displayName: 'Publish test.sh' artifact: testsh -- stage: test_py +- stage: test_py_sandbox jobs: - - job: test_py - displayName: 'test.py' + - job: test_py_sandbox + displayName: 'test.py for sandbox' pool: vmImage: $(ubuntu_vm) strategy: @@ -320,6 +320,47 @@ stages: BUILD_ENV: "FTRACE=1 NO_LTO=1" TEST_PY_TEST_SPEC: "trace" OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000 -a CONFIG_TRACE_BUFFER_SIZE=0x02000000" + steps: + - download: current + artifact: testsh + - script: | + # make current directory writeable to uboot user inside the container + # as sandbox testing need create files like spi flash images, etc. + # (TODO: clean up this in the future) + chmod 777 . + chmod 755 $(Pipeline.Workspace)/testsh/test.sh + # Filesystem tests need extra docker args to run + set -- + # mount -o loop needs the loop devices + if modprobe loop; then + for d in $(find /dev -maxdepth 1 -name 'loop*'); do + set -- "$@" --device $d:$d + done + fi + # Needed for mount syscall (for guestmount as well) + set -- "$@" --cap-add SYS_ADMIN + # Default apparmor profile denies mounts + set -- "$@" --security-opt apparmor=unconfined + # Some tests using libguestfs-tools need the fuse device to run + docker run "$@" --device /dev/fuse:/dev/fuse \ + -v $PWD:$(work_dir) \ + -v $(Pipeline.Workspace):$(Pipeline.Workspace) \ + -e WORK_DIR="${WORK_DIR}" \ + -e TEST_PY_BD="${TEST_PY_BD}" \ + -e TEST_PY_ID="${TEST_PY_ID}" \ + -e TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}" \ + -e OVERRIDE="${OVERRIDE}" \ + -e BUILD_ENV="${BUILD_ENV}" $(ci_runner_image) \ + $(Pipeline.Workspace)/testsh/test.sh + +- stage: test_py_qemu + jobs: + - job: test_py_qemu + displayName: 'test.py for QEMU platforms' + pool: + vmImage: $(ubuntu_vm) + strategy: + matrix: coreboot: TEST_PY_BD: "coreboot" TEST_PY_ID: "--id qemu" @@ -424,20 +465,6 @@ stages: # (TODO: clean up this in the future) chmod 777 . chmod 755 $(Pipeline.Workspace)/testsh/test.sh - # Filesystem tests need extra docker args to run - set -- - if [[ "${TEST_PY_BD}" == "sandbox" ]]; then - # mount -o loop needs the loop devices - if modprobe loop; then - for d in $(find /dev -maxdepth 1 -name 'loop*'); do - set -- "$@" --device $d:$d - done - fi - # Needed for mount syscall (for guestmount as well) - set -- "$@" --cap-add SYS_ADMIN - # Default apparmor profile denies mounts - set -- "$@" --security-opt apparmor=unconfined - fi # Some tests using libguestfs-tools need the fuse device to run docker run "$@" --device /dev/fuse:/dev/fuse \ -v $PWD:$(work_dir) \ From c807bdd0a973139c577893c18e044c3c86da0c40 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 1 Sep 2023 10:48:10 +0200 Subject: [PATCH 09/10] .gitlab-ci: Test sandbox64 board in addition to sandbox Test both 32bit and 64bit sandbox boards in CI. Signed-off-by: Marek Vasut Reviewed-by: Tom Rini --- .gitlab-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8171c1d619b..6efbd8021c8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -265,6 +265,23 @@ sandbox without LTO test.py: BUILD_ENV: "NO_LTO=1" <<: *buildman_and_testpy_dfn +sandbox64 test.py: + variables: + TEST_PY_BD: "sandbox64" + <<: *buildman_and_testpy_dfn + +sandbox64 with clang test.py: + variables: + TEST_PY_BD: "sandbox64" + OVERRIDE: "-O clang-16" + <<: *buildman_and_testpy_dfn + +sandbox64 without LTO test.py: + variables: + TEST_PY_BD: "sandbox64" + BUILD_ENV: "NO_LTO=1" + <<: *buildman_and_testpy_dfn + sandbox_spl test.py: variables: TEST_PY_BD: "sandbox_spl" From 57c7cb66b681501923f351672dc4acff70736299 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 1 Sep 2023 16:41:43 -0400 Subject: [PATCH 10/10] Azure: Add sandbox64 to CI Now that sandbox64 can run and pass the regular test.py suite, add it here as well. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- .azure-pipelines.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index c127fd3ca2f..421c5018b40 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -301,6 +301,11 @@ stages: TEST_PY_BD: "sandbox" OVERRIDE: "-O clang-16 -a ASAN" TEST_PY_TEST_SPEC: "version" + sandbox64: + TEST_PY_BD: "sandbox64" + sandbox64_clang: + TEST_PY_BD: "sandbox64" + OVERRIDE: "-O clang-16" sandbox_nolto: TEST_PY_BD: "sandbox" BUILD_ENV: "NO_LTO=1"