You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I was trying to get a minimal build of this repo working so that I can run the tests in the test folder (and once these all pass, to write my own). I created a fork of this repo and, because there were a bunch of files in test/Makefile that were missing, I added them all individually (they are in src/common and src/frozen of my fork). Then I updated the paths in test/Makefile to point to where I added these new files.
After this is done, I can run make test from the test folder, but immediately there are issues. Here is the output from this first run:
The most obvious problem is that several of the tests fail. However, even when current doesn't equal expe[0], the string representation of the dates are equal (and match the current date). I found that this could be fixed by splitting the printf call on line 246 of test/cron_test.c into multiple calls, one for current and one for expe[0]. (Though why this fixes the issue, I have no clue.) I then also decided to print expe[1] and expe[2] just for extra data, and also print the difference in seconds between current and expe[0]. This produces the following output:
Just eyeballing the outputs, it seems like the tests that fail are the ones related to the date. For example, in the first failing test, the date August 29, 2017 is a Tuesday, so querying the next Wednesday should return midnight on August 30; however, I believe the code is interpreting the epoch time as a GMT date, so it thinks it is already Wednesday and just returns the next whole minute. (My current timezone is Mountain Standard Time (UTC -7).)
I wonder if this is an issue in my fork or if there is actually an issue in the cron implementation that causes these tests to fail. For reference, here is a link to my fork so that you can see the code that causes the output above.
The text was updated successfully, but these errors were encountered:
This was fixed by adding -DCRON_USE_LOCAL_TIME=1 to the build commands in the Makefile. If this seems like a valuable change to make in the master branch of the repo I could make a pull request.
Hi! I was trying to get a minimal build of this repo working so that I can run the tests in the
test
folder (and once these all pass, to write my own). I created a fork of this repo and, because there were a bunch of files intest/Makefile
that were missing, I added them all individually (they are insrc/common
andsrc/frozen
of my fork). Then I updated the paths intest/Makefile
to point to where I added these new files.After this is done, I can run
make test
from thetest
folder, but immediately there are issues. Here is the output from this first run:(Expand first run output)
The most obvious problem is that several of the tests fail. However, even when
current
doesn't equalexpe[0]
, the string representation of the dates are equal (and match thecurrent
date). I found that this could be fixed by splitting theprintf
call on line 246 oftest/cron_test.c
into multiple calls, one forcurrent
and one forexpe[0]
. (Though why this fixes the issue, I have no clue.) I then also decided to printexpe[1]
andexpe[2]
just for extra data, and also print the difference in seconds betweencurrent
andexpe[0]
. This produces the following output:(Expand output with extra print statements)
Just eyeballing the outputs, it seems like the tests that fail are the ones related to the date. For example, in the first failing test, the date August 29, 2017 is a Tuesday, so querying the next Wednesday should return midnight on August 30; however, I believe the code is interpreting the epoch time as a GMT date, so it thinks it is already Wednesday and just returns the next whole minute. (My current timezone is Mountain Standard Time (UTC -7).)
I wonder if this is an issue in my fork or if there is actually an issue in the
cron
implementation that causes these tests to fail. For reference, here is a link to my fork so that you can see the code that causes the output above.The text was updated successfully, but these errors were encountered: