How to force run tests as non-root?

Sergey Fedorov vital.had at gmail.com
Sun Feb 25 07:21:10 UTC 2024


Related PR: https://github.com/macports/macports-ports/pull/22796
(Tests still run only manually under a regular user though.)

On Sun, Feb 25, 2024 at 1:21 PM Sergey Fedorov <vital.had at gmail.com> wrote:

> For some reason sudo is not allowed. For example, I try using *system
> "sudo -u svacchanda ./VidaliaTestSuite"* (just for the sake of testing,
> since it works when running manually), but get:
>
> [100%] Built target VidaliaTestSuite
>
> make[1]: Leaving directory
> `/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_security_Vidalia/Vidalia/work/build'
>
> /opt/local/bin/cmake -E cmake_progress_start
> /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_security_Vidalia/Vidalia/work/build/CMakeFiles
> 0
>
> make: Leaving directory
> `/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_security_Vidalia/Vidalia/work/build'
>
> --->  Testing Vidalia
>
> sh: /usr/bin/sudo: Operation not permitted
>
> Command failed: sudo -u svacchanda ./VidaliaTestSuite
>
> Exit code: 126
>
>
> I tried a few other ways of adding *sudo -u* via the portfile, and get
> the same error.
>
> P. S. Both cmake 1.0 and cmake 1.1 fail identically with regard to running
> tests.
>
> On Sat, Feb 24, 2024 at 2:28 PM Joshua Root <jmr at macports.org> wrote:
>
>> On 24/2/2024 17:27, Sergey Fedorov wrote:
>> > If Macports is running as root, but tests require non-root user, how to
>> > do that?
>> > There is no test.asroot no, apparently.
>>
>> All the usual ways you can run something as another user when you are
>> root. You could prefix your build.cmd with 'sudo -u $macportsuser' for
>> example.
>>
>> - Josh
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20240225/c841c02c/attachment-0001.htm>


More information about the macports-dev mailing list