mirror of
https://github.com/torvalds/linux.git
synced 2024-12-06 11:01:43 +00:00
selftests/nolibc: fix up failures when CONFIG_PROC_FS=n
For CONFIG_PROC_FS=n, the /proc is not mountable, but the /proc directory has been created in the prepare() stage whenever /proc is there or not. so, the checking of /proc in the run_syscall() stage will be always true and at last it will fail all of the procfs dependent test cases, which deviates from the 'cond' check design of the EXPECT_xx macros, without procfs, these test cases should be skipped instead of failed. To solve this issue, one method is checking /proc/self instead of /proc, another method is removing the /proc directory completely for CONFIG_PROC_FS=n, we apply the second method to avoid misleading the users. Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
This commit is contained in:
parent
4e14e84442
commit
b8b26108e4
@ -1057,8 +1057,11 @@ int prepare(void)
|
||||
|
||||
/* try to mount /proc if not mounted. Silently fail otherwise */
|
||||
if (stat("/proc/.", &stat_buf) == 0 || mkdir("/proc", 0755) == 0) {
|
||||
if (stat("/proc/self", &stat_buf) != 0)
|
||||
mount("/proc", "/proc", "proc", 0, 0);
|
||||
if (stat("/proc/self", &stat_buf) != 0) {
|
||||
/* If not mountable, remove /proc completely to avoid misuse */
|
||||
if (mount("none", "/proc", "proc", 0, 0) != 0)
|
||||
rmdir("/proc");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user