Skip to content

Commit b0946e7

Browse files
committed
add test case
1 parent 5c96088 commit b0946e7

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.o
22
mkspiffs
33
mkspiffs.exe
4+
out.*

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,12 @@ clean:
6868
@rm -f *.o
6969
@rm -f spiffs/*.o
7070
@rm -f $(TARGET)
71+
72+
73+
test: $(TARGET)
74+
ls -1 spiffs > out.list0
75+
./mkspiffs -c spiffs -s 0x80000 -p 512 -b 0x2000 out.spiffs > out.list1
76+
./mkspiffs -l -s 0x80000 -p 512 -b 0x2000 out.spiffs | cut -f 2 | sort > out.list2
77+
diff out.list0 out.list1
78+
diff out.list0 out.list2
79+
rm -f out.list{0,1,2}

main.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ void spiffsMount(bool init)
107107

108108
void spiffsUnmount()
109109
{
110-
uint32_t total, used;
111-
SPIFFS_info(&s_fs, &total, &used);
112-
std::cerr << "total: " << total << ", used: " << used << std::endl;
113110
SPIFFS_unmount(&s_fs);
114111
}
115112

@@ -171,13 +168,12 @@ int addFiles(const char* dirname)
171168
continue;
172169
}
173170

174-
std::cerr << "adding " << ent->d_name;
171+
std::cout << ent->d_name << std::endl;
175172
if (addFile(ent->d_name, fullpath.c_str()) != 0) {
176-
std::cerr << " - error!" << std::endl;
173+
std::cerr << "error adding file!" << std::endl;
177174
error = true;
178175
break;
179176
}
180-
std::cerr << std::endl;
181177
}
182178
closedir (dir);
183179
} else {
@@ -258,6 +254,9 @@ int actionVisualize() {
258254

259255
spiffsMount(false);
260256
SPIFFS_vis(&s_fs);
257+
uint32_t total, used;
258+
SPIFFS_info(&s_fs, &total, &used);
259+
std::cout << "total: " << total << std::endl << "used: " << used << std::endl;
261260
spiffsUnmount();
262261

263262
return 0;

0 commit comments

Comments
 (0)