diff options
Diffstat (limited to 'bitbake/lib/hashserv/tests.py')
-rw-r--r-- | bitbake/lib/hashserv/tests.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py index 13ccb20ebf..da3f8e0884 100644 --- a/bitbake/lib/hashserv/tests.py +++ b/bitbake/lib/hashserv/tests.py | |||
@@ -969,6 +969,48 @@ class HashEquivalenceCommonTests(object): | |||
969 | # First hash is still present | 969 | # First hash is still present |
970 | self.assertClientGetHash(self.client, taskhash, unihash) | 970 | self.assertClientGetHash(self.client, taskhash, unihash) |
971 | 971 | ||
972 | def test_gc_stream(self): | ||
973 | taskhash = '53b8dce672cb6d0c73170be43f540460bfc347b4' | ||
974 | outhash = '5a9cb1649625f0bf41fc7791b635cd9c2d7118c7f021ba87dcd03f72b67ce7a8' | ||
975 | unihash = 'f37918cc02eb5a520b1aff86faacbc0a38124646' | ||
976 | |||
977 | result = self.client.report_unihash(taskhash, self.METHOD, outhash, unihash) | ||
978 | self.assertEqual(result['unihash'], unihash, 'Server returned bad unihash') | ||
979 | |||
980 | taskhash2 = '3bf6f1e89d26205aec90da04854fbdbf73afe6b4' | ||
981 | outhash2 = '77623a549b5b1a31e3732dfa8fe61d7ce5d44b3370f253c5360e136b852967b4' | ||
982 | unihash2 = 'af36b199320e611fbb16f1f277d3ee1d619ca58b' | ||
983 | |||
984 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash2, unihash2) | ||
985 | self.assertClientGetHash(self.client, taskhash2, unihash2) | ||
986 | |||
987 | taskhash3 = 'a1117c1f5a7c9ab2f5a39cc6fe5e6152169d09c0' | ||
988 | outhash3 = '7289c414905303700a1117c1f5a7c9ab2f5a39cc6fe5e6152169d09c04f9a53c' | ||
989 | unihash3 = '905303700a1117c1f5a7c9ab2f5a39cc6fe5e615' | ||
990 | |||
991 | result = self.client.report_unihash(taskhash3, self.METHOD, outhash3, unihash3) | ||
992 | self.assertClientGetHash(self.client, taskhash3, unihash3) | ||
993 | |||
994 | # Mark the first unihash to be kept | ||
995 | ret = self.client.gc_mark_stream("ABC", (f"unihash {h}" for h in [unihash, unihash2])) | ||
996 | self.assertEqual(ret, {"count": 2}) | ||
997 | |||
998 | ret = self.client.gc_status() | ||
999 | self.assertEqual(ret, {"mark": "ABC", "keep": 2, "remove": 1}) | ||
1000 | |||
1001 | # Third hash is still there; mark doesn't delete hashes | ||
1002 | self.assertClientGetHash(self.client, taskhash3, unihash3) | ||
1003 | |||
1004 | ret = self.client.gc_sweep("ABC") | ||
1005 | self.assertEqual(ret, {"count": 1}) | ||
1006 | |||
1007 | # Hash is gone. Taskhash is returned for second hash | ||
1008 | self.assertClientGetHash(self.client, taskhash3, None) | ||
1009 | # First hash is still present | ||
1010 | self.assertClientGetHash(self.client, taskhash, unihash) | ||
1011 | # Second hash is still present | ||
1012 | self.assertClientGetHash(self.client, taskhash2, unihash2) | ||
1013 | |||
972 | def test_gc_switch_mark(self): | 1014 | def test_gc_switch_mark(self): |
973 | taskhash = '53b8dce672cb6d0c73170be43f540460bfc347b4' | 1015 | taskhash = '53b8dce672cb6d0c73170be43f540460bfc347b4' |
974 | outhash = '5a9cb1649625f0bf41fc7791b635cd9c2d7118c7f021ba87dcd03f72b67ce7a8' | 1016 | outhash = '5a9cb1649625f0bf41fc7791b635cd9c2d7118c7f021ba87dcd03f72b67ce7a8' |