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

Use reproducible timestamps in more doc examples #2626

Merged
merged 1 commit into from
Jan 29, 2019

Conversation

psychon
Copy link
Member

@psychon psychon commented Jan 28, 2019

This adds require("_date") to some example tests that use the current
date via os.date. This allows reproducibility by replacing os.date()
with a function that uses a static date from $SOURCE_DATE_EPOCH. See
commit 9d7eaf0 for more details.

Signed-off-by: Uli Schlachter psychon@znc.in

CC @reinerh Thanks for pointing out that this is indeed needed.

This adds require("_date") to some example tests that use the current
date via os.date. This allows reproducibility by replacing os.date()
with a function that uses a static date from $SOURCE_DATE_EPOCH. See
commit 9d7eaf0 for more details.

Signed-off-by: Uli Schlachter <psychon@znc.in>
@codecov
Copy link

codecov bot commented Jan 28, 2019

Codecov Report

Merging #2626 into master will decrease coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2626      +/-   ##
==========================================
- Coverage   85.23%   85.23%   -0.01%     
==========================================
  Files         516      516              
  Lines       34845    34848       +3     
==========================================
+ Hits        29701    29702       +1     
- Misses       5144     5146       +2
Flag Coverage Δ
#c_code 73.74% <ø> (-0.03%) ⬇️
#functionaltests 70.2% <ø> (ø) ⬆️
#lua53 85.23% <100%> (-0.01%) ⬇️
#samples 72.77% <100%> (ø) ⬆️
#themes 49.1% <ø> (-0.01%) ⬇️
#unittests 58.52% <ø> (ø) ⬆️
Impacted Files Coverage Δ
tests/examples/awful/tooltip/textclock2.lua 100% <100%> (ø) ⬆️
tests/examples/awful/popup/wiboxtypes.lua 100% <100%> (ø) ⬆️
tests/examples/awful/tooltip/textclock.lua 100% <100%> (ø) ⬆️
xwindow.c 92.39% <0%> (-0.55%) ⬇️
objects/client.c 79.1% <0%> (-0.16%) ⬇️
property.c 80% <0%> (+0.46%) ⬆️

@@ -1,6 +1,7 @@
--DOC_GEN_IMAGE
--DOC_HIDE_ALL
--DOC_NO_USAGE
require("_date")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--DOC_HIDE is not required in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, because of DOC_HIDE_ALL above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup.

The test examples are primarily meant to generate images for the docs. For this, @DOC_awful_popup_wiboxtypes_EXAMPLE@ is replaced with something. By default, that's all the code used to generate the example and then the example image (or text, in some cases) itself. With --DOC_HIDE we can "hide some hacks" and --DOC_HIDE_ALL is used for cases where we only want the image (e.g. some overview of all the widgets).

@reinerh
Copy link
Contributor

reinerh commented Jan 28, 2019

With this patch and the one from #2622 applied, the date/time variations are fixed in my test setup.

@reinerh
Copy link
Contributor

reinerh commented Jan 28, 2019

There was also a difference in AUTOGEN_awful_widget_layoutlist_bar.svg that didn't look time-related.
But after applying your change to tests/examples/awful/widget/layoutlist/wibar.lua from #2621 as well, this also built reproducibly.

@psychon
Copy link
Member Author

psychon commented Jan 29, 2019

@reinerh Thanks for testing!

There was also a difference in AUTOGEN_awful_widget_layoutlist_bar.svg that didn't look time-related.

Was it something like this? awesomeWM/apidoc@ab926e9#diff-1c97ba2002b724e67f79d5225c015ce3 It seems that the IDs that cairo generates in the SVG have a random offset...?

In the end, the IDs that cairo uses some from here: https://gitlab.com/cairo/cairo/blob/ef8c379e0f560ced63c2a07566a3a7d608e3996c/src/cairo-surface.c#L264-285
This is just a counter that is incremented each time a cairo surface is allocated. So... something (no idea what, usual suspect is pairs iteration order) causes us to create cairo surfaces in different order / a different number of cairo surfaces. Yay, this will be lots of fun to debug.

@psychon
Copy link
Member Author

psychon commented Jan 29, 2019

@Elv13 Mergify got broken by the Travis switch. The pull request status says continuous-integration/travis-ci Expected — Waiting for status to be reported, but also says Travis CI - Pull Request Successful in 8m — Build Passed.

@blueyed
Copy link
Member

blueyed commented Jan 29, 2019

@psychon
"Required status checks" should be fixed.

@blueyed
Copy link
Member

blueyed commented Jan 29, 2019

@psychon
Please consider creating an issue for the incrementing ID. You can try/use the "Reference new issue" from your comment's actions (upper right).

@blueyed
Copy link
Member

blueyed commented Jan 29, 2019

Oh, it needs to be updated here: https://github.com/blueyed/awesome/blob/81a0a8cc48654f3670c377e11ce8ee07366c0de5/.mergify.yml#L6-L7 (will do, and also remove Codacy for now).
#2627

@reinerh
Copy link
Contributor

reinerh commented Jan 29, 2019

There was also a difference in AUTOGEN_awful_widget_layoutlist_bar.svg that didn't look time-related.

Was it something like this? awesomeWM/apidoc@ab926e9#diff-1c97ba2002b724e67f79d5225c015ce3 It seems that the IDs that cairo generates in the SVG have a random offset...?

Yes, something like that. Now also visible in the reproducible-builds CI.

@blueyed blueyed merged commit b5abd53 into awesomeWM:master Jan 29, 2019
@psychon psychon deleted the more_reproducible_images branch January 29, 2019 19:26
petoju pushed a commit to petoju/awesome that referenced this pull request Jun 8, 2019
This adds require("_date") to some example tests that use the current
date via os.date. This allows reproducibility by replacing os.date()
with a function that uses a static date from $SOURCE_DATE_EPOCH. See
commit 9d7eaf0 for more details.

Signed-off-by: Uli Schlachter <psychon@znc.in>
actionless pushed a commit to actionless/awesome that referenced this pull request Mar 24, 2021
This adds require("_date") to some example tests that use the current
date via os.date. This allows reproducibility by replacing os.date()
with a function that uses a static date from $SOURCE_DATE_EPOCH. See
commit 9d7eaf0 for more details.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants