-
Notifications
You must be signed in to change notification settings - Fork 312
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
Replace fixtures.tar.gz with regular files #56
Conversation
In order to keep the fixtures in a form that can easily be reviewed, this changeset puts the files from fixtures.tar.gz back into the repo as regular files (in a separate directory, fixtures.src). In order to prevent filenames that prevent checkouts on Windows, colons are encoded as "_@colon@_" and copied to the correct location by make. Alternatives: files could be renamed rather than copied (using -depth in the find command to rename files before their parent directories). However, doing so would remove files from a location where git expects them.
Makefile
Outdated
@@ -8,11 +8,17 @@ lint: | |||
go get github.com/golang/lint/golint | |||
golint *.go | |||
|
|||
test: sysfs/fixtures/.unpacked | |||
test: sysfs/fixtures/.copied |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using a marker file, which can get easily out of sync, I'd like to use each @colon@ file as dependency here. @matthiasr we do something similar in a couple of SoundCloud projects, do you have some time to use your make skills to apply that here?
I'll try to port it this weekend otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on it. The straightforward way will require GNU make, is that acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out, I can't make it work. Make does not handle filenames with characters well, so specifying the target names breaks it completely. Not specifying the target names means we end up in the same out-of-sync situation with the added downside of redoing all the work all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess then I'd vote to remove the marker and rename them every time. Otherwise developers can run in staleness issues when others make changes to the fixtures directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a renaming routine quite similar to the copy code in this PR. Obviously, this means that after a make test, every renamed file will show up as missing for git. Also, giving up the marker makes the test process slower. We have to walk the file try every time to check for files that need renaming. And a file removed from git won't get the renamed version removed automatically. For that, we'd have to rebuild the directory from scratch every time (also doable if that is your preference).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is, the marker needs to be somehow dependent on the files in source code. Otherwise the copy command will never be executed again. That's what I asked @matthiasr to help with, but apparently it's not possible due to Make's lack of colon support in filenames.
I'd prefer slower test execution over stale fixture files. I'd like to prevent developers from unnecessary debug sessions when they forgot to remove the marker file manually to trigger an update.
I'd say yes. Is it available on osx?
…On Sat, Jun 17, 2017, 20:46 Matthias Rampke ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Makefile
<#56 (comment)>:
> @@ -8,11 +8,17 @@ lint:
go get github.com/golang/lint/golint
golint *.go
-test: sysfs/fixtures/.unpacked
+test: sysfs/fixtures/.copied
Working on it. The straightforward way will require GNU make, is that
acceptable?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#56 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAANaLRaEb8tX8YfohO4n8kgC8g7yvReks5sFB7fgaJpZM4N5gJl>
.
|
Yes, it's the default there. It's not on other BSDs, but can be installed. |
I agree. Renaming is a non-starter, destroying the checkout all the time
will make development impossible. Let's stick with the approach in this PR
but use a phony target instead of the .copied file
…On Sun, Jun 18, 2017, 17:48 Tobias Schmidt ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Makefile
<#56 (comment)>:
> @@ -8,11 +8,17 @@ lint:
go get github.com/golang/lint/golint
golint *.go
-test: sysfs/fixtures/.unpacked
+test: sysfs/fixtures/.copied
The problem is, the marker needs to be somehow dependent on the files in
source code. Otherwise the copy command will never be executed again.
That's what I asked @matthiasr <https://github.com/matthiasr> to help
with, but apparently it's not possible due to Make's lack of colon support
in filenames.
I'd prefer slower test execution over stale fixture files. I'd like to
prevent developers from unnecessary debug sessions when they forgot to
remove the marker file manually to trigger an update.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#56 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAICBiPD1Lag8jnxnd7ow6E9AJDCsWhQks5sFUa_gaJpZM4N5gJl>
.
|
In order to avoid any test on a stale fixtures tree, remove and rebuild the directory every time.
Thank you @ideaship! |
Sigh @ #57. I need to find a Windows box for testing. |
Replace fixtures.tar.gz with regular files
The generated pathnames are too long for some filenames, including NTFS in its default configuration. We've considered using other separators, but deemed shorter ones to easy to break something. This reverts commit b9955ae, reversing changes made to a3bfc74. Fixes prometheus#57.
…-root Introduce Process::new_with_root() constructor
In order to keep the fixtures in a form that can easily be reviewed,
this changeset puts the files from fixtures.tar.gz back into the repo as
regular files (in a separate directory, fixtures.src). In order to
prevent filenames that prevent checkouts on Windows, colons are encoded
as
_@colon@_
and copied to the correct location by make.Alternatives: files could be renamed rather than copied (using -depth
in the find command to rename files before their parent directories).
However, doing so would remove files from a location where git expects
them.