Fixed testing issues introduced by expanding superblocks

This was mostly tweaking test cases to be accommodating for variable
sized superblock-lists. Though there were a few bugs that needed fixing:
- Changed compact to use source dir for move since the original dir
  could have changed as a result of an expand.
- Created copy of current directory so we don't overwrite ourselves
  during an internal commit update.

Also made sure all of the test suites provide reproducable results when
ran independently (the entry tests were behaving differently based on
which tests were ran before).

(Some where legitimate test failures)
This commit is contained in:
Christopher Haster
2018-08-07 14:10:03 -05:00
parent d8f930eeab
commit 3b3981eb74
3 changed files with 86 additions and 32 deletions

10
lfs.c
View File

@@ -658,7 +658,7 @@ static int lfs_commit_move(lfs_t *lfs, struct lfs_commit *commit,
int32_t res = lfs_commit_get(lfs, commit->block,
commit->off, commit->ptag,
lfs_tag_isuser(tag) ? 0x7ffff000 : 0x7c3ff000,
LFS_MKTAG(lfs_tag_type(tag), toid, 0),
(tag & 0x7fc00000) | LFS_MKTAG(0, toid, 0),
0, NULL, true);
if (res < 0 && res != LFS_ERR_NOENT) {
return res;
@@ -1166,7 +1166,7 @@ split:
tail.tail[0] = dir->tail[0];
tail.tail[1] = dir->tail[1];
err = lfs_dir_compact(lfs, &tail, attrs, dir, ack+1-expanding, end);
err = lfs_dir_compact(lfs, &tail, attrs, source, ack+1-expanding, end);
if (err) {
return err;
}
@@ -1346,8 +1346,12 @@ compact:
lfs_global_xor(&lfs->globals, &canceldiff);
// update any directories that are affected
lfs_mdir_t copy = *dir;
// two passes, once for things that aren't us, and one
// for things that are
for (lfs_mlist_t *d = lfs->mlist; d; d = d->next) {
if (lfs_pair_cmp(d->m.pair, dir->pair) == 0) {
if (lfs_pair_cmp(d->m.pair, copy.pair) == 0) {
d->m = *dir;
if (d->id == lfs_tag_id(deletetag)) {
d->m.pair[0] = 0xffffffff;