| 130 | } |
| 131 | |
| 132 | void readCheck(IFS::FileSystem* fsOld, IFS::FileSystem* fsNew) |
| 133 | { |
| 134 | DirHandle dir{}; |
| 135 | int res = fsOld->opendir(nullptr, dir); |
| 136 | if(res < 0) { |
| 137 | debug_e("opendir failed: %s", fsOld->getErrorString(res).c_str()); |
| 138 | TEST_ASSERT(false); |
| 139 | return; |
| 140 | } |
| 141 | |
| 142 | FileNameStat stat; |
| 143 | while((res = fsOld->readdir(dir, stat)) >= 0) { |
| 144 | FileStat statNew; |
| 145 | fsNew->stat(stat.name.buffer, &statNew); |
| 146 | debug_i("File '%s' size %u / %u", stat.name.buffer, stat.size, statNew.size); |
| 147 | |
| 148 | String oldContent = fsOld->getContent(stat.name.buffer); |
| 149 | CHECK(oldContent); |
| 150 | String newContent = fsNew->getContent(stat.name.buffer); |
| 151 | CHECK(newContent); |
| 152 | |
| 153 | CHECK_EQ(newContent, oldContent); |
| 154 | } |
| 155 | |
| 156 | CHECK_EQ(res, IFS::Error::NoMoreFiles); |
| 157 | debug_i("readdir(): %s", fsOld->getErrorString(res).c_str()); |
| 158 | |
| 159 | fsOld->closedir(dir); |
| 160 | } |
| 161 | #endif |
| 162 | }; |
| 163 | |