Re: Detecting when building under mock?
On Wed, 8 Apr 2020, Petr Pisar wrote: Is there a recommended way for detecting when a package is being built under mock? I have a package where some tests fail due to various things not being present in a mock container, e.g, /dev/log doesn't exist. I can just disable these tests downstream, but upstream might take a change if I can wrap them in a "if !mock" condition. Why not test for the presence of /dev/log before running such tests? Well, in the particular case of that test, checking whether /dev/log exists *is* the test. Then it's a bug in the test. Since when /dev/log must exist on a system? You can have various environments that are missing the socket. Mock is jist one of them. It's a test for a piece of code that identifies a file as a socket. So basically upstream is using /dev/log as a well-known place to find a socket file. I suppose they could/should just be creating their own. Anyway, to answer my own question, I found that the environment variable 'container' is set in mock, so that seems to be a possible way to identify a mock or container environment. Scott ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Re: Detecting when building under mock?
Dne 07. 04. 20 v 17:43 Scott Talbert napsal(a): > Is there a recommended way for detecting when a package is being built under > mock? In Mock, we try as much as possible mimic normal system. So - no, there is no way I can recommend. > I have a package where some tests > fail due to various things not being present in a mock container, e.g, > /dev/log doesn't exist. I can just disable these > tests downstream, but upstream might take a change if I can wrap them in a > "if !mock" condition. /dev/log is handled by journalctl (but not owned, which is likely packaging bug). In the buildchroot the systemd (and therefore journalctl) is not running. IMHO you should check if system logging is enabled - which is beyond my knowledge. -- Miroslav Suchy, RHCA Red Hat, Associate Manager ABRT/Copr, #brno, #fedora-buildsys ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Re: Detecting when building under mock?
On Tue, Apr 07, 2020 at 02:51:43PM -0400, Scott Talbert wrote: > On Tue, 7 Apr 2020, Paul Howarth wrote: > > > > Is there a recommended way for detecting when a package is being > > > built under mock? I have a package where some tests fail due to > > > various things not being present in a mock container, e.g, /dev/log > > > doesn't exist. I can just disable these tests downstream, but > > > upstream might take a change if I can wrap them in a "if !mock" > > > condition. > > > > Why not test for the presence of /dev/log before running such tests? > > Well, in the particular case of that test, checking whether /dev/log exists > *is* the test. > Then it's a bug in the test. Since when /dev/log must exist on a system? You can have various environments that are missing the socket. Mock is jist one of them. -- Petr signature.asc Description: PGP signature ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Re: Detecting when building under mock?
On Tue, 7 Apr 2020, Paul Howarth wrote: Is there a recommended way for detecting when a package is being built under mock? I have a package where some tests fail due to various things not being present in a mock container, e.g, /dev/log doesn't exist. I can just disable these tests downstream, but upstream might take a change if I can wrap them in a "if !mock" condition. Why not test for the presence of /dev/log before running such tests? Well, in the particular case of that test, checking whether /dev/log exists *is* the test. Scott ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Re: Detecting when building under mock?
On Tue, 7 Apr 2020 11:43:26 -0400 (EDT) Scott Talbert wrote: > Is there a recommended way for detecting when a package is being > built under mock? I have a package where some tests fail due to > various things not being present in a mock container, e.g, /dev/log > doesn't exist. I can just disable these tests downstream, but > upstream might take a change if I can wrap them in a "if !mock" > condition. Why not test for the presence of /dev/log before running such tests? Paul. ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Detecting when building under mock?
Is there a recommended way for detecting when a package is being built under mock? I have a package where some tests fail due to various things not being present in a mock container, e.g, /dev/log doesn't exist. I can just disable these tests downstream, but upstream might take a change if I can wrap them in a "if !mock" condition. Thanks, Scott ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org