Commit Graph

169 Commits

Author SHA1 Message Date
Tony Tung
0713484f88 [fastmanifest] test that checksums for ancestor directory nodes are invalidated after updates
Summary: When we add or remove something to a path, we need to ensure that all the directory nodes leading to that path entry have their checksums invalidated.  This test verifies that behavior, and ensures that directory nodes that do *not* lead to the path entry are not invalidated.

Test Plan: pass unit test.  found the bug in D3143825

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D3143832

Tasks: 10697482

Signature: t1:3143832:1460587147:1948e6c01a2799d5010174ff8be22830f0cb9c53
2016-04-18 11:35:19 -07:00
Tony Tung
3b4e9b3313 [fastmanifest] invalidate checksums after a successful add_or_update_path
Summary: If the changes metadata structure is not updated, then we will not update the directory nodes as we walk up.

Test Plan: pass a unit test in a later diff.

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D3143825

Tasks: 10697482

Signature: t1:3143825:1459971608:9e5d91bf80020cf71cfc5aca6fb72c8cc67dce59
2016-04-18 11:34:49 -07:00
Tony Tung
f8cae10edb [fastmanifest] benchmark checksum calculation
Summary: Not sure it's functional, but once it is, it's benchmark-able!

Test Plan: compiles and runs.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3141571

Signature: t1:3141571:1460071270:5bbb1d32bd97406d2cfd88955fabe29763132c7b
2016-04-18 11:34:30 -07:00
Tony Tung
e231b3320d [fastmanifest] fix the checksum update mechanism
Summary: Incremented the wrong value.  Caught this when running a unit test to update the checksum of an empty tree.

Test Plan: passes unit test now.

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D3140684

Tasks: 10697482

Signature: t1:3140684:1459903366:be1b970281e0df91b2a62e7fac2c1d417a8be221
2016-04-18 11:34:01 -07:00
Tony Tung
495ee1e2c7 [fastmanifest] initialize_node doesn't need the max_children
Summary: It's unused.  Get rid of the parameter.

Test Plan: pass unit tests

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3140664

Signature: t1:3140664:1460070644:047933753763797fe40504bc1cf883e4f8f8adc7
2016-04-18 11:33:28 -07:00
Tony Tung
da7b2357da [fastmanifest] fix misnomer in cmake file
Summary: Since I'm adding a .c file, TEST_HEADER_FILES is not really an accurate description.

Test Plan: pass unit tests.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3140374

Signature: t1:3140374:1460071293:77e11a27249196564f2ee816cc50e67951325a75
2016-04-18 11:33:08 -07:00
Tony Tung
a40ffad87d [fastmanifest] add mechanism to peek at directories in tests
Summary: I need this to be able to access directory nodes for checksum testing.

Test Plan: passed unit tests

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D3140368

Tasks: 10697482

Signature: t1:3140368:1460584956:671cd08ca174795445a297ef75bee53d9f09a8ad
2016-04-18 11:32:31 -07:00
Tony Tung
a23d34c3e4 [fastmanifest] extract tree path traversal code to tree_path.[ch]
Summary: I'm planning on building a find_path traversal that exposes directories, and make it available for tests.

Test Plan: pass unit tests.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3138945

Signature: t1:3138945:1460071138:3eb43a1742c8b0d856f0b97421eb499d9e328310
2016-04-08 22:34:43 -07:00
Tony Tung
8db7c5eb12 [fastmanifest] rename tree_add_child() test to avoid possible conflict
Summary: It's also in tree.c.  Right now, it's a static function, but I'm planning on make it non-static.

Test Plan: pass unit tests

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3138923

Signature: t1:3138923:1460071054:9105ffcbff2b4330faf22652755dc28d8313c5e2
2016-04-08 22:34:24 -07:00
Tony Tung
3525719552 [fastmanifest] get_path should not return directories
Summary: As far as the consumers of this library are concerned, directories are a non-entity.

Test Plan: wrote a unit test.  unit test fails.  made the change in `test.c`, all unit tests pass.

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D3135694

Signature: t1:3135694:1459809348:5b120e527427032857aa976278cca2ef8d3f1372
2016-04-08 22:34:03 -07:00
Tony Tung
cc38718558 [fastmanifest] get_path should not return a node_t
Summary: Callers of `get_path` do not need to know the internal representation of a node.  All they are interested in is the presence, the checksum, and the flags.

Test Plan: passed unit tests

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D3135625

Signature: t1:3135625:1459809298:4bd982091219fa94a1cfcc18238784c9c6e201b8
2016-04-08 22:33:34 -07:00
Tony Tung
deadce5eb8 [fastmanifest fix all the other places where the pointer style is inconsistent
Test Plan: run unit tests.

Reviewers: #sourcecontrol, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3130423

Signature: t1:3130423:1459811638:268cb647facbde3f2cf2d37118bdfe56bce0e637
2016-04-08 22:33:07 -07:00
Tony Tung
88cd00b144 [fastmanifest] remove path
Summary: Support for removing a path from the tree.  Prunes directory nodes so we don't leave empty ones around.

Test Plan: pass unit tests.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, lcharignon, mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3130263

Tasks: 10589043

Signature: t1:3130263:1460140241:8d3f1824990270d693265fa8389dd5a4893c4552
2016-04-08 22:32:37 -07:00
Tony Tung
fceff111a7 [fastmanifest] search children should return an illegal value when it fails
Summary: 0 is actually a legit index, so if someone checks that instead of the node pointer, then we might find the wrong thing.

Test Plan: pass unit tests.

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3130262

Signature: t1:3130262:1459557188:661eae1363bf603a77e1d17960db0a5f8f33834b
2016-04-06 12:40:32 -07:00
Tony Tung
b7a8a6c9cf eliminate the double enum names
Summary: They're not used anywhere.

Test Plan: pass unit tests

Reviewers: #sourcecontrol, quark

Reviewed By: quark

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3129166

Signature: t1:3129166:1459549501:424a52d4b28484016201e250111bc0b1dab6a317
2016-04-06 12:40:08 -07:00
Tony Tung
4c9a529497 [fastmanifest] improve errorhandling of alloc_tree()
Summary: Move the real work to `alloc_tree_helper()`.  This allows us to have the jump to cleanup without the goto.

Test Plan: pass unit tests.

Reviewers: #sourcecontrol, lcharignon

Reviewed By: lcharignon

Subscribers: lcharignon, mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3128539

Tasks: 10670537

Signature: t1:3128539:1459962010:d58e7ea89802416128dd312e76d619de6d29dc42
2016-04-06 12:39:45 -07:00
Tony Tung
24ff723f4f [fastmanifest] make a ROOT node type
Summary: On remove_path, we need to remove the implicit nodes that are empty after we remove the leaf node.  Actually typing the nodes differently makes this easier.

Test Plan: pass unit tests.

Reviewers: #sourcecontrol, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3128497

Signature: t1:3128497:1459811588:d3132edc7044061263457c7d0b5ee072b67204c9
2016-04-04 16:24:22 -07:00
Tony Tung
91a9f27549 [fastmanifest] suppress check-code on fastmanifest
Summary: It's not going to pass.

Test Plan: run check-code

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3126493

Tasks: 10662043

Signature: t1:3126493:1459523935:54449c39abfef97b596e9c34743583afa8b983d5
2016-04-01 11:19:53 -07:00
Tony Tung
14a8f27f55 [fastmanifest] initial checkin
Summary:
Still missing:

== Code and tests: ==
* remove path
* contains path (but this is essentially the same as get path)
* read/write from file

== Tests: ==
* checksumming directories

Test Plan: well, it kind of builds.

Reviewers: durham, simpkins, lcharignon

Reviewed By: lcharignon

Subscribers: net-systems-diffs@, mitrandir, mjpieters, akushner, rmcelroy

Differential Revision: https://phabricator.fb.com/D3120166

Signature: t1:3120166:1459464981:60f19dd1e36d62776a69fa88c018122a4be27d87
2016-04-01 00:46:28 -07:00