Fixed test failures caused by changes to open semantics

- Fixed fsync tests, which needed more lfsr_file_sync calls so multiple
  file handles can be opened correctly.

  Though this points out there's no way to open a rdonly file on an
  uncreated file until sync is called... But I guess you wouldn't be
  able to recieve broadcasts until sync anyways? at which point the file
  would be created?

- Update mtree tests based on the new remove behavior for regular files.

  Before this changed the mid to -1, now it points to the next mid with
  the zombie flag set. Upper layers use this to migrate mdirs to a
  scratch file if necessary.

- Removed the orphaned mdir test. We don't create orphaned mdirs
  anymore.

  Technically, orphaned mdirs are currently possible if we lose power in
  the middle of the mtree update, but this is a bug and should be fixed
  (previous revisions did not have this issue).
This commit is contained in:
Christopher Haster
2024-01-16 00:50:54 -06:00
parent 0c6db4c9a7
commit f6742eefb3
2 changed files with 12 additions and 108 deletions
+10
View File
@@ -18,6 +18,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_RDONLY) => 0;
// write to a
@@ -120,6 +121,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_WRONLY) => 0;
lfsr_file_open(&lfs, &c, "jello", LFS_O_RDONLY) => 0;
@@ -239,6 +241,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_WRONLY) => 0;
lfsr_file_open(&lfs, &c, "jello", LFS_O_RDONLY) => 0;
@@ -372,6 +375,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL | LFS_O_APPEND) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_WRONLY | LFS_O_APPEND) => 0;
lfsr_file_open(&lfs, &c, "jello", LFS_O_RDONLY) => 0;
@@ -1714,6 +1718,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_RDONLY) => 0;
// write to a and sync
@@ -1800,6 +1805,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_RDONLY) => 0;
lfsr_file_open(&lfs, &c, "jello", LFS_O_RDONLY | LFS_O_DESYNC) => 0;
@@ -1881,6 +1887,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_WRONLY) => 0;
lfsr_file_open(&lfs, &c, "jello", LFS_O_RDONLY) => 0;
@@ -2001,6 +2008,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_WRONLY) => 0;
lfsr_file_open(&lfs, &c, "jello", LFS_O_RDONLY) => 0;
@@ -2100,6 +2108,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_RDONLY) => 0;
lfsr_file_open(&lfs, &c, "jello", LFS_O_RDONLY | LFS_O_DESYNC) => 0;
@@ -2203,6 +2212,7 @@ code = '''
uint8_t rbuf[256];
lfsr_file_open(&lfs, &a, "jello",
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL | LFS_O_APPEND) => 0;
lfsr_file_sync(&lfs, &a) => 0;
lfsr_file_open(&lfs, &b, "jello", LFS_O_WRONLY | LFS_O_APPEND) => 0;
lfsr_file_open(&lfs, &c, "jello", LFS_O_RDONLY) => 0;