aboutsummaryrefslogtreecommitdiff
path: root/src/tests/myriadfs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/myriadfs.cpp')
-rw-r--r--src/tests/myriadfs.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/tests/myriadfs.cpp b/src/tests/myriadfs.cpp
index fd96c02..5946b27 100644
--- a/src/tests/myriadfs.cpp
+++ b/src/tests/myriadfs.cpp
@@ -8,19 +8,41 @@ using namespace Bu;
8 8
9int main( int argc, char *argv[] ) 9int main( int argc, char *argv[] )
10{ 10{
11 Bu::MemBuf mb; 11// Bu::MemBuf mb;
12 Bu::File mb("store.myr", File::Read|File::Write|File::Create );
12 Bu::MyriadFs mfs( mb, 512 ); 13 Bu::MyriadFs mfs( mb, 512 );
13 14
15 sio << "Creating dirs..." << sio.nl;
16 mfs.create("/etc", Bu::MyriadFs::typeDir|0755 );
17 mfs.create("/dev", Bu::MyriadFs::typeDir|0755 );
18 mfs.create("/usr", Bu::MyriadFs::typeDir|0755 );
19
20 mfs.create("/dev/null", Bu::MyriadFs::typeChrDev|0666, 1, 3 );
21 mfs.create("/dev/zero", Bu::MyriadFs::typeChrDev|0666, 1, 5 );
22 mfs.create("/dev/sda", Bu::MyriadFs::typeBlkDev|0660, 8, 0 );
23
24 sio << "Creating files..." << sio.nl;
14 { 25 {
15 Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); 26 Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read );
16 ms.write("world!"); 27 ms.write("world!");
17 } 28 }
29 {
30 Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read );
31 ms.write("world, again!");
32 }
18 33
34 sio << "Reading files..." << sio.nl;
19 { 35 {
20 Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); 36 Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read );
21 char buf[512]; 37 char buf[512];
22 buf[ms.read( buf, 512 )] = '\0'; 38 buf[ms.read( buf, 512 )] = '\0';
23 sio << "read: '" << buf << "'" << sio.nl; 39 sio << "read: '" << buf << "'" << sio.nl;
24 } 40 }
41 {
42 Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read );
43 char buf[512];
44 buf[ms.read( buf, 512 )] = '\0';
45 sio << "read: '" << buf << "'" << sio.nl;
46 }
25} 47}
26 48