Skip to content
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

Polish gnu tests #1766

Merged
merged 35 commits into from
Mar 22, 2021
Merged

Polish gnu tests #1766

merged 35 commits into from
Mar 22, 2021

Conversation

jaggededgedjustice
Copy link
Contributor

This Makes some improvements to the gnu tests:

  • Apply timeout to each test so we do not need to remove any test that hangs
  • Use system utility in some tests that had failures due to utilities that weren't the focus of the test
  • Copy hashsum to create the *sum binaries so they can be tested
  • Find any GNU binary that has not been built and copy falseto it so that the relevant tests will fail
  • remove unbuffer from the test run as it was causing hangs that even the top timeout didn't kill and it didn't offer noticeable benefit

@@ -83,7 +104,7 @@ jobs:
GNULIB_DIR="${PWD}/gnulib"
pushd gnu

unbuffer timeout -sKILL 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || :
timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4h ? :)
1h seems enough, no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really, run time for the 'Run GNU tests' stage was 1 hour 9 minutes on the last commit before I opened the PR (adding some shorter timeouts on a few more tests known to hang could speed things up a bit). I'm not worried about making this as sort as possible, with the timeout being applied per-test this was just left as a last resort in case something in make gets jammed.
It turns out there's a built in 6 hour limit on github actions, so we could also take this out and rely on that if something does get break.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 2 hours then. Also, expect can now be removed from the apt-get install line above, since you are removing the unbuffer command.

@jaggededgedjustice
Copy link
Contributor Author

jaggededgedjustice commented Mar 7, 2021

@tdulcet what do you think of these changes?

There are some tests that currently fail due to differences in the exact wording of error messages, which I'm not sure what to do with. They shouldn't be removed because they include tests on behaviour that must be kept, but editing the messages being checked against might be a lot of work to keep up to date as people change the code.

@sylvestre
Copy link
Sponsor Contributor

With this patch, we are at PASS: 121 (used to be PASS: 141)
is that expected?

@jaggededgedjustice
Copy link
Contributor Author

Those are probably the tests that were running on utils that aren't built in this repo, those would have been using the system util before and passing. Let me just review the changes to confirm that is what's happened.

@jaggededgedjustice
Copy link
Contributor Author

jaggededgedjustice commented Mar 7, 2021

I found 2 tests that were failing because they were using utils that aren't built so they were using false. There's also some problem with the stty tests, which now complain they don't have controlling tty, I need to investigate what's up with that.
Otherwise the reduced passes are legitimate.

Copy link

@tdulcet tdulcet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tdulcet what do you think of these changes?

Your changes look good. Thanks for doing this! I just have some minor feedback.

for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs)
do
bin_path="${BUILDDIR}/${binary}"
test -f "${bin_path}" || cp "${BUILDDIR}/false" "${bin_path}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe output the names of all binaries that are not currently built for reference. Something like this:

test -f "${bin_path}" || { echo "'${binary}' was not built with uutils, using the 'false' program"; cp "${BUILDDIR}/false" "${bin_path}"; }

# Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils
sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile
sed -i 's| tr | /usr/bin/tr |' tests/init.sh
make
# Generate the factor tests, so they can be fixed
for i in $(seq -w 1 36)
for i in $(seq -w 0 36)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done in Bash without seq:

for i in {00..36}

Comment on lines 84 to 96
sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh
sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh
sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh
sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh
sed -i -e "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout'
sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh
sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh
sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh
sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh

#Add specific timeout to tests that currently hang to limit time spent waiting
sed -i -e "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh
sed -i -e "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh
Copy link

@tdulcet tdulcet Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -e flags are not needed here. The which commands are also not needed, since the GNU coreutils should always be in /usr/bin/.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some problem with commands not being found which is why I started using which, though that might have been a typo so I'll have another try.

@@ -83,7 +104,7 @@ jobs:
GNULIB_DIR="${PWD}/gnulib"
pushd gnu

unbuffer timeout -sKILL 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || :
timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 2 hours then. Also, expect can now be removed from the apt-get install line above, since you are removing the unbuffer command.

@@ -83,7 +104,7 @@ jobs:
GNULIB_DIR="${PWD}/gnulib"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the above variable is not used. Same with SKIP and XPASS variables below.

@@ -38,42 +38,63 @@ jobs:
pushd uutils
make PROFILE=release
BUILDDIR="$PWD/target/release/"
cp ${BUILDDIR}/install ${BUILDDIR}/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${BUILDDIR} should be quoted in case the path contains spaces.

@sylvestre
Copy link
Sponsor Contributor

The log is huge (207m), would it be possible to trim some of the content ?
For example, thousands of line of

2021-03-07T15:17:56.3511831Z +999999999999999943801810948794571024057224129020550531544123892056457216
2021-03-07T15:17:56.3512143Z +999999999999999943801810948794571024057224129020550531544123892056457216
2021-03-07T15:17:56.3512467Z +999999999999999943801810948794571024057224129020550531544123892056457216
..

@jaggededgedjustice
Copy link
Contributor Author

I'm not sure about how to trim that, it could be deleted from the log that gets included in the 'test-report' archive I guess but it'd still get printed in the output. The best fix is to wait for @Arcterus to finish the fix for #1703.

@Arcterus
Copy link
Collaborator

Arcterus commented Mar 9, 2021

Yeah, sorry for the delay on that. I should have time this weekend to finish cleaning it up. It’s in a pretty decent state already, so I don’t think it’ll take very long to do so.

@chadbrewbaker
Copy link
Contributor

Can we log the GNU tests to flat shell scripts to decouple them from the Perl like the AWK test suite?

https://blog.janestreet.com/testing-with-expectations/

https://www.cs.princeton.edu/courses/archive/spring01/cs333/awktest.html

@chadbrewbaker
Copy link
Contributor

The log is huge (207m), would it be possible to trim some of the content ?
For example, thousands of line of

2021-03-07T15:17:56.3511831Z +999999999999999943801810948794571024057224129020550531544123892056457216
2021-03-07T15:17:56.3512143Z +999999999999999943801810948794571024057224129020550531544123892056457216
2021-03-07T15:17:56.3512467Z +999999999999999943801810948794571024057224129020550531544123892056457216
..

Large logs should be compressed by default. Personal preference for zstd because you can give it a dictionary to reduce the size even more.

@jaggededgedjustice
Copy link
Contributor Author

jaggededgedjustice commented Mar 13, 2021

Can we log the GNU tests to flat shell scripts to decouple them from the Perl like the AWK test suite?

https://blog.janestreet.com/testing-with-expectations/

https://www.cs.princeton.edu/courses/archive/spring01/cs333/awktest.html

The idea here is to run the GNU tests so we can compare the current implementation to the GNU implementation, so we want to be taking their tests directly so that this is kept up to date with the current behaviour of the GNU coreutils. This is why the tests are taken from a current checkout of the GNU repo, and means we should be looking to make the fewest changes necessary to make sure they run correctly. Converting tests from Perl to shell scripts would require us to copy the tests into this repo and then try to maintain them ourselves. I do not think that is something that should be done. Further, even if we were to decide to maintain our own fork of the GNU tests I don't see what benefit converting existing tests from Perl to shell would provide.

Large logs should be compressed by default. Personal preference for zstd because you can give it a dictionary to reduce the size even more.

Github will be compressing the archive on their backend (I assume, it'd be the only way to keep storage manageable) so I'm not sure adding our own compression would help. Further it'd mean anyone attempting to access the archive will now need to deal with 2 layers of compression (the zst on individual files plus the zip you download the archive as). The best solution is to fix the bug that is causing seq to hang so there aren't any large logs to worry about.

@sylvestre
Copy link
Sponsor Contributor

@jaggededgedjustice can it be merged?
thanks

@jaggededgedjustice
Copy link
Contributor Author

I think this can be merged now, I'm just going to do a final review of the results after the latest changes.

@sylvestre
Copy link
Sponsor Contributor

@jaggededgedjustice looks good to me :)
please let me know if you want me to land it!

@sylvestre
Copy link
Sponsor Contributor

@jaggededgedjustice can it be merged? It is green
thanks

@jaggededgedjustice jaggededgedjustice marked this pull request as ready for review March 22, 2021 19:17
@jaggededgedjustice
Copy link
Contributor Author

ok, this is good to go.

@sylvestre sylvestre merged commit 9ffcfcd into uutils:master Mar 22, 2021
@tdulcet
Copy link

tdulcet commented Mar 23, 2021

The GNU tests are failing with this error:

gawk: cmd. line:1: (FILENAME=- FNR=173) fatal: node.c:415:make_str_node: r->stptr: can't allocate -2147483645 bytes of memory (Cannot allocate memory)

before they finish and output the results, which is why "Extract test info" step is failing and 4352d47 was necessary.

@sylvestre
Copy link
Sponsor Contributor

@tdulcet see #1842 (comment) from @nbraud

@jaggededgedjustice
Copy link
Contributor Author

Issue #1879 is the root cause of the failure in gawk.

@jaggededgedjustice
Copy link
Contributor Author

Though following on from the comment on the other PR, would it be better to have the GNU tests run on a cron rather than every PR? It's mostly an informational resource at the moment and isn't useful for deciding if a PR is good to merge as basically everything is failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants