summaryrefslogtreecommitdiff
path: root/testing/testing.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-16 23:46:30 +0200
committerMiguel <m.i@gmx.at>2018-09-16 23:46:30 +0200
commit06e6e427c76bdb88a7f72dd04411d95a4bda3270 (patch)
tree5c2bae3ca5292bf3db58c33ef3d7f4f3947593c3 /testing/testing.c
parent740ae2e69995df37c44fe61f57642ee642982ca2 (diff)
starting to create sysfs
Diffstat (limited to 'testing/testing.c')
-rw-r--r--testing/testing.c51
1 files changed, 51 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);