Merge branch 'main' into cp-lb

This commit is contained in:
Sylvestre Ledru
2022-02-20 10:31:13 +01:00
committed by GitHub
192 changed files with 6336 additions and 3125 deletions
+9
View File
@@ -1,2 +1,11 @@
[target.x86_64-unknown-redox]
linker = "x86_64-unknown-redox-gcc"
[target.'cfg(feature = "cargo-clippy")']
rustflags = [
"-Wclippy::use_self",
"-Wclippy::needless_pass_by_value",
"-Wclippy::semicolon_if_nothing_returned",
"-Wclippy::single_char_pattern",
"-Wclippy::explicit_iter_loop",
]
+28 -6
View File
@@ -1,4 +1,4 @@
# EditorConfig (is awesome): http://EditorConfig.org
# EditorConfig (is awesome!; ref: http://EditorConfig.org; v2022.02.11 [rivy])
# * top-most EditorConfig file
root = true
@@ -13,27 +13,49 @@ insert_final_newline = true
max_line_length = 100
trim_trailing_whitespace = true
[[Mm]akefile{,.*}, *.{mk,[Mm][Kk]}]
[{[Mm]akefile{,.*},*.{mak,mk,[Mm][Aa][Kk],[Mm][Kk]},[Gg][Nn][Uu]makefile}]
# makefiles ~ TAB-style indentation
indent_style = tab
[*.bash]
# `bash` shell scripts
indent_size = 4
indent_style = space
# * ref: <https://github.com/foxundermoon/vs-shell-format/blob/bc56a8e367b04bbf7d9947b767dc82516a6155b7/src/shFormat.ts>
# shell_variant = bash ## allow `shellcheck` to decide via script hash-bang/sha-bang line
switch_case_indent = true
[*.{bat,cmd,[Bb][Aa][Tt],[Cc][Mm][Dd]}]
# BAT/CMD ~ DOS/Win requires BAT/CMD files to have CRLF EOLNs
end_of_line = crlf
[*.{cjs,cjx,cts,ctx,js,jsx,mjs,mts,mtx,ts,tsx,json,jsonc}]
# js/ts/json ~ Prettier/XO-style == TAB indention + SPACE alignment
indent_size = 2
indent_style = tab
[*.go]
# go ~ TAB-style indentation (SPACE-style alignment); ref: <https://blog.golang.org/gofmt>@@<https://archive.is/wip/9B6FC>
indent_style = tab
[*.{cjs,js,json,mjs,ts}]
# js/ts
indent_size = 2
[*.{markdown,md,mkd,[Mm][Dd],[Mm][Kk][Dd],[Mm][Dd][Oo][Ww][Nn],[Mm][Kk][Dd][Oo][Ww][Nn],[Mm][Aa][Rr][Kk][Dd][Oo][Ww][Nn]}]
# markdown
indent_size = 2
indent_style = space
[*.sh]
# POSIX shell scripts
indent_size = 4
indent_style = space
# * ref: <https://github.com/foxundermoon/vs-shell-format/blob/bc56a8e367b04bbf7d9947b767dc82516a6155b7/src/shFormat.ts>
# shell_variant = posix ## allow `shellcheck` to decide via script hash-bang/sha-bang line
switch_case_indent = true
[*.{sln,vc{,x}proj{,.*},[Ss][Ln][Nn],[Vv][Cc]{,[Xx]}[Pp][Rr][Oo][Jj]{,.*}}]
# MSVC sln/vcproj/vcxproj files, when used, will persistantly revert to CRLF EOLNs and eat final EOLs
end_of_line = crlf
insert_final_newline = false
[*.{yaml,yml,[Yy][Mm][Ll],[Yy][Aa][Mm][Ll]}]
# YAML
indent_size = 2
+9 -2
View File
@@ -1,10 +1,10 @@
name: CICD
# spell-checker:ignore (acronyms) CICD MSVC musl
# spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic RUSTDOCFLAGS RUSTFLAGS Zpanic
# spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic
# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain
# spell-checker:ignore (names) CodeCOV MacOS MinGW Peltoche rivy
# spell-checker:ignore (shell/tools) choco clippy dmake dpkg esac fakeroot gmake grcov halium lcov libssl mkdir popd printf pushd rustc rustfmt rustup shopt xargs
# spell-checker:ignore (shell/tools) choco clippy dmake dpkg esac fakeroot gmake grcov halium lcov libssl mkdir popd printf pushd rsync rustc rustfmt rustup shopt xargs
# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils gnueabihf issuecomment maint nullglob onexitbegin onexitend pell runtest tempfile testsuite uutils DESTDIR sizemulti
# ToDO: [2021-06; rivy] change from `cargo-tree` to `cargo tree` once MSRV is >= 1.45
@@ -340,6 +340,13 @@ jobs:
## Confirm MinSRV compatible 'Cargo.lock'
# * 'Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
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 ; }
- name: Confirm MinSRV equivalence for '.clippy.toml'
shell: bash
run: |
## Confirm MinSRV equivalence for '.clippy.toml'
# * ensure '.clippy.toml' MSRV configuration setting is equal to ${{ env.RUST_MIN_SRV }}
CLIPPY_MSRV=$(grep -P "(?i)^\s*msrv\s*=\s*" .clippy.toml | grep -oP "\d+([.]\d+)+")
if [ "${CLIPPY_MSRV}" != "${{ env.RUST_MIN_SRV }}" ]; then { echo "::error file=.clippy.toml::Incorrect MSRV configuration for clippy (found '${CLIPPY_MSRV}'; should be '${{ env.RUST_MIN_SRV }}'); update '.clippy.toml' with 'msrv = \"${{ env.RUST_MIN_SRV }}\"'" ; exit 1 ; } ; fi
- name: Info
shell: bash
run: |
+135 -67
View File
@@ -1,6 +1,6 @@
name: GnuTests
# spell-checker:ignore (names) gnulib ; (utils) autopoint gperf pyinotify texinfo ; (vars) XPASS
# spell-checker:ignore (names) gnulib ; (jargon) submodules ; (people) Dawid Dziurla * dawidd ; (utils) autopoint chksum gperf pyinotify shopt texinfo ; (vars) FILESET XPASS
on: [push, pull_request]
@@ -9,23 +9,52 @@ jobs:
name: Run GNU tests
runs-on: ubuntu-latest
steps:
- name: Checkout code uutil
- name: Initialize workflow variables
id: vars
shell: bash
run: |
## VARs setup
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# * config
path_GNU="gnu"
path_GNU_tests="${path_GNU}/tests"
path_UUTILS="uutils"
path_reference="reference"
outputs path_GNU path_GNU_tests path_reference path_UUTILS
#
repo_default_branch="${{ github.event.repository.default_branch }}"
repo_GNU_ref="v9.0"
repo_reference_branch="${{ github.event.repository.default_branch }}"
outputs repo_default_branch repo_GNU_ref repo_reference_branch
#
SUITE_LOG_FILE="${path_GNU_tests}/test-suite.log"
TEST_LOGS_GLOB="${path_GNU_tests}/**/*.log" ## note: not usable at bash CLI; [why] double globstar not enabled by default b/c MacOS includes only bash v3 which doesn't have double globstar support
TEST_FILESET_PREFIX='test-fileset-IDs.sha1#'
TEST_FILESET_SUFFIX='.txt'
TEST_SUMMARY_FILE='gnu-result.json'
TEST_FULL_SUMMARY_FILE='gnu-full-result.json'
outputs SUITE_LOG_FILE TEST_FILESET_PREFIX TEST_FILESET_SUFFIX TEST_LOGS_GLOB TEST_SUMMARY_FILE TEST_FULL_SUMMARY_FILE
- name: Checkout code (uutil)
uses: actions/checkout@v2
with:
path: 'uutils'
- name: Checkout GNU coreutils
path: '${{ steps.vars.outputs.path_UUTILS }}'
- name: Checkout code (GNU coreutils)
uses: actions/checkout@v2
with:
repository: 'coreutils/coreutils'
path: 'gnu'
ref: v9.0
- name: Checkout GNU coreutils library (gnulib)
uses: actions/checkout@v2
path: '${{ steps.vars.outputs.path_GNU }}'
ref: ${{ steps.vars.outputs.repo_GNU_ref }}
submodules: recursive
- name: Retrieve reference artifacts
uses: dawidd6/action-download-artifact@v2
# ref: <https://github.com/dawidd6/action-download-artifact>
continue-on-error: true ## don't break the build for missing reference artifacts (may be expired or just not generated yet)
with:
repository: 'coreutils/gnulib'
path: 'gnulib'
ref: 8e99f24c0931a38880c6ee9b8287c7da80b0036b
fetch-depth: 0 # gnu gets upset if gnulib is a shallow checkout
workflow: GnuTests.yml
branch: "${{ steps.vars.outputs.repo_reference_branch }}"
# workflow_conclusion: success ## (default); * but, if commit with failed GnuTests is merged into the default branch, future commits will all show regression errors in GnuTests CI until o/w fixed
workflow_conclusion: completed ## continually recalibrates to last commit of default branch with a successful GnuTests (ie, "self-heals" from GnuTest regressions, but needs more supervision for/of regressions)
path: "${{ steps.vars.outputs.path_reference }}"
- name: Install `rust` toolchain
uses: actions-rs/toolchain@v1
with:
@@ -39,32 +68,55 @@ jobs:
## Install dependencies
sudo apt-get update
sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify jq
- name: Add various locales
shell: bash
run: |
echo "Before:"
locale -a
## Some tests fail with 'cannot change locale (en_US.ISO-8859-1): No such file or directory'
## Some others need a French locale
sudo locale-gen
sudo locale-gen fr_FR
sudo locale-gen fr_FR.UTF-8
sudo update-locale
echo "After:"
locale -a
- name: Build binaries
shell: bash
run: |
## Build binaries
cd uutils
cd '${{ steps.vars.outputs.path_UUTILS }}'
bash util/build-gnu.sh
- name: Run GNU tests
shell: bash
run: |
bash uutils/util/run-gnu-test.sh
- name: Extract testing info
path_GNU='${{ steps.vars.outputs.path_GNU }}'
path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
bash "${path_UUTILS}/util/run-gnu-test.sh"
- name: Extract testing info into JSON
shell: bash
run : |
path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
python ${path_UUTILS}/util/gnu-json-result.py ${{ steps.vars.outputs.path_GNU_tests }} > ${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}
- name: Extract/summarize testing info
id: summary
shell: bash
run: |
## Extract testing info
LOG_FILE=gnu/tests/test-suite.log
if test -f "$LOG_FILE"
## Extract/summarize testing info
outputs() { step_id="summary"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
#
SUITE_LOG_FILE='${{ steps.vars.outputs.SUITE_LOG_FILE }}'
if test -f "${SUITE_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)
TOTAL=$(sed -n "s/.*# TOTAL: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
PASS=$(sed -n "s/.*# PASS: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
SKIP=$(sed -n "s/.*# SKIP: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
FAIL=$(sed -n "s/.*# FAIL: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
XPASS=$(sed -n "s/.*# XPASS: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
ERROR=$(sed -n "s/.*# ERROR: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
if [[ "$TOTAL" -eq 0 || "$TOTAL" -eq 1 ]]; then
echo "Error in the execution, failing early"
exit 1
echo "::error ::Failed to parse test results from '${SUITE_LOG_FILE}'; failing early"
exit 1
fi
output="GNU tests summary = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR"
echo "${output}"
@@ -78,54 +130,70 @@ jobs:
--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
'{($date): { sha: $sha, total: $total, pass: $pass, skip: $skip, fail: $fail, xpass: $xpass, error: $error, }}' > '${{ steps.vars.outputs.TEST_SUMMARY_FILE }}'
HASH=$(sha1sum '${{ steps.vars.outputs.TEST_SUMMARY_FILE }}' | cut --delim=" " -f 1)
outputs HASH
else
echo "::error ::Failed to get summary of test results"
echo "::error ::Failed to find summary of test results (missing '${SUITE_LOG_FILE}'); failing early"
exit 1
fi
- uses: actions/upload-artifact@v2
- name: Reserve SHA1/ID of 'test-summary'
uses: actions/upload-artifact@v2
with:
name: test-report
path: gnu/tests/**/*.log
- uses: actions/upload-artifact@v2
name: "${{ steps.summary.outputs.HASH }}"
path: "${{ steps.vars.outputs.TEST_SUMMARY_FILE }}"
- name: Reserve test results summary
uses: actions/upload-artifact@v2
with:
name: gnu-result
path: gnu-result.json
- name: Download the result
uses: dawidd6/action-download-artifact@v2
name: test-summary
path: "${{ steps.vars.outputs.TEST_SUMMARY_FILE }}"
- name: Reserve test logs
uses: actions/upload-artifact@v2
with:
workflow: GnuTests.yml
name: gnu-result
repo: uutils/coreutils
branch: main
path: dl
- name: Download the log
uses: dawidd6/action-download-artifact@v2
name: test-logs
path: "${{ steps.vars.outputs.TEST_LOGS_GLOB }}"
- name: Upload full json results
uses: actions/upload-artifact@v2
with:
workflow: GnuTests.yml
name: test-report
repo: uutils/coreutils
branch: main
path: dl
- name: Compare failing tests against main
name: gnu-full-result.json
path: ${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}
- name: Compare test failures VS reference
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 'main'. Maybe you have to rebase?"
fi
done
- name: Compare against main results
have_new_failures=""
REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/test-suite.log'
REF_SUMMARY_FILE='${{ steps.vars.outputs.path_reference }}/test-summary/gnu-result.json'
if test -f "${REF_LOG_FILE}"; then
echo "Reference SHA1/ID: $(sha1sum -- "${REF_SUMMARY_FILE}")"
REF_FAILING=$(sed -n "s/^FAIL: \([[:print:]]\+\).*/\1/p" "${REF_LOG_FILE}" | sort)
NEW_FAILING=$(sed -n "s/^FAIL: \([[:print:]]\+\).*/\1/p" '${{ steps.vars.outputs.path_GNU_tests }}/test-suite.log' | sort)
for LINE in ${REF_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}<<<"${REF_FAILING}"
then
echo "::error ::GNU test failed: ${LINE}. ${LINE} is passing on '${{ steps.vars.outputs.repo_default_branch }}'. Maybe you have to rebase?"
have_new_failures="true"
fi
done
else
echo "::warning ::Skipping test failure comparison; no prior reference test logs are available."
fi
if test -n "${have_new_failures}" ; then exit -1 ; fi
- name: Compare test summary VS reference
if: success() || failure() # run regardless of prior step success/failure
shell: bash
run: |
mv dl/gnu-result.json main-gnu-result.json
python uutils/util/compare_gnu_result.py
REF_SUMMARY_FILE='${{ steps.vars.outputs.path_reference }}/test-summary/gnu-result.json'
if test -f "${REF_SUMMARY_FILE}"; then
echo "Reference SHA1/ID: $(sha1sum -- "${REF_SUMMARY_FILE}")"
mv "${REF_SUMMARY_FILE}" main-gnu-result.json
python uutils/util/compare_gnu_result.py
else
echo "::warning ::Skipping test summary comparison; no prior reference summary is available."
fi
+1
View File
@@ -0,0 +1 @@
# * using all default `cargo fmt`/`rustfmt` options
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
rustup target add x86_64-unknown-redox
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA12E97F0881517F
+2
View File
@@ -0,0 +1,2 @@
# Configure GitHub to not mark comments in configuration files as errors
*.json linguist-language=jsonc
+20 -6
View File
@@ -1,7 +1,12 @@
// `cspell` settings
{
"version": "0.1", // Version of the setting file. Always 0.1
"language": "en", // language - current active spelling language
// version of the setting file
"version": "0.2",
// spelling language
"language": "en",
// custom dictionaries
"dictionaries": ["acronyms+names", "jargon", "people", "shell", "workspace"],
"dictionaryDefinitions": [
{ "name": "acronyms+names", "path": "./cspell.dictionaries/acronyms+names.wordlist.txt" },
@@ -10,10 +15,19 @@
{ "name": "shell", "path": "./cspell.dictionaries/shell.wordlist.txt" },
{ "name": "workspace", "path": "./cspell.dictionaries/workspace.wordlist.txt" }
],
// ignorePaths - a list of globs to specify which files are to be ignored
"ignorePaths": ["Cargo.lock", "target/**", "tests/**/fixtures/**", "src/uu/dd/test-resources/**", "vendor/**"],
// ignoreWords - a list of words to be ignored (even if they are in the flagWords)
// files to ignore (globs supported)
"ignorePaths": [
"Cargo.lock",
"target/**",
"tests/**/fixtures/**",
"src/uu/dd/test-resources/**",
"vendor/**"
],
// words to ignore (even if they are in the flagWords)
"ignoreWords": [],
// words - list of words to be always considered correct
// words to always consider correct
"words": []
}
+1
View File
@@ -44,6 +44,7 @@ termsize
termwidth
textwrap
thiserror
ureq
walkdir
winapi
xattr
+9 -6
View File
@@ -1,10 +1,13 @@
// spell-checker:ignore (misc) matklad
// see <http://go.microsoft.com/fwlink/?LinkId=827846> for the documentation about the extensions.json format
// *
// "foxundermoon.shell-format" ~ shell script formatting ; note: ENABLE "Use EditorConfig"
// "matklad.rust-analyzer" ~ `rust` language support
// "streetsidesoftware.code-spell-checker" ~ `cspell` spell-checker support
{
"recommendations": [
// Rust language support.
"matklad.rust-analyzer",
// `cspell` spell-checker support
"streetsidesoftware.code-spell-checker"
]
"recommendations": [
"matklad.rust-analyzer",
"streetsidesoftware.code-spell-checker",
"foxundermoon.shell-format"
]
}
+1
View File
@@ -0,0 +1 @@
{ "cSpell.import": [".vscode/cspell.json"] }
Generated
+345 -10
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -252,6 +252,8 @@ lazy_static = { version="1.3" }
textwrap = { version="0.14", features=["terminal_size"] }
uucore = { version=">=0.0.11", package="uucore", path="src/uucore" }
selinux = { version="0.2", optional = true }
ureq = "2.4.0"
zip = { version = "0.5.13", default_features=false, features=["deflate"] }
# * uutils
uu_test = { optional=true, version="0.0.12", package="uu_test", path="src/uu/test" }
#
@@ -372,13 +374,14 @@ libc = "0.2"
pretty_assertions = "1"
rand = "0.8"
regex = "1.0"
sha1 = { version="0.6", features=["std"] }
sha1 = { version="0.10", features=["std"] }
tempfile = "3.2.0"
time = "0.1"
unindent = "0.1"
uucore = { version=">=0.0.11", package="uucore", path="src/uucore", features=["entries", "process"] }
walkdir = "2.2"
atty = "0.2"
hex-literal = "0.3.1"
[target.'cfg(target_os = "linux")'.dev-dependencies]
rlimit = "0.4.0"
+1
View File
@@ -62,6 +62,7 @@ PROGS := \
csplit \
cut \
date \
dd \
df \
dircolors \
dirname \
+4
View File
@@ -349,6 +349,10 @@ $ make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytest
### Comparing with GNU
Below is the evolution of how many GNU tests uutils passes. A more detailed
breakdown of the GNU test results of the main branch can be found
[in the user manual](https://uutils.github.io/coreutils-docs/user/test_coverage.html).
![Evolution over time](https://github.com/uutils/coreutils-tracking/blob/main/gnu-results.png?raw=true)
To run locally:
+2
View File
@@ -116,6 +116,8 @@ pub fn main() {
phf_map.entry("sha3-512sum", &map_value);
phf_map.entry("shake128sum", &map_value);
phf_map.entry("shake256sum", &map_value);
phf_map.entry("b2sum", &map_value);
phf_map.entry("b3sum", &map_value);
tf.write_all(
format!(
"#[path=\"{dir}/test_{krate}.rs\"]\nmod test_{krate};\n",
+4 -5
View File
@@ -1,5 +1,4 @@
UseGNU=gmake $*
all:
@$(UseGNU)
.DEFAULT:
@$(UseGNU)
clean:
rm -rf book
rm -f src/SUMMARY.md
rm -f src/utils/*
+46
View File
@@ -0,0 +1,46 @@
:root {
--PASS: #44AF69;
--ERROR: #F8333C;
--FAIL: #F8333C;
--SKIP: #d3c994;
}
.PASS {
color: var(--PASS);
}
.ERROR {
color: var(--ERROR);
}
.FAIL {
color: var(--FAIL);
}
.SKIP {
color: var(--SKIP);
}
.testSummary {
display: inline-flex;
align-items: center;
justify-content: space-between;
width: 90%;
}
.progress {
width: 80%;
display: flex;
justify-content: right;
align-items: center;
}
.progress-bar {
height: 10px;
width: calc(100% - 15ch);
border-radius: 5px;
}
.result {
font-weight: bold;
width: 7ch;
display: inline-block;
}
.result-line {
margin: 8px;
}
.counts {
margin-right: 10px;
}
+82
View File
@@ -0,0 +1,82 @@
// spell-checker:ignore hljs
function progressBar(totals) {
const bar = document.createElement("div");
bar.className = "progress-bar";
let totalTests = 0;
for (const [key, value] of Object.entries(totals)) {
totalTests += value;
}
const passPercentage = Math.round(100 * totals["PASS"] / totalTests);
const skipPercentage = passPercentage + Math.round(100 * totals["SKIP"] / totalTests);
// The ternary expressions are used for some edge-cases where there are no failing test,
// but still a red (or beige) line shows up because of how CSS draws gradients.
bar.style = `background: linear-gradient(
to right,
var(--PASS) ${passPercentage}%`
+ ( passPercentage === 100 ? ", var(--PASS)" :
`, var(--SKIP) ${passPercentage}%,
var(--SKIP) ${skipPercentage}%`
)
+ (skipPercentage === 100 ? ")" : ", var(--FAIL) 0)");
const progress = document.createElement("div");
progress.className = "progress"
progress.innerHTML = `
<span class="counts">
<span class="PASS">${totals["PASS"]}</span>
/
<span class="SKIP">${totals["SKIP"]}</span>
/
<span class="FAIL">${totals["FAIL"] + totals["ERROR"]}</span>
</span>
`;
progress.appendChild(bar);
return progress
}
function parse_result(parent, obj) {
const totals = {
PASS: 0,
SKIP: 0,
FAIL: 0,
ERROR: 0,
};
for (const [category, content] of Object.entries(obj)) {
if (typeof content === "string") {
const p = document.createElement("p");
p.className = "result-line";
totals[content]++;
p.innerHTML = `<span class="result" style="color: var(--${content})">${content}</span> ${category}`;
parent.appendChild(p);
} else {
const categoryName = document.createElement("code");
categoryName.innerHTML = category;
categoryName.className = "hljs";
const details = document.createElement("details");
const subtotals = parse_result(details, content);
for (const [subtotal, count] of Object.entries(subtotals)) {
totals[subtotal] += count;
}
const summaryDiv = document.createElement("div");
summaryDiv.className = "testSummary";
summaryDiv.appendChild(categoryName);
summaryDiv.appendChild(progressBar(subtotals));
const summary = document.createElement("summary");
summary.appendChild(summaryDiv);
details.appendChild(summary);
parent.appendChild(details);
}
}
return totals;
}
fetch("https://raw.githubusercontent.com/uutils/coreutils-tracking/main/gnu-full-result.json")
.then((r) => r.json())
.then((obj) => {
let parent = document.getElementById("test-cov");
parse_result(parent, obj);
});
+19
View File
@@ -0,0 +1,19 @@
# GNU Test Coverage
uutils is actively tested against the GNU coreutils test suite. The results
below are automatically updated every day.
## Coverage per category
Click on the categories to see the names of the tests. Green indicates a passing
test, yellow indicates a skipped test and red means that the test either failed
or resulted in an error.
<link rel="stylesheet" href="test_coverage.css">
<script src="test_coverage.js"></script>
<div id="test-cov"></div>
## Progress over time
<image src="https://github.com/uutils/coreutils-tracking/blob/main/gnu-results.png?raw=true">

Some files were not shown because too many files have changed in this diff Show More