[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Doing sudo go test during build



On Tue, Mar 17, 2020 at 9:25 AM Tong Sun
<suntong001@users.sourceforge.net> wrote:
>
> On Tue, Mar 17, 2020 at 2:30 AM Anthony Fok <foka@debian.org> wrote:
> >
> > Hi Tong,
> >
> > On Mon, Mar 16, 2020 at 10:36 PM Tong Sun
> > <suntong001@users.sourceforge.net> wrote:
> > >
> > > On Tue, Mar 17, 2020 at 12:29 AM Tong Sun
> > > <suntong001@users.sourceforge.net> wrote:
> > > >
> > > > On Mon, Mar 16, 2020 at 9:41 AM Tong Sun wrote:
> > > >
> > > > > The go package that I'm packing builds OK, but its test failed,
> > > > > because the tests need to be run as root.
> > > > >
> > > > > Is it OK that I overide dh_auto_test with
> > > > > sudo dh_auto_test
> > > > > ?
> > > >
> > > > Ok, I gave it a try, with
> > > >
> > > > override_dh_auto_test:
> > > >         sudo dh_auto_test
> > > >
> > > > but none of the existing tests are running any more.
> > >
> > > Using
> > >
> > > override_dh_auto_test:
> > >         fakeroot dh_auto_test
> > >
> > > the existing tests will run, but still failing.
> > >
> > > Any one can help?
> >
> > Next time, please give more details; telling us the Go import path
> > would help because we need to see the actual code to be able to
> > investigate and offer a solution.
>
> All the details are posted in another thread. Maybe be because its
> overwhelmingly details, nobody has pay attention to it yet.
>
> > Lacking that information, my random guesses and suggestions are:
> >
> > 1. Check debian/control and see if "Rules-Requires-Root: no" is set
> > (now inserted by default by dh-make-golang).
> > Either remove that line, or, better yet, set it explicitly to
> > "binary-targets", see
> > https://www.debian.org/doc/debian-policy/ch-controlfields.html#rules-requires-root
>
> Thank for Anthony for looking it this. The Go project is
> https://salsa.debian.org/go-team/packages/golang-github-tonistiigi-fsutil/-/commits/debian/sid
>
> as you can see I've been struggling to make it build.Here are the logs:
>
> With Rules-Requires-Root: no:
> https://dpaste.org/6GqZ
>
> With Rules-Requires-Root: yes (or binary-targets):
> https://dpaste.org/fip4
>
> Here is my log,
> https://paste.debian.net/1134965/
> and we can see that with root it builds fine.

So I tried to do `sudo go test` during build myself, after
successfully built it, during dh_auto_test phase. It works but, it
starts with `go: downloading ...` which will fail during official
build. So two questions.

- since my build environment has everything, and `go: downloading ...`
is not necessary, how to pass that knowledge to `sudo go test` so it
will not be downloading anything?
- is official build environment using passwordless `sudo`? Will my
`sudo go test`  be stuck at entering password in official Debian build
environment?

Thanks

> > 2. Skip the test(s) that require root access, just like how we skip
> > the tests that require Internet connection.
>
> I think that might be the only last resort. Just that the failed tests
> are scatting all over the places I haven't figure out a good way of
> doing that yet.

I still haven't figured out a good way of doing that yet.
Thanks for helping.


Reply to: