diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2021-10-07 17:08:58 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-11 11:00:06 +0100 |
commit | ecb11a6848b4a86de3f04d7dcf12ce8ff6491a07 (patch) | |
tree | 423f611d3ac21caa80170fcb4a02012c3e86a380 /bitbake/lib/hashserv/tests.py | |
parent | cac6facc9dd125ccf156406f7f3fac84e97f28dc (diff) | |
download | poky-ecb11a6848b4a86de3f04d7dcf12ce8ff6491a07.tar.gz |
bitbake: hashserv: Add tests for diverging reports
(Bitbake rev: 953c8d622c9d1bc1eb06bcaf1eaa3aa9f85d0bc2)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv/tests.py')
-rw-r--r-- | bitbake/lib/hashserv/tests.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py index e851535c59..1fcfb6b929 100644 --- a/bitbake/lib/hashserv/tests.py +++ b/bitbake/lib/hashserv/tests.py | |||
@@ -312,6 +312,59 @@ class HashEquivalenceCommonTests(object): | |||
312 | server.process.join(300) | 312 | server.process.join(300) |
313 | self.assertIsNotNone(server.process.exitcode, "Server did not exit in a timely manner!") | 313 | self.assertIsNotNone(server.process.exitcode, "Server did not exit in a timely manner!") |
314 | 314 | ||
315 | def test_diverging_report_race(self): | ||
316 | # Tests that a reported task will correctly pick up an updated unihash | ||
317 | |||
318 | # This is a baseline report added to the database to ensure that there | ||
319 | # is something to match against as equivalent | ||
320 | outhash1 = 'afd11c366050bcd75ad763e898e4430e2a60659b26f83fbb22201a60672019fa' | ||
321 | taskhash1 = '3bde230c743fc45ab61a065d7a1815fbfa01c4740e4c895af2eb8dc0f684a4ab' | ||
322 | unihash1 = '3bde230c743fc45ab61a065d7a1815fbfa01c4740e4c895af2eb8dc0f684a4ab' | ||
323 | result = self.client.report_unihash(taskhash1, self.METHOD, outhash1, unihash1) | ||
324 | |||
325 | # Add a report that is equivalent to Task 1. It should ignore the | ||
326 | # provided unihash and report the unihash from task 1 | ||
327 | taskhash2 = '6259ae8263bd94d454c086f501c37e64c4e83cae806902ca95b4ab513546b273' | ||
328 | unihash2 = taskhash2 | ||
329 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash1, unihash2) | ||
330 | self.assertEqual(result['unihash'], unihash1) | ||
331 | |||
332 | # Add another report for Task 2, but with a different outhash (e.g. the | ||
333 | # task is non-deterministic). It should still be marked with the Task 1 | ||
334 | # unihash because it has the Task 2 taskhash, which is equivalent to | ||
335 | # Task 1 | ||
336 | outhash3 = 'd2187ee3a8966db10b34fe0e863482288d9a6185cb8ef58a6c1c6ace87a2f24c' | ||
337 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash3, unihash2) | ||
338 | self.assertEqual(result['unihash'], unihash1) | ||
339 | |||
340 | |||
341 | def test_diverging_report_reverse_race(self): | ||
342 | # Same idea as the previous test, but Tasks 2 and 3 are reported in | ||
343 | # reverse order the opposite order | ||
344 | |||
345 | outhash1 = 'afd11c366050bcd75ad763e898e4430e2a60659b26f83fbb22201a60672019fa' | ||
346 | taskhash1 = '3bde230c743fc45ab61a065d7a1815fbfa01c4740e4c895af2eb8dc0f684a4ab' | ||
347 | unihash1 = '3bde230c743fc45ab61a065d7a1815fbfa01c4740e4c895af2eb8dc0f684a4ab' | ||
348 | result = self.client.report_unihash(taskhash1, self.METHOD, outhash1, unihash1) | ||
349 | |||
350 | taskhash2 = '6259ae8263bd94d454c086f501c37e64c4e83cae806902ca95b4ab513546b273' | ||
351 | unihash2 = taskhash2 | ||
352 | |||
353 | # Report Task 3 first. Since there is nothing else in the database it | ||
354 | # will use the client provided unihash | ||
355 | outhash3 = 'd2187ee3a8966db10b34fe0e863482288d9a6185cb8ef58a6c1c6ace87a2f24c' | ||
356 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash3, unihash2) | ||
357 | self.assertEqual(result['unihash'], unihash2) | ||
358 | |||
359 | # Report Task 2. This is equivalent to Task 1, so will pick up the | ||
360 | # unihash from that task | ||
361 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash1, unihash2) | ||
362 | self.assertEqual(result['unihash'], unihash1) | ||
363 | |||
364 | # The originally reported unihash for Task 3 should have been updated | ||
365 | # with the second report to use the new unihash from Task 1 (because is | ||
366 | # shares a taskhash with Task 2) | ||
367 | self.assertClientGetHash(self.client, taskhash2, unihash1) | ||
315 | 368 | ||
316 | class TestHashEquivalenceUnixServer(HashEquivalenceTestSetup, HashEquivalenceCommonTests, unittest.TestCase): | 369 | class TestHashEquivalenceUnixServer(HashEquivalenceTestSetup, HashEquivalenceCommonTests, unittest.TestCase): |
317 | def get_server_addr(self, server_idx): | 370 | def get_server_addr(self, server_idx): |