import RT-Thread@9217865c without bsp, libcpu and components/net

This commit is contained in:
Zihao Yu 2023-05-20 16:23:33 +08:00
commit e2376a3709
1414 changed files with 390370 additions and 0 deletions

View file

@ -0,0 +1,11 @@
menuconfig RTT_POSIX_TESTCASE_DIRENT_H
bool "<dirent.h>"
default n
if RTT_POSIX_TESTCASE_DIRENT_H
config DIRENT_H_OPENDIR_READDIR_CLOSEDIR
bool "<dirent.h> -> opendir, readdir, closedir"
default n
endif

View file

@ -0,0 +1,19 @@
import rtconfig
Import('RTT_ROOT')
from building import *
# get current directory
cwd = GetCurrentDir()
path = [cwd]
src = []
if GetDepend('RTT_POSIX_TESTCASE_DIRENT_H'):
src += Glob('./definitions/*.c')
if GetDepend('DIRENT_H_OPENDIR_READDIR_CLOSEDIR'):
src += Glob('./functions/open_read_close_dir_tc.c')
group = DefineGroup('rtt_posix_testcase', src, depend = ['RTT_POSIX_TESTCASE_DIRENT_H'], CPPPATH = path)
Return('group')

View file

@ -0,0 +1,41 @@
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
#define DIRFD_TEST_NAME "/"
/* API for: opendir readdir closedir */
static int dir_test_entry(void)
{
DIR *dirp;
struct dirent *d;
dirp = opendir(DIRFD_TEST_NAME);
if (dirp == RT_NULL)
{
printf("open directory error!\n");
}
else
{
while ((d = readdir(dirp)) != RT_NULL)
{
printf("found %s\n", d->d_name);
}
closedir(dirp);
}
return 0;
}
#include <utest.h>
static void test_dir(void)
{
uassert_int_equal(dir_test_entry(), 0);
}
static void testcase(void)
{
UTEST_UNIT_RUN(test_dir);
}
UTEST_TC_EXPORT(testcase, "posix.dirent_h.open_read_close_dir_tc.c", RT_NULL, RT_NULL, 10);