rillig / gobco

Measure branch coverage of golang tests
62 stars 12 forks source link

On each gobco run, gobco creates folders that it doesn't cleanup #9

Closed anmolbabu closed 4 years ago

anmolbabu commented 4 years ago

ababu17$ ls /var/folders/dc/ffvyv57j5dzf20lp3tlqfpqw0000gn/T/gobco-
gobco-09af28b7-af8d-408d-9032-4bdc1ed38432/ gobco-47d0be85-f3a1-4c34-a5fa-1b869ed0a45b/ gobco-8544638a-b5fd-47a4-b4ae-24fdd65a4147/ gobco-c32b52d6-b1a0-4a18-8c21-95fbcf2386b3/ gobco-ef7fe756-a826-4f89-a982-bf5f306c3533/
gobco-2033001c-eceb-428c-a7be-fb516c8edf17/ gobco-48d6af0e-6ba8-4b74-8dbe-081259199655/ gobco-879c5e44-0c0f-46cd-9436-a249fcbedb34/ gobco-c6e1336f-20a6-447e-86a6-1a035ef60f8a/ gobco-f04d467e-30c4-42f9-8772-561bcb4dd239/
gobco-23b03285-d1ea-4d71-b000-a4966f35433c/ gobco-4e3d2212-158e-4192-af1e-4eaf347d6e1d/ gobco-93d14d79-7b1a-4ae5-9325-56031bc75261/ gobco-d36b5b71-616b-481b-89b8-0148087b687f/ 
gobco-255e2c5d-0559-4413-9524-3ac5ed9f233f/ gobco-6243a4aa-8bbf-4973-bfee-98d6937fcb84/ gobco-9e31fd2c-69bb-4bb7-bf4b-c027fd6223a3/ gobco-dd6c3847-3cfc-49c4-8f43-dbc57b60088b/ 
gobco-367efb29-538a-415f-b8db-af545b5771be/ gobco-70ca82db-1137-40e3-b295-375e7a42a852/ gobco-9ff8c0f3-9234-4938-9615-013f7d4f2be7/ gobco-e6652f9c-0687-4cf7-b45a-a7bb0aab2b41/ ```
rillig commented 4 years ago

Please provide more detailed instructions on how to reproduce the situation. When I run gobco, everything is cleaned up as it should.

Please try again by installing gobco commit d7b2b5dde951c1693fa98ea36b7f3acf98211815 and then running gobco -verbose.

anmolbabu commented 4 years ago

Ack will retry once again

Also, just out of curiosity why does it create another directory under /var/folders/dc as above? Sorry I really don't know if same is the case even with go test I have atleast not realised it with go test so far

anmolbabu commented 4 years ago

Still... I see folders not being deleted on failed runs

rillig commented 4 years ago

When I took over gobco, it modified and instrumented the source code in-place, which was a terrible idea from the beginning.

I later fixed this by creating a temporary directory where I copied all the files that could be modified. To make this as realistic as possible, I had to create a complete GOROOT directory structure. This is probably what you mean by the "another directory".

I haven't looked at either vendoring or modules, therefore I may have missed the latest developments there. For me, copying the directories works fine though.

Regarding the "folders not being deleted", you still have to provide more details. I added some more debugging output in the commit I mentioned, to help you track down the cause. Could it be that your tests open a file but forget to close it again? Or they Chdir into a directory and then stay there? All these could be reasons why the folders are still kept. In any case, I need to see the output of gobco -verbose to continue guessing.

rillig commented 4 years ago

Feedback timeout.

KantarBruceAdams commented 2 years ago

I have observed this too. I'm not 100% sure of the reason. It may be certain kinds of test failure short-cut the clean up. You might also want to add a signal handler to ensure clean-up still happens if you press control ctrl-C. Something like https://stackoverflow.com/a/11131948/1569204