8000 Convert README, INSTALL, and NEWS to Markdown files. by fel1x-developer · Pull Request #99 · freebsd/atf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Convert README, INSTALL, and NEWS to Markdown files. #99

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

Open
wants to merge 65 commits into
base: master
Choose a base branch
from

Conversation

fel1x-developer
Copy link
Contributor
@fel1x-developer fel1x-developer commented Dec 30, 2024

Similar to what I did for lutok (freebsd/lutok#11)

cemeyer and others added 30 commits November 25, 2024 14:28
This allows repeatedly polling some command until it succeeds, to some
timeout limit.
Sponsored by:   The FreeBSD Foundation
`expr ${OPTIND} - 1` can be replaced with $((OPTIND - 1)) to avoid spawning
a new processes. While it's unlikely to make much of a performance
difference for a single execution, it happens once for ever test case so
it will add up for a full testsuite run.
I have been trying to speed up the time it takes to run the testsuite for
CheriBSD on QEMU RISC-V (originally 22 hours). One of the slowest tests is
the pfctl test since ever single invocation of it spends ~90 seconds
generating the list of available tests (even when running only one test).
And this is after the change in r365708 that removes ~200 calls to
atf_get_srcdir(). Looking at truss output it turns out that using atf-sh
results in many tr processes being spawned to perform string substitution.

The _atf_normalize() function tries to remove characters that are not valid
in shell variable names by replacing . and - with _. However, most strings
passed to the function don't contain those characters, so we unnecessarily
fork() a new tr processes (which adds up to a significant slowdown).
With this change we only call tr if the variable contains one of the
illegal characters rather than unconditionally.

Ideally we would do this substitution using only shell builtins, but
unfortunately the string substitution syntax ${var//} is not supported by
POSIX sh and I am not aware of any alternatives.

Basic time measurements on CHERI-QEMU RISC-V usng
`/usr/bin/time /usr/tests/sbin/pfctl_test -l > /dev/null`:
Before:
       `90.68 real        89.99 user         0.10 sys`
After:
       `14.50 real        14.31 user         0.10 sys`

I.e. 85% of the time was being spent in these tr invocations!

truss -cf before:
```
syscall                     seconds   calls  errors
fork                  453.330532000    2371       0
cap_enter               0.247944000     633       0
cap_ioctls_limit        0.761099000    1899       0
vfork                   0.421971000       2       0
getegid                 0.000342000       1       0
getgid                  0.000358000       1       0
getuid                  0.000324000       1       0
getppid                 0.000589000       1       0
geteuid                 0.000631000       2       0
getpid                  0.000328000       1       0
issetugid               0.450306000    1270       0
write                   0.415779000     634       0
__sysctl                0.280936000     634       0
sigprocmask             2.543827000    6340       0
readlink                0.317952000     635     635
read                    1.319873000    2532       0
pread                   0.327678000     634       0
open                    1.399164000    2536     634
munmap                  0.301268000     634       0
mprotect                0.566142000    1268       0
mmap                    7.117084000    8876       0
fstat                   1.326981000    3168       0
dup2                    0.954023000    2373       0
close                   4.496506000    9979       0
clock_gettime           0.740010000    1902       0
cap_rights_limit        0.770141000    1899       0
cap_fcntls_limit        0.695135000    1899       0
                      ------------- ------- -------
                      478.786923000   52125    1269

```
After:
```
syscall                     seconds   calls  errors
fork                   24.675445000    1107       0
cap_enter               0.000340000       1       0
cap_ioctls_limit        0.001009000       3       0
vfork                   0.228345000       1       0
getegid                 0.000318000       1       0
getgid                  0.000323000       1       0
getuid                  0.000345000       1       0
getppid                 0.000329000       1       0
geteuid                 0.000726000       2       0
getpid                  0.000335000       1       0
issetugid               0.001554000       4       0
write                   0.000539000       1       0
__sysctl                0.000369000       1       0
sigprocmask             0.003684000      10       0
readlink                0.000440000       1       1
read                    0.001318000       2       0
pread                   0.000556000       1       0
open                    0.002250000       4       1
munmap                  0.000524000       1       0
mprotect                0.000767000       2       0
mmap                    0.011109000      14       0
fstat                   0.001743000       4       0
dup2                    0.398638000    1108       0
close                   1.996684000    4916       0
clock_gettime           0.001047000       3       0
cap_rights_limit        0.001170000       3       0
cap_fcntls_limit        0.000930000       3       0
                      ------------- ------- -------
                       27.330837000    7197       2
```
atf-sh/atf-check.1[126]: Sentence does not start on new line
CirrusCI doesn't like iso-8859-1, hopefully it accepts utf-8. The test
outputs should only contain ASCII characters so this shouldn't matter.
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
There are more of these that need to be modernized, but this will do for
now.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
We will be reusing this when we later allow the results file to be closed
and reopened for internal test reasons, so do this cleanup in advance.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Don't bother with different logic based on ctx->resfile, just set
ctx->resfilefd up initially with STDOUT_FILENO/STDERR_FILENO and write
to the ctx->resfilefd unconditionally later.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
This allows us to set the resultsfile mid-run if we need to, as will be the
case for some of our atf internal tests.  Notably, some internal tests will
fork and do ATF_REQUIRE's that we do -not- want to be written to our
outer-test's results file.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
This will be needed for some internal tests that currently fail as they
invoke some inner-test that's supposed to fail, but it isn't supposed to
write to the outer test's result file.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
All of the tests that fork_and_wait will fork(), fork() again, print some
stuff and exit, then the middle-fork parent will wait for the exit and do
some checks.  These checks are expected to fail in some cases, but what
we aren't expecting is for them to use the same resultfile (oops!).

Fix this by using our new API to reset the result file to /dev/null in the
middle-fork parent, so that our meta-tests are OK.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
If any atf_expect_*() function is called, then we currently close() the
resultfile after the expectation is written then proceed.  If we end up

*failing* that expectation, then we'll venture across this closed fd (unless
we're outputting to stdout/stderr) and fail.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
The Cirrus environment may not have CC/CXX set, in which case we should
use some sensible default.  This causes problems as the compiled product
actually tries to use ${ATF_BUILD_CC} and ${ATF_BUILD_CXX}, and this fails
miserably as they're ultimately empty.

However, we also don't really need to do any of this if we don't have any
archflags to add, so just don't.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
The exception is stdout/stderr, which we won't even attempt in case it's
been redirected to a file in a level above us that wants to check
expectations or what-have-you.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
- Unconditionally bootstrap pkg to avoid pkg
- Let job name match `uname -r` (13.0-CURRENT)
- Chase latest 12.x-STABLE image

Sponsored by:	The FreeBSD Foundation
The error is quite obvious and looks like copy/paste mistake.
Single quotes around commands in examples do not help anything,
and are actually harmful in case of 'echo foo'.
This adds ATF_{CHECK,REQUIRE}_INTEQ to match the ATF_{CHECK,REQUIRE}_STREQ
macros. This should make debugging failed test cases a lot easier.
Switch the release image from 12.1 (no longer supported by ports) to
13.0 (the latest).  Also test on stable/13 and head.
I'm working on a test that will fail due to a kernel bug.  However, it
can't be executed unless certain hardware is present, and I can't check
if the hardware supports the test without running the entire test.  So
it makes sense to set atf_tc_expect_fail in the beginning and later to
atf_tc_skip if the hardware isn't suitable.  But ATF doesn't currently
allow that.
Quoted multi-word commands will be passed literally to exec rather than
split on arguments, which will simply not work.  Stop excessive quotes to
make sure we don't mislead folks into thinking they're needed, and slap -x
on the one example that needs it.

This is a follow up to PR freebsd#13.
ngie-eign and others added 16 commits December 7, 2024 12:30
The previous logic used 2 separate calls to `atf::fs::path::str()` when
constructing a `std::vector<char>` to pass to `mkstemp(..)`. This in
turn caused grief with how data copying is done in atf-c(3), etc, as the
prior code computed the length of the path of an internal buffer in
`atf_dynstr` structs.

Moreover, the code was manually appending a nul char, which was
unnecessary when making the valid assumption that `std::string` is a
nul-terminated string.

The new code convert the path to an `std::string` once, includes the
existing nul char in the buffer, then passes it to mkstemp(3) instead.
The code works properly now.

Closes:	freebsd#76
Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
atf_check: fix std::length_error thrown from temp_file
- atf_utils_cat_file: output `strerror(errno)` to help diagnose why
  the `open` call failed.
- atf_utils_grep_file: output a message with the path name and
  `strerror(errno)` for parity with `atf_utils_cat_file(..)` and to make
  diagnosing problems without a corefile possible.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
This is being done prior to releasing 0.22.
Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
atf::fs::path has a str() method, and it returns a std::string
constructor. I found this odd that a vector is used here to copy
std::string contents. As std::string is a typedef of
std::basic_string<char>, this additional copy is not needed.

Also, remove calling the str() method on error.

Signed-off-by: rilysh <nightquick@proton.me>
atf-check.cpp: remove unneeded copying into vector
Improve diagnostics when paths cannot be opened
Revert "atf-check.cpp: remove unneeded copying into vector"
As noted by the reporter, the "descr" metadata property was made
optional back in the 0.8 release
(af4059b to be specific). Update
the documentation posthumously per the code change.

Closes:	freebsd#63
Reported by:	Roland Illig (@rillig)
Signed-off-by:	Enji Cooper <ngie@FreeBSD.org>
Mark the "descr" metadata property "Optional"
* admin/make-release.sh: automate release creation

This does the absolute bare minimum to produce a release.

This logic best resembles the expectations for legacy (pre-0.22) releases
of ATF.

Various files are omitted as they are not required in order to build
from a full `autoreconf`'ed source distribution.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
atf::fs::path has a str() method, and it returns a std::string
constructor. I found this odd that a vector is used here to copy
std::string contents. As std::string is a typedef of
std::basic_string<char>, this additional copy is not needed.

Also, remove calling the str() method on error.

Notes by ngie@:

`buf.data()` returns `const char*` until C++17, so it can't be used in
combination with `mkstemp(..)` (it mutates the template argument).
Access the internal buffer with the `operator[]` instead.

Add the C++17+ form as well along with a TODO comment, so the code can
move to std::string::data eventually.

Co-authored by:	Enji Cooper <ngie@FreeBSD.org>

Signed-off-by: rilysh <nightquick@proton.me>
Co-authored-by: rilysh <nightquick@proton.me>
Copy link
Contributor
@ngie-eign ngie-eign left a comment

Choose a reason for hiding this comment

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

A lot of my comments are related to what you're doing, but some of my comments are about the content as-is today.

@ngie-eign
Copy link
Contributor

Have you run a full build on this change, BTW? Some of the changes you made before resulted in build failures because the file extensions were changed from to .md.

@fel1x-developer fel1x-developer F438 force-pushed the md branch 2 times, most recently from b5b0b4f to 6ee1800 Compare December 31, 2024 17:22
@fel1x-developer
Copy link
Contributor Author

Formatted with prettier on vscode

Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
@fel1x-developer
Copy link
Contributor Author

Have you run a full build on this change, BTW? Some of the changes you made before resulted in build failures because the file extensions were changed from to .md.

Added a new commit modifying Makefile.am. Build success on macOS 15.

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.

0