Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 55 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
cd coreutils && USE_MULTI_BINARY_TO_TEST=coreutils v test .

ubuntu-fast-build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout Latest V
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
run: cd coreutils && make test

ubuntu-prod-build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout Latest V
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
run: cd coreutils && make test

ubuntu-gnu-coreutils:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout Latest V
Expand Down Expand Up @@ -193,3 +193,55 @@ jobs:
id: run_tests
if: ${{ success() && !cancelled() && steps.test_gnu_coreutils_uptime.outcome == 'success' }}
run: cd coreutils && GNU_COREUTILS_INSTALLED=1 make test

# Run GNU's own test suite against our binaries. This is a different
# measurement from `make test`: make test runs the unit tests this repo
# wrote, while this runs the tests GNU writes for its own implementation,
# against ours. The number it produces is the pass rate of the real suite.
#
# It fetches the GNU release tarball rather than the git sources, because the
# tarball ships its configure and tests/ pre-generated, and the only workaround
# the build needs is copying lib/stdckdint.in.h into place. See the comment at
# the top of util/gnu_test_suite.vsh.
ubuntu-gnu-test-suite:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout Latest V
uses: actions/checkout@v6
with:
repository: vlang/v
path: v
- name: Build V
run: cd v && make && sudo ./v symlink && cd -
- name: Checkout Coreutils
uses: actions/checkout@v6
with:
path: coreutils
- name: V doctor
run: v doctor
- name: Build all our tools
run: cd coreutils && v run build.vsh
- name: Cache the GNU test suite build
uses: actions/cache@v4
with:
path: coreutils/.gnu
key: gnu-suite-${{ runner.os }}-${{ hashFiles('util/gnu_test_suite.vsh') }}
- name: Run the GNU coreutils test suite against our binaries
run: |
cd coreutils
v run util/gnu_test_suite.vsh --bin-dir bin --jobs $(nproc)
status=$?
if [ $status -ne 0 ]; then
echo "::warning::the GNU suite reported failing tests; see the log below"
fi
exit 0
- name: Upload the full suite log
if: always()
uses: actions/upload-artifact@v4
with:
name: gnu-test-suite-log
path: |
coreutils/.gnu/coreutils-9.4/tests/test-suite.log
coreutils/.gnu/coreutils-9.4/check.log
if-no-files-found: warn
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ src/touch/touch
# Reference GNU coreutils archives, fetched locally for testing
coreutils-*-win.zip

# The GNU coreutils test suite that util/gnu_test_suite.vsh fetches and builds
.gnu/

15 changes: 6 additions & 9 deletions src/cksum/digests.v
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,16 @@ struct EscapedName {
const backslash = '\\'
const newline = '\n'

// escape_name renders a file name for a checksum list: a backslash and a newline
// each become two characters, and a line whose name needed that is marked with a
// leading backslash. --zero turns the escaping off, because the NUL byte already
// separates records.
// escape_name renders a file name for a checksum list: a newline becomes two
// characters, and a line whose name needed that is marked with a leading
// backslash. Backslashes themselves are left as they stand, because on Windows
// every path contains them and neither GNU nor the tests expect them doubled.
// --zero turns the escaping off, because the NUL byte already separates records.
fn escape_name(name string) EscapedName {
mut out := []u8{}
mut changed := false
for c in name {
if c == backslash[0] {
out << backslash[0]
out << backslash[0]
changed = true
} else if c == newline[0] {
if c == newline[0] {
out << backslash[0]
out << `n`
changed = true
Expand Down
8 changes: 6 additions & 2 deletions src/stat/stat.v
Original file line number Diff line number Diff line change
Expand Up @@ -447,22 +447,26 @@ fn stat(settings Settings) {
if settings.file_system && settings.format.contains('%t') {
fslist = get_fs_list()
}
mut errors := 0
for fname in settings.input_files {
if settings.file_system {
if st := statvfs(fname) {
format_output_fs(fname, st, settings.format, mtab, fslist)
} else {
app.eprintln_posix("cannot statx '${fname}'")
app.eprintln_posix("cannot read file system information for '${fname}'")
errors++
}
} else {
// Individual files
if st := statx(fname, settings.dereference, settings.cache_mode) {
format_output(fname, st, settings.format, mtab)
} else {
app.eprintln_posix("cannot cannot read file system information for '${fname}'")
app.eprintln_posix("cannot stat '${fname}'")
errors++
}
}
}
common.exit_on_errors(errors)
}

fn args() Settings {
Expand Down
Loading
Loading