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

[feature]: fast make unit on Apple M1 #7084

Open
joostjager opened this issue Oct 25, 2022 · 5 comments
Open

[feature]: fast make unit on Apple M1 #7084

joostjager opened this issue Oct 25, 2022 · 5 comments
Labels
docker Docker-related PRs/Issues enhancement Improvements to existing features / behaviour golang/build system Related to the go language and compiler

Comments

@joostjager
Copy link
Contributor

It seems that make unit is unworkably slow on Apple M1 machines. Potentially because of etcd-io/bbolt#149.

What fixes it for me is to run make unit inside a simple docker container.

This issue is about adding a new make target for unit-in-container to make fast unit tests easy.

@joostjager joostjager added the enhancement Improvements to existing features / behaviour label Oct 25, 2022
@Roasbeef Roasbeef added golang/build system Related to the go language and compiler docker Docker-related PRs/Issues labels Oct 25, 2022
@Roasbeef
Copy link
Member

Roasbeef commented Oct 25, 2022

How long does it take for you?

As is, afaict, it actually runs all the tests serially, to ensure that it's testing all the internal packages and migrations, etc.

If you do a normal go test -v ./... it'll start to run them in parallel, but it'll end up missing some modules.

My time locally for the parallel command above:

go test -v ./...  105.22s user 49.23s system 23% cpu 11:00.02 total

@joostjager
Copy link
Contributor Author

joostjager commented Oct 25, 2022

Hmm, that command is similar for me, 10:47.56 total

What I had been running and didn't work for me was make unit pkg=htlcswitch. It just times out with an error after 3:52.25, and it does work inside docker.

@positiveblue
Copy link
Contributor

In my laptop (linux 5.15, 8 core AMD 5850U , 32Gb RAM), running go clean -testcache ./... between steps so go does not skip cached tests:

make unit  622.63s user 118.20s system 106% cpu 11:37.09 total
go test -v ./...  420.96s user 37.29s system 404% cpu 1:53.41 total # got failures in htlcswitch & htlcswitch/hodl
make unit pkg=htlcswitch  198.12s user 7.37s system 183% cpu 1:51.76 total

@joostjager
Copy link
Contributor Author

Yes, that is roughly what I am seeing on an AMD ryzen machine too. On M1, it times out though. Unless I run in docker.

@joostjager
Copy link
Contributor Author

joostjager commented Nov 28, 2022

This is a relevant thread too: https://twitter.com/marcan42/status/1494213862970707969?lang=en

It almost looks like running code in a docker on macos bypasses a proper fsync. And this makes unit tests fast :(

More on mac docker and syncing: docker/for-mac#668

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Docker-related PRs/Issues enhancement Improvements to existing features / behaviour golang/build system Related to the go language and compiler
Projects
None yet
Development

No branches or pull requests

3 participants