Skip to content

Commit 5dbc43b

Browse files
tests for C33 too
1 parent 558b135 commit 5dbc43b

File tree

8 files changed

+50
-22
lines changed

8 files changed

+50
-22
lines changed

.vscode/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"files.associations": {
3+
"array": "cpp",
4+
"compare": "cpp",
5+
"functional": "cpp",
6+
"tuple": "cpp",
7+
"type_traits": "cpp",
8+
"utility": "cpp",
9+
"deque": "cpp",
10+
"string": "cpp",
11+
"unordered_map": "cpp",
12+
"vector": "cpp",
13+
"string_view": "cpp",
14+
"initializer_list": "cpp"
15+
}
16+
}

src/Folder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Folder::Folder(const char* path) {
1616
int result = mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO);
1717
if (result == 0) {
1818
this->path = std::string(path);
19+
1920
} // else ...not sure about this one yet
2021
}
2122
}

src/InternalStorage.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include "Arduino_UnifiedStorage.h"
22

33
InternalStorage::InternalStorage(){
4-
this -> fs = FS_FAT;
5-
this -> setQSPIPartition(2);
6-
this -> setQSPIPartitionName("user");
4+
this -> fs = FS_FAT;
5+
this -> setQSPIPartition(2);
6+
this -> setQSPIPartitionName("user");
77
}
88

99
InternalStorage::InternalStorage(int partition, const char * name, uint8_t fs){
@@ -28,17 +28,24 @@ int InternalStorage::begin(){
2828
this -> blockDevice = QSPIFBlockDevice::get_default_instance();
2929
this -> userData = new mbed::MBRBlockDevice(this->blockDevice, this->partitionNumber);
3030
if(this -> fs == FS_FAT){
31+
3132
if(this -> userDataFileSystem != nullptr){
32-
delete(this -> userDataFileSystem);
33+
delete(this -> userDataFileSystem);
34+
3335
}
3436
this -> userDataFileSystem = new mbed::FATFileSystem(this->partitionName);
3537
} else {
36-
if(this -> userDataFileSystem != nullptr){
38+
39+
if(this -> userDataFileSystem != nullptr){
3740
delete(this -> userDataFileSystem);
41+
3842
}
43+
44+
3945
this -> userDataFileSystem = new mbed::LittleFileSystem(this->partitionName);
4046
}
4147
int err = this -> userDataFileSystem -> mount(this -> userData);
48+
4249
if(err == 0) return 1;
4350
#endif
4451
}
@@ -49,7 +56,7 @@ int InternalStorage::unmount(){
4956
}
5057

5158
Folder InternalStorage::getRootFolder(){
52-
return Folder("/user");
59+
return Folder(String("/" + String(this->partitionName)).c_str());
5360
}
5461

5562

tests/TestFileOperations/TestFileOperations.ino

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include <Arduino_UnifiedStorage.h>
22

3-
#define HAS_USB
3+
44
#define HAS_SD
5+
#define HAS_USB
56
#define HAS_QSPI
67

78
#if defined(HAS_USB)
@@ -310,17 +311,22 @@ void setup(){
310311
Serial.begin(115200);
311312
while(!Serial);
312313

314+
#if defined(HAS_SD)
315+
sd.formatFAT();
316+
runTests(&sd, "SD");
317+
#endif
318+
313319
#if defined(HAS_USB)
320+
usb.formatFAT();
314321
runTests(&usb, "USB");
315322
#endif
316323

317324
#if defined(HAS_QSPI)
325+
internal.formatFAT();
318326
runTests(&internal, "QSPI");
319327
#endif
320328

321-
#if defined(HAS_SD)
322-
runTests(&sd, "SD");
323-
#endif
329+
324330

325331
}
326332

tests/TestMultipleQSPIPartitions/TestMultipleQSPIPartitions.ino

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/TestRepeatedFormatMount/TestRepeatedFormatMount.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <Arduino_UnifiedStorage.h>
22

3-
// #define HAS_USB
4-
// #define HAS_SD
3+
#define HAS_USB
4+
#define HAS_SD
55
#define HAS_QSPI
66

77
#if defined(HAS_USB)

tests/TestUnified/TestUnified.ino

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <Arduino_UnifiedStorage.h>
22

33
#define HAS_USB
4-
#define HAS_SD
4+
//#define HAS_SD
55
#define HAS_QSPI
66

77
#if defined(HAS_USB)
@@ -63,7 +63,7 @@ void test(String opperation, Arduino_UnifiedStorage* sourceStorage, Arduino_Unif
6363
}
6464

6565

66-
66+
#if defined(HAS_USB) && defined(HAS_SD)
6767
void sd_and_usb(){
6868
Serial.println("TESTING SD AND USB \n\n\n\n");
6969

@@ -109,7 +109,10 @@ void sd_and_usb(){
109109
test("move", sd, usb, "SD LittleFS", "USB FAT");
110110
test("copy", sd, usb, "SD LittleFS", "USB FAT");
111111
}
112+
#endif
112113

114+
115+
#if defined(HAS_QSPI) && defined(HAS_SD)
113116
void qspi_and_sd() {
114117
Serial.println("TESTING QSPI AND SD \n\n\n\n");
115118
Serial.println("-----------------------------");
@@ -153,8 +156,9 @@ void qspi_and_sd() {
153156
test("move", qspi, sd, "QSPI FAT", "SD LittleFS");
154157
test("copy", qspi, sd, "QSPI FAT", "SD LittleFS");
155158
}
159+
#endif
156160

157-
161+
#if defined(HAS_QSPI) && defined(HAS_USB)
158162
void qspi_and_usb() {
159163

160164
Serial.println("TESTING QSPI AND USB \n\n\n\n");
@@ -201,7 +205,7 @@ void qspi_and_usb() {
201205
test("copy", qspi, usb, "QSPI FAT", "USB LittleFS");
202206

203207
}
204-
208+
#endif
205209

206210
void setup(){
207211
Serial.begin(115200);

tests/test_qspi_usb_sd/test_qspi_usb_sd.ino

Whitespace-only changes.

0 commit comments

Comments
 (0)