Skip to content

Commit a4a31f5

Browse files
authored
Merge branch 'main' into temp-selinux-impl
2 parents 5ca41f4 + c5a236d commit a4a31f5

File tree

131 files changed

+1915
-1700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+1915
-1700
lines changed

.config/nextest.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ status-level = "all"
44
final-status-level = "skip"
55
failure-output = "immediate-final"
66
fail-fast = false
7+
8+
[profile.coverage]
9+
retries = 0
10+
status-level = "all"
11+
final-status-level = "skip"
12+
failure-output = "immediate-final"
13+
fail-fast = false

.github/workflows/CICD.yml

Lines changed: 127 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CICD
22

33
# spell-checker:ignore (abbrev/names) CICD CodeCOV MacOS MinGW MSVC musl taiki
44
# spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic CARGOFLAGS
5-
# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel
5+
# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel profdata
66
# spell-checker:ignore (people) Peltoche rivy dtolnay Anson dawidd
77
# spell-checker:ignore (shell/tools) binutils choco clippy dmake dpkg esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libfuse libssl limactl mkdir nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache utmpdump xargs
88
# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils defconfig DESTDIR gecos getenforce gnueabihf issuecomment maint manpages msys multisize noconfirm nullglob onexitbegin onexitend pell runtest Swatinem tempfile testsuite toybox uutils
@@ -190,12 +190,14 @@ jobs:
190190
unset CARGO_FEATURES_OPTION
191191
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
192192
outputs CARGO_FEATURES_OPTION
193-
- name: Confirm MinSRV compatible 'Cargo.lock'
193+
- name: Confirm MinSRV compatible '*/Cargo.lock'
194194
shell: bash
195195
run: |
196-
## Confirm MinSRV compatible 'Cargo.lock'
197-
# * 'Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
198-
cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::Incompatible (or out-of-date) 'Cargo.lock' file; update using \`cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; }
196+
## Confirm MinSRV compatible '*/Cargo.lock'
197+
# * '*/Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
198+
for dir in "." "fuzz"; do
199+
( cd "$dir" && cargo fetch --locked --quiet ) || { echo "::error file=$dir/Cargo.lock::Incompatible (or out-of-date) '$dir/Cargo.lock' file; update using \`cd '$dir' && cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; }
200+
done
199201
- name: Install/setup prerequisites
200202
shell: bash
201203
run: |
@@ -246,7 +248,9 @@ jobs:
246248
run: |
247249
## `cargo update` testing
248250
# * convert any errors/warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
249-
cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::'Cargo.lock' file requires update (use \`cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; }
251+
for dir in "." "fuzz"; do
252+
( cd "$dir" && cargo fetch --locked --quiet ) || { echo "::error file=$dir/Cargo.lock::'$dir/Cargo.lock' file requires update (use \`cd '$dir' && cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; }
253+
done
250254
251255
build_makefile:
252256
name: Build/Makefile
@@ -997,6 +1001,123 @@ jobs:
9971001
name: toybox-result.json
9981002
path: ${{ steps.vars.outputs.TEST_SUMMARY_FILE }}
9991003

1004+
coverage:
1005+
name: Code Coverage
1006+
runs-on: ${{ matrix.job.os }}
1007+
timeout-minutes: 90
1008+
env:
1009+
SCCACHE_GHA_ENABLED: "true"
1010+
RUSTC_WRAPPER: "sccache"
1011+
strategy:
1012+
fail-fast: false
1013+
matrix:
1014+
job:
1015+
- { os: ubuntu-latest , features: unix, toolchain: nightly }
1016+
# FIXME: Re-enable macos code coverage
1017+
# - { os: macos-latest , features: macos, toolchain: nightly }
1018+
# FIXME: Re-enable Code Coverage on windows, which currently fails due to "profiler_builtins". See #6686.
1019+
# - { os: windows-latest , features: windows, toolchain: nightly-x86_64-pc-windows-gnu }
1020+
steps:
1021+
- uses: actions/checkout@v4
1022+
- uses: dtolnay/rust-toolchain@master
1023+
with:
1024+
toolchain: ${{ matrix.job.toolchain }}
1025+
components: rustfmt
1026+
- uses: taiki-e/install-action@v2
1027+
with:
1028+
tool: nextest,grcov@0.8.24
1029+
- uses: Swatinem/rust-cache@v2
1030+
1031+
- name: Run sccache-cache
1032+
uses: mozilla-actions/sccache-action@v0.0.9
1033+
1034+
# - name: Reattach HEAD ## may be needed for accurate code coverage info
1035+
# run: git checkout ${{ github.head_ref }}
1036+
1037+
- name: Initialize workflow variables
1038+
id: vars
1039+
shell: bash
1040+
run: |
1041+
## VARs setup
1042+
outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; }
1043+
1044+
# toolchain
1045+
TOOLCHAIN="nightly" ## default to "nightly" toolchain (required for certain required unstable compiler flags) ## !maint: refactor when stable channel has needed support
1046+
1047+
# * specify gnu-type TOOLCHAIN for windows; `grcov` requires gnu-style code coverage data files
1048+
case ${{ matrix.job.os }} in windows-*) TOOLCHAIN="$TOOLCHAIN-x86_64-pc-windows-gnu" ;; esac;
1049+
1050+
# * use requested TOOLCHAIN if specified
1051+
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
1052+
outputs TOOLCHAIN
1053+
1054+
# target-specific options
1055+
1056+
# * CARGO_FEATURES_OPTION
1057+
CARGO_FEATURES_OPTION='--all-features' ; ## default to '--all-features' for code coverage
1058+
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ; fi
1059+
outputs CARGO_FEATURES_OPTION
1060+
1061+
# * CODECOV_FLAGS
1062+
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
1063+
outputs CODECOV_FLAGS
1064+
1065+
- name: Install/setup prerequisites
1066+
shell: bash
1067+
run: |
1068+
## Install/setup prerequisites
1069+
case '${{ matrix.job.os }}' in
1070+
macos-latest) brew install coreutils ;; # needed for testing
1071+
esac
1072+
1073+
case '${{ matrix.job.os }}' in
1074+
ubuntu-latest)
1075+
# pinky is a tool to show logged-in users from utmp, and gecos fields from /etc/passwd.
1076+
# In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands. The account also has empty gecos fields.
1077+
# To work around this for pinky tests, we create a fake login entry for the GH runner account...
1078+
FAKE_UTMP='[7] [999999] [tty2] [runner] [tty2] [] [0.0.0.0] [2022-02-22T22:22:22,222222+00:00]'
1079+
# ... by dumping the login records, adding our fake line, then reverse dumping ...
1080+
(utmpdump /var/run/utmp ; echo $FAKE_UTMP) | sudo utmpdump -r -o /var/run/utmp
1081+
# ... and add a full name to each account with a gecos field but no full name.
1082+
sudo sed -i 's/:,/:runner name,/' /etc/passwd
1083+
# We also create a couple optional files pinky looks for
1084+
touch /home/runner/.project
1085+
echo "foo" > /home/runner/.plan
1086+
;;
1087+
esac
1088+
1089+
case '${{ matrix.job.os }}' in
1090+
# Update binutils if MinGW due to https://github.com/rust-lang/rust/issues/112368
1091+
windows-latest) C:/msys64/usr/bin/pacman.exe -Sy --needed mingw-w64-x86_64-gcc --noconfirm ; echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH ;;
1092+
esac
1093+
1094+
## Install the llvm-tools component to get access to `llvm-profdata`
1095+
rustup component add llvm-tools
1096+
1097+
- name: Run test and coverage
1098+
id: run_test_cov
1099+
run: |
1100+
outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; }
1101+
1102+
# Run the coverage script
1103+
./util/build-run-test-coverage-linux.sh
1104+
1105+
outputs REPORT_FILE
1106+
env:
1107+
COVERAGE_DIR: ${{ github.workspace }}/coverage
1108+
FEATURES_OPTION: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
1109+
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
1110+
1111+
- name: Upload coverage results (to Codecov.io)
1112+
uses: codecov/codecov-action@v5
1113+
with:
1114+
token: ${{ secrets.CODECOV_TOKEN }}
1115+
file: ${{ steps.run_test_cov.outputs.report }}
1116+
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
1117+
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
1118+
name: codecov-umbrella
1119+
fail_ci_if_error: false
1120+
10001121
test_separately:
10011122
name: Separate Builds
10021123
runs-on: ${{ matrix.os }}

.github/workflows/FixPR.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ jobs:
4343
- name: Ensure updated 'Cargo.lock'
4444
shell: bash
4545
run: |
46-
# Ensure updated 'Cargo.lock'
47-
# * 'Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
48-
cargo fetch --locked --quiet || cargo +${{ steps.vars.outputs.RUST_MIN_SRV }} update
46+
# Ensure updated '*/Cargo.lock'
47+
# * '*/Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
48+
for dir in "." "fuzz"; do
49+
( cd "$dir" && (cargo fetch --locked --quiet || cargo +${{ steps.vars.outputs.RUST_MIN_SRV }} update) )
50+
done
4951
- name: Info
5052
shell: bash
5153
run: |
@@ -71,8 +73,8 @@ jobs:
7173
with:
7274
new_branch: ${{ env.BRANCH_TARGET }}
7375
default_author: github_actions
74-
message: "maint ~ refresh 'Cargo.lock'"
75-
add: Cargo.lock
76+
message: "maint ~ refresh 'Cargo.lock' 'fuzz/Cargo.lock'"
77+
add: Cargo.lock fuzz/Cargo.lock
7678
env:
7779
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7880

.github/workflows/freebsd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Run sccache-cache
4242
uses: mozilla-actions/sccache-action@v0.0.9
4343
- name: Prepare, build and test
44-
uses: vmactions/freebsd-vm@v1.1.9
44+
uses: vmactions/freebsd-vm@v1.2.0
4545
with:
4646
usesh: true
4747
sync: rsync
@@ -135,7 +135,7 @@ jobs:
135135
- name: Run sccache-cache
136136
uses: mozilla-actions/sccache-action@v0.0.9
137137
- name: Prepare, build and test
138-
uses: vmactions/freebsd-vm@v1.1.9
138+
uses: vmactions/freebsd-vm@v1.2.0
139139
with:
140140
usesh: true
141141
sync: rsync

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# spell-checker:ignore (misc) direnv
22

33
target/
4+
coverage/
45
/src/*/gen_table
56
/build/
67
/tmp/

0 commit comments

Comments
 (0)