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

Improve portability #5622

Merged
merged 4 commits into from Mar 15, 2023
Merged

Conversation

clebergnu
Copy link
Contributor

This improves portability on UNIX systems that are not necessarily your run-of-the-mill Linux distros.

In this case, a good part of the selftests gets to be run macOS.

The asserts being made conditional here assume that a Linux system was
used during the test execution, so that the contents of
"/proc/cmdline" and "/proc/meminfo" were available.

Let's skip those on non-Linux platforms.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Some systems do not have a /bin/true and /bin/false binaries.  While
we could use "passtest.py" and "failtest.py", sometimes we want to
test the exec-test bits too.

This introduces a substitute for /bin/true that are used when the
environment is not certain, in contrast with some /bin/true references
that can be found on CI configuration files when the execution is
pinned to a certain system type.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Instead of raising a FileNotFoundError when attempting to get a list
of all modules by reading /proc/modules, if it's not available, let's
return an empty list (and log that fact).

The main reason is this is used indirectly by higher level
functionality, such as decorators to skip tests in environments where
there is no Linux module functionality, so it needs to behave a bit
nicer.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
@clebergnu clebergnu added this to the #102 (Codename TBD) milestone Mar 14, 2023
@clebergnu clebergnu self-assigned this Mar 14, 2023
This improves considerably the scope of test under OS X.  There are a
few issues pending that would allow for the complete execution of the
selftests, but this is a good first step IMO.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
@clebergnu clebergnu marked this pull request as ready for review March 14, 2023 15:26
@richtja richtja merged commit daab422 into avocado-framework:master Mar 15, 2023
53 checks passed
@lmr
Copy link
Member

lmr commented Mar 15, 2023

Good stuff, @clebergnu, thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants