diff mbox series

[v4,13/18] selftests/nolibc: prepare /tmp for tmpfs or ramfs

Message ID ef82268ef4a9ae263a17cd1a3533842271c5520c.1688750763.git.falcon@tinylab.org
State New
Headers show
Series selftests/nolibc: allow run with minimal kernel config | expand

Commit Message

Zhangjin Wu July 7, 2023, 6:38 p.m. UTC
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.

Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 tools/testing/selftests/nolibc/nolibc-test.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 5497ee86cf40..6b863f7b677c 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -1063,6 +1063,10 @@  int prepare(void)
 		}
 	}
 
+	/* try to mount /tmp if not mounted, if not mountable, use ramfs as tmpfs */
+	mkdir("/tmp", 0755);
+	mount("none", "/tmp", "tmpfs", 0, 0);
+
 	return 0;
 }