mirror of
https://git.yoctoproject.org/git/poky
synced 2026-01-04 16:10:04 +00:00
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>
This commit is contained in:
parent
cac6facc9d
commit
ecb11a6848
|
|
@ -312,6 +312,59 @@ class HashEquivalenceCommonTests(object):
|
|||
server.process.join(300)
|
||||
self.assertIsNotNone(server.process.exitcode, "Server did not exit in a timely manner!")
|
||||
|
||||
def test_diverging_report_race(self):
|
||||
# Tests that a reported task will correctly pick up an updated unihash
|
||||
|
||||
# This is a baseline report added to the database to ensure that there
|
||||
# is something to match against as equivalent
|
||||
outhash1 = 'afd11c366050bcd75ad763e898e4430e2a60659b26f83fbb22201a60672019fa'
|
||||
taskhash1 = '3bde230c743fc45ab61a065d7a1815fbfa01c4740e4c895af2eb8dc0f684a4ab'
|
||||
unihash1 = '3bde230c743fc45ab61a065d7a1815fbfa01c4740e4c895af2eb8dc0f684a4ab'
|
||||
result = self.client.report_unihash(taskhash1, self.METHOD, outhash1, unihash1)
|
||||
|
||||
# Add a report that is equivalent to Task 1. It should ignore the
|
||||
# provided unihash and report the unihash from task 1
|
||||
taskhash2 = '6259ae8263bd94d454c086f501c37e64c4e83cae806902ca95b4ab513546b273'
|
||||
unihash2 = taskhash2
|
||||
result = self.client.report_unihash(taskhash2, self.METHOD, outhash1, unihash2)
|
||||
self.assertEqual(result['unihash'], unihash1)
|
||||
|
||||
# Add another report for Task 2, but with a different outhash (e.g. the
|
||||
# task is non-deterministic). It should still be marked with the Task 1
|
||||
# unihash because it has the Task 2 taskhash, which is equivalent to
|
||||
# Task 1
|
||||
outhash3 = 'd2187ee3a8966db10b34fe0e863482288d9a6185cb8ef58a6c1c6ace87a2f24c'
|
||||
result = self.client.report_unihash(taskhash2, self.METHOD, outhash3, unihash2)
|
||||
self.assertEqual(result['unihash'], unihash1)
|
||||
|
||||
|
||||
def test_diverging_report_reverse_race(self):
|
||||
# Same idea as the previous test, but Tasks 2 and 3 are reported in
|
||||
# reverse order the opposite order
|
||||
|
||||
outhash1 = 'afd11c366050bcd75ad763e898e4430e2a60659b26f83fbb22201a60672019fa'
|
||||
taskhash1 = '3bde230c743fc45ab61a065d7a1815fbfa01c4740e4c895af2eb8dc0f684a4ab'
|
||||
unihash1 = '3bde230c743fc45ab61a065d7a1815fbfa01c4740e4c895af2eb8dc0f684a4ab'
|
||||
result = self.client.report_unihash(taskhash1, self.METHOD, outhash1, unihash1)
|
||||
|
||||
taskhash2 = '6259ae8263bd94d454c086f501c37e64c4e83cae806902ca95b4ab513546b273'
|
||||
unihash2 = taskhash2
|
||||
|
||||
# Report Task 3 first. Since there is nothing else in the database it
|
||||
# will use the client provided unihash
|
||||
outhash3 = 'd2187ee3a8966db10b34fe0e863482288d9a6185cb8ef58a6c1c6ace87a2f24c'
|
||||
result = self.client.report_unihash(taskhash2, self.METHOD, outhash3, unihash2)
|
||||
self.assertEqual(result['unihash'], unihash2)
|
||||
|
||||
# Report Task 2. This is equivalent to Task 1, so will pick up the
|
||||
# unihash from that task
|
||||
result = self.client.report_unihash(taskhash2, self.METHOD, outhash1, unihash2)
|
||||
self.assertEqual(result['unihash'], unihash1)
|
||||
|
||||
# The originally reported unihash for Task 3 should have been updated
|
||||
# with the second report to use the new unihash from Task 1 (because is
|
||||
# shares a taskhash with Task 2)
|
||||
self.assertClientGetHash(self.client, taskhash2, unihash1)
|
||||
|
||||
class TestHashEquivalenceUnixServer(HashEquivalenceTestSetup, HashEquivalenceCommonTests, unittest.TestCase):
|
||||
def get_server_addr(self, server_idx):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user