lkml.org 
[lkml]   [2023]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 11/15] selftests/nolibc: prepare /tmp for tmpfs or ramfs
Date
Let's create a /tmp directory and mount tmpfs there, if tmpfs is not
mountable, use ramfs as tmpfs.

tmpfs will be used instead of procfs for some tests.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
tools/testing/selftests/nolibc/nolibc-test.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index c0f5302ada5d..8e3e2792f5e3 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -1054,6 +1054,10 @@ int prepare(void)
}
}

+ /* try to mount /tmp if not mounted, if not mountable, use ramfs as tmpfs */
+ if (stat("/tmp/.", &stat_buf) == 0 || mkdir("/tmp", 0755) == 0)
+ mount("none", "/tmp", "tmpfs", 0, 0);
+
return 0;
}

--
2.25.1
\
 
 \ /
  Last update: 2023-06-30 01:54    [W:0.204 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site