-
Notifications
You must be signed in to change notification settings - Fork 75
[workflow][test] add busybox workflow #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,234 @@ | ||
| name: BusyBox with ELD | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| # pull_request: {} | ||
| schedule: | ||
| - cron: "0 5 * * *" | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| fetch-clang-cross-toolchain: | ||
| if: github.repository == 'qualcomm/eld' | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - arch: x86_64 | ||
| toolchain_asset: x86_64-unknown-linux-musl.tar.xz | ||
| enabled: 1 | ||
| - arch: riscv32 | ||
| toolchain_asset: riscv32-unknown-linux-musl.tar.xz | ||
| enabled: 0 | ||
| - arch: riscv64 | ||
| toolchain_asset: riscv64-unknown-linux-musl.tar.xz | ||
| enabled: 0 | ||
| - arch: arm | ||
| toolchain_asset: arm-unknown-linux-musleabi.tar.xz | ||
| enabled: 0 | ||
| - arch: aarch64 | ||
| toolchain_asset: aarch64-unknown-linux-musl.tar.xz | ||
| enabled: 0 | ||
| uses: ./.github/workflows/clang-cross-download.yml | ||
| with: | ||
| runner: ubuntu-latest | ||
| workspace: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }} | ||
| assets: ${{ matrix.toolchain_asset }} | ||
| upload_artifact: true | ||
| artifact_name: clang-cross-${{ matrix.arch }} | ||
| enabled: ${{ matrix.enabled == 1 }} | ||
|
|
||
| build-busybox-with-eld: | ||
| if: github.repository == 'qualcomm/eld' | ||
| needs: fetch-clang-cross-toolchain | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - arch: x86_64 | ||
| busybox_arch: x86_64 | ||
| target_triple: x86_64-unknown-linux-musl | ||
| toolchain_dir: x86_64-unknown-linux-musl | ||
| qemu_bin: "" | ||
| enabled: 1 | ||
| - arch: riscv32 | ||
| busybox_arch: riscv | ||
| target_triple: riscv32-unknown-linux-musl | ||
| toolchain_dir: riscv32-unknown-linux-musl | ||
| qemu_bin: qemu-riscv32 | ||
| enabled: 0 | ||
| - arch: riscv64 | ||
| busybox_arch: riscv | ||
| target_triple: riscv64-unknown-linux-musl | ||
| toolchain_dir: riscv64-unknown-linux-musl | ||
| qemu_bin: qemu-riscv64 | ||
| enabled: 0 | ||
| - arch: arm | ||
| busybox_arch: arm | ||
| target_triple: arm-unknown-linux-musleabi | ||
| toolchain_dir: arm-unknown-linux-musleabi | ||
| qemu_bin: qemu-arm | ||
| enabled: 0 | ||
| - arch: aarch64 | ||
| busybox_arch: aarch64 | ||
| target_triple: aarch64-unknown-linux-musl | ||
| toolchain_dir: aarch64-unknown-linux-musl | ||
| qemu_bin: qemu-aarch64 | ||
| enabled: 0 | ||
| steps: | ||
| - name: Checkout eld | ||
| if: matrix.enabled == 1 && github.event_name != 'pull_request' | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| repository: qualcomm/eld | ||
| ref: main | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Checkout eld PR branch | ||
| if: matrix.enabled == 1 && github.event_name == 'pull_request' | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Configure workflow environment variables | ||
| if: matrix.enabled == 1 | ||
| uses: ./.github/workflows/ConfigureBuildWorkflowENV | ||
|
|
||
| - name: Record pre-build entry | ||
| if: github.event_name == 'schedule' && matrix.enabled == 1 | ||
| uses: ./.github/workflows/BuildStatusDataRecorder | ||
| with: | ||
| enabled: true | ||
| project: "llvm-project/llvm/tools/eld" | ||
| stage: "pre-" | ||
| workflow-name: "busybox" | ||
| record-mode: "record" | ||
| status: "fail" | ||
| run-id: ${{github.run_id}} | ||
| arch-name: "${{ matrix.arch }}" | ||
| branch-name: "${{env.BUILD_BRANCH}}" | ||
|
|
||
| - name: Fetch latest nightly toolset | ||
| if: matrix.enabled == 1 | ||
| uses: ./.github/workflows/FetchNightlyToolset | ||
|
|
||
| - name: Download clang-cross toolchain artifact | ||
| if: matrix.enabled == 1 | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c #v8.0.1 | ||
| with: | ||
| name: clang-cross-${{ matrix.arch }} | ||
| path: clang-cross | ||
|
|
||
| - name: Extract clang-cross toolchain | ||
| if: matrix.enabled == 1 | ||
| shell: bash | ||
| env: | ||
| TOOLCHAIN_DIR: ${{ matrix.toolchain_dir }} | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p "${{ github.workspace }}/${TOOLCHAIN_DIR}" | ||
| tar -xf clang-cross/clang-cross-*.tar -C "${{ github.workspace }}/${TOOLCHAIN_DIR}" --strip-components=1 | ||
|
Steven6798 marked this conversation as resolved.
|
||
|
|
||
| - name: Resolve toolchain paths | ||
| if: matrix.enabled == 1 | ||
| shell: bash | ||
| env: | ||
| TARGET_TRIPLE: ${{ matrix.target_triple }} | ||
| TOOLCHAIN_DIR: ${{ matrix.toolchain_dir }} | ||
| run: | | ||
| set -euo pipefail | ||
| toolchain_base="${{ github.workspace }}/${TOOLCHAIN_DIR}" | ||
| cross_root="$(find "${toolchain_base}" -type f -path "*/bin/${TARGET_TRIPLE}-clang" -print -quit | sed 's|/bin/.*$||')" | ||
| if [[ -z "${cross_root}" ]]; then | ||
| echo "Could not find ${TARGET_TRIPLE}-clang under ${toolchain_base}" >&2 | ||
| find "${toolchain_base}" -maxdepth 4 -type d -name bin -print >&2 || true | ||
| exit 1 | ||
| fi | ||
| eld_bin="$(command -v ld.eld || true)" | ||
| if [[ -z "${eld_bin}" ]]; then | ||
| echo "Could not find ld.eld in PATH after FetchNightlyToolset" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "CROSS_TOOLCHAIN_ROOT=${cross_root}" >> "${GITHUB_ENV}" | ||
| echo "ELD_BIN=${eld_bin}" >> "${GITHUB_ENV}" | ||
| echo "${cross_root}/bin" >> "${GITHUB_PATH}" | ||
| echo "Using cross toolchain root: ${cross_root}" | ||
| echo "Using ld.eld: ${eld_bin}" | ||
|
|
||
| - name: Clone BusyBox | ||
| if: matrix.enabled == 1 | ||
| shell: bash | ||
| run: | | ||
| git clone https://github.com/mirror/busybox.git | ||
|
|
||
| - name: Build BusyBox with ELD | ||
| if: matrix.enabled == 1 | ||
| shell: bash | ||
| env: | ||
| CROSS_TOOLCHAIN_ROOT: ${{ env.CROSS_TOOLCHAIN_ROOT }} | ||
| TARGET_TRIPLE: ${{ matrix.target_triple }} | ||
| BUSYBOX_ARCH: ${{ matrix.busybox_arch }} | ||
| ELD_BIN: ${{ env.ELD_BIN }} | ||
| run: | | ||
| set -euo pipefail | ||
| command -v "${TARGET_TRIPLE}-clang" | ||
| command -v ld.eld | ||
| "${TARGET_TRIPLE}"-clang --version | ||
| "${ELD_BIN}" --version | ||
|
|
||
| SYSROOT="${CROSS_TOOLCHAIN_ROOT}/${TARGET_TRIPLE}/sysroot" | ||
| MUSL_LINKER="$(find "${SYSROOT}/lib" -name 'ld-musl-*.so.1' | head -1)" | ||
|
|
||
| cd busybox | ||
| make defconfig | ||
|
|
||
| make -j"$(nproc)" \ | ||
| ARCH="${BUSYBOX_ARCH}" \ | ||
| CC="${TARGET_TRIPLE}-clang --ld-path=${ELD_BIN}" \ | ||
| HOSTCC=clang \ | ||
| STRIP="${TARGET_TRIPLE}-strip" \ | ||
| LDFLAGS="-Wl,-dynamic-linker,${MUSL_LINKER} -Wl,-rpath,${SYSROOT}/lib" | ||
|
|
||
| - name: Run BusyBox tests | ||
| if: matrix.enabled == 1 | ||
| timeout-minutes: 5 | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| cd busybox/testsuite | ||
|
|
||
| # env --default-signal resets all signals (including SIGPIPE) to their | ||
| # default handlers before exec-ing the shell. This is necessary because | ||
| # the GitHub Actions runner sets SIGPIPE to SIG_IGN, which is inherited | ||
| # by all child processes and causes 'yes' in md5sum.tests to spin | ||
| # forever instead of dying when the pipe is closed by 'head'. | ||
| env SKIP_KNOWN_BUGS=1 SKIP_INTERNET_TESTS=1 env --default-signal /bin/sh ./runtest 2>&1 | tee /tmp/busybox-test-output.txt || true | ||
|
|
||
| - name: Validate test results with FileCheck | ||
| if: matrix.enabled == 1 | ||
| shell: bash | ||
| run: | | ||
| FileCheck --input-file=/tmp/busybox-test-output.txt "${{ github.workspace }}/test/BusyBox/${{ matrix.arch }}/test-failures.txt" | ||
|
|
||
| - name: Update build entry | ||
| if: github.event_name == 'schedule' && matrix.enabled == 1 | ||
| uses: ./.github/workflows/BuildStatusDataRecorder | ||
| with: | ||
| enabled: true | ||
| project: "llvm-project/llvm/tools/eld" | ||
| stage: "post-" | ||
| workflow-name: "busybox" | ||
| record-mode: "update" | ||
| status: "pass" | ||
| run-id: ${{github.run_id}} | ||
| arch-name: "${{ matrix.arch }}" | ||
| branch-name: "${{env.BUILD_BRANCH}}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #BEGIN_COMMENT | ||
| # BusyBox's awk_sub() implements gsub() by repeatedly calling regexec() while | ||
| # advancing a pointer through the string. Correctly handling anchors like | ||
| # \< (word start) on each iteration requires REG_STARTEND, a BSD/glibc regex | ||
| # extension not present in POSIX. musl's regex.h defines no REG_STARTEND, so | ||
| # the build falls back to the code path busybox's own source comments already | ||
| # flag as buggy: it reruns regexec() on the advanced pointer, so the regex | ||
| # engine treats that mid-string position as a word start too, and \<b* wrongly | ||
| # matches the "b" in "abc". This is not a bug in BusyBox, the build, or the | ||
| # linker, it is a missing non-POSIX regex extension (REG_STARTEND) in musl. | ||
| #END_COMMENT | ||
| CHECK: FAIL: awk gsub erroneous word start match | ||
|
Steven6798 marked this conversation as resolved.
|
||
|
|
||
| #BEGIN_COMMENT | ||
| # BusyBox's parse_datestr() parses this form via | ||
| # strptime(date_str, "%Y-%m-%d %T %z", &tm). Accepting a bare 'Z' suffix as a | ||
| # synonym for '+0000' in the %z conversion is a GNU libc extension, not POSIX | ||
| # behavior. This is not a bug in BusyBox, the build, or the linker, it is a | ||
| # glibc-vs-musl strptime behavioral difference. | ||
| #END_COMMENT | ||
| CHECK: FAIL: date-timezone | ||
|
|
||
| CHECK-NOT: FAIL: | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.