mirror of
https://github.com/uutils/coreutils
synced 2024-12-15 15:52:42 +00:00
882b5ad1f1
Co-authored-by: Michael Debertol <michael.debertol@gmail.com>
131 lines
4.6 KiB
YAML
131 lines
4.6 KiB
YAML
name: GnuTests
|
|
|
|
# spell-checker:ignore (names) gnulib ; (utils) autopoint gperf pyinotify texinfo ; (vars) XPASS
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
gnu:
|
|
name: Run GNU tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code uutil
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: 'uutils'
|
|
- name: Checkout GNU coreutils
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: 'coreutils/coreutils'
|
|
path: 'gnu'
|
|
ref: v8.32
|
|
- name: Checkout GNU coreutils library (gnulib)
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: 'coreutils/gnulib'
|
|
path: 'gnulib'
|
|
ref: 8e99f24c0931a38880c6ee9b8287c7da80b0036b
|
|
fetch-depth: 0 # gnu gets upset if gnulib is a shallow checkout
|
|
- name: Install `rust` toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
default: true
|
|
profile: minimal # minimal component installation (ie, no documentation)
|
|
components: rustfmt
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: |
|
|
## Install dependencies
|
|
sudo apt-get update
|
|
sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx jq
|
|
- name: Build binaries
|
|
shell: bash
|
|
run: |
|
|
## Build binaries
|
|
cd uutils
|
|
bash util/build-gnu.sh
|
|
- name: Run GNU tests
|
|
shell: bash
|
|
run: |
|
|
bash uutils/util/run-gnu-test.sh
|
|
- name: Extract testing info
|
|
shell: bash
|
|
run: |
|
|
## Extract testing info
|
|
LOG_FILE=gnu/tests/test-suite.log
|
|
if test -f "$LOG_FILE"
|
|
then
|
|
TOTAL=$(sed -n "s/.*# TOTAL: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1)
|
|
PASS=$(sed -n "s/.*# PASS: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1)
|
|
SKIP=$(sed -n "s/.*# SKIP: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1)
|
|
FAIL=$(sed -n "s/.*# FAIL: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1)
|
|
XPASS=$(sed -n "s/.*# XPASS: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1)
|
|
ERROR=$(sed -n "s/.*# ERROR: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1)
|
|
if [[ "$TOTAL" -eq 0 || "$TOTAL" -eq 1 ]]; then
|
|
echo "Error in the execution, failing early"
|
|
exit 1
|
|
fi
|
|
output="GNU tests summary = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR"
|
|
echo "${output}"
|
|
if [[ "$FAIL" -gt 0 || "$ERROR" -gt 0 ]]; then echo "::warning ::${output}" ; fi
|
|
jq -n \
|
|
--arg date "$(date --rfc-email)" \
|
|
--arg sha "$GITHUB_SHA" \
|
|
--arg total "$TOTAL" \
|
|
--arg pass "$PASS" \
|
|
--arg skip "$SKIP" \
|
|
--arg fail "$FAIL" \
|
|
--arg xpass "$XPASS" \
|
|
--arg error "$ERROR" \
|
|
'{($date): { sha: $sha, total: $total, pass: $pass, skip: $skip, fail: $fail, xpass: $xpass, error: $error, }}' > gnu-result.json
|
|
else
|
|
echo "::error ::Failed to get summary of test results"
|
|
fi
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: test-report
|
|
path: gnu/tests/**/*.log
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: gnu-result
|
|
path: gnu-result.json
|
|
- name: Download the result
|
|
uses: dawidd6/action-download-artifact@v2
|
|
with:
|
|
workflow: GnuTests.yml
|
|
name: gnu-result
|
|
repo: uutils/coreutils
|
|
branch: master
|
|
path: dl
|
|
- name: Download the log
|
|
uses: dawidd6/action-download-artifact@v2
|
|
with:
|
|
workflow: GnuTests.yml
|
|
name: test-report
|
|
repo: uutils/coreutils
|
|
branch: master
|
|
path: dl
|
|
- name: Compare failing tests against master
|
|
shell: bash
|
|
run: |
|
|
OLD_FAILING=$(sed -n "s/^FAIL: \([[:print:]]\+\).*/\1/p" dl/test-suite.log | sort)
|
|
NEW_FAILING=$(sed -n "s/^FAIL: \([[:print:]]\+\).*/\1/p" gnu/tests/test-suite.log | sort)
|
|
for LINE in $OLD_FAILING
|
|
do
|
|
if ! grep -Fxq $LINE<<<"$NEW_FAILING"; then
|
|
echo "::warning ::Congrats! The gnu test $LINE is now passing!"
|
|
fi
|
|
done
|
|
for LINE in $NEW_FAILING
|
|
do
|
|
if ! grep -Fxq $LINE<<<"$OLD_FAILING"
|
|
then
|
|
echo "::error ::GNU test failed: $LINE. $LINE is passing on 'master'. Maybe you have to rebase?"
|
|
fi
|
|
done
|
|
- name: Compare against master results
|
|
shell: bash
|
|
run: |
|
|
mv dl/gnu-result.json master-gnu-result.json
|
|
python uutils/util/compare_gnu_result.py
|