Commit 863dd89abf08e67126e4247113b5b27476f5ab03

Carlos Martín Nieto 2015-06-18T12:45:40

tests: tick over five seconds instead of one When ticking over one second, it can happen that the actual time ticks over the same second between the time that we undermine our own race protections and the time in which we perform the index update. Such timing would make the time in the entries match the index' timestamp and we have not gained anything. Ticking over five seconds makes it so that if real-time rolls over that second, our index is still ahead. This is still suboptimal as we're dealing with timing, but five seconds should be long enough for any reasonable test runner to finish the tests.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/tests/checkout/checkout_helpers.c b/tests/checkout/checkout_helpers.c
index 42ed1db..92a454d 100644
--- a/tests/checkout/checkout_helpers.c
+++ b/tests/checkout/checkout_helpers.c
@@ -143,7 +143,7 @@ void tick_index(git_index *index)
 
 	times[0].tv_sec  = ts;
 	times[0].tv_usec = 0;
-	times[1].tv_sec  = ts + 1;
+	times[1].tv_sec  = ts + 5;
 	times[1].tv_usec = 0;
 
 	cl_git_pass(p_utimes(git_index_path(index), times));