summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/testing.c51
-rw-r--r--testing/testing.h1
2 files changed, 52 insertions, 0 deletions
diff --git a/testing/testing.c b/testing/testing.c
index fc95054..7646b95 100644
--- a/testing/testing.c
+++ b/testing/testing.c
@@ -1,7 +1,58 @@
#include <stdint.h>
#include "log.h"
#include "kmalloc.h"
+#include "mount.h"
+#include "lib/string/string.h"
+
+void testing_mount_add(char *path, uint32_t t)
+{
+ mount m;
+ memcpy(m.path,path,strlen(path)+1);
+ m.type=t;
+ mount_add(m);
+}
+
+void testing_get_mount(char *path)
+{
+ /*
+ mount m;
+ char *subpath=get_mount_for_path(path,&m);
+ if(subpath==0)
+ {
+ testlog ("mount %s not found!",path);
+ }
+ else
+ {
+ testlog("mount [%s] is [%s] at [%s]",path, subpath, m.path);
+ }
+ */
+}
+
+void testing_mount()
+{
+ #ifndef FOOLOS_UNIT_TESTING
+ return;
+ #endif
+ testlog ("= UNIT TESTING MOUNTS =");
+ testing_mount_add("/",MOUNT_TYPE_EXT2);
+ testing_mount_add("/pipes/",MOUNT_TYPE_PIPES);
+ testing_mount_add("/pipes/input/",MOUNT_TYPE_PIPES);
+ testing_mount_add("/sys/",MOUNT_TYPE_SYS);
+ mount_dump();
+// testing_get_mount("pipes/input");
+ testing_get_mount("/dupa");
+ testing_get_mount("/pipe");
+ testing_get_mount("/pipes/input");
+ testing_get_mount("/pipes/in");
+ testing_get_mount("/pipes/input/");
+ testing_get_mount("/pipes/input/dups");
+ testing_get_mount("/sys");
+ testing_get_mount("/sys/ass");
+ testing_get_mount("/sys/ass/bass");
+ testing_get_mount("/foo/sys/ass/bass");
+ while(1);
+}
void testing_kmalloc_alloc(uint32_t size)
{
uint32_t addr=kballoc(size);
diff --git a/testing/testing.h b/testing/testing.h
index bde0453..df20770 100644
--- a/testing/testing.h
+++ b/testing/testing.h
@@ -1 +1,2 @@
void testing_kmalloc();
+void testing_mount();