From 703930f7c2842bc3849a3e216d60d0000027f3d2 Mon Sep 17 00:00:00 2001 From: Rbb666 Date: Mon, 13 Oct 2025 17:15:17 +0800 Subject: [PATCH] [utest]Remove all posix test cases from utest. --- Kconfig.utestcases | 1 - examples/utest/testcases/posix/Kconfig | 37 -- examples/utest/testcases/posix/SConscript | 14 - examples/utest/testcases/posix/aio_h/Kconfig | 39 -- examples/utest/testcases/posix/arpa/Kconfig | 1 - .../utest/testcases/posix/arpa/inet_h/Kconfig | 11 - .../utest/testcases/posix/ctype_h/Kconfig | 9 - .../utest/testcases/posix/ctype_h/SConscript | 16 - .../posix/ctype_h/definitions/ctype_h.c | 31 - .../utest/testcases/posix/dirent_h/Kconfig | 11 - .../utest/testcases/posix/dirent_h/SConscript | 19 - .../functions/open_read_close_dir_tc.c | 41 -- .../utest/testcases/posix/errno_h/Kconfig | 3 - .../utest/testcases/posix/errno_h/SConscript | 15 - .../posix/errno_h/definitions/errno_h.c | 104 ---- .../utest/testcases/posix/fcntl_h/Kconfig | 9 - examples/utest/testcases/posix/fenv_h/Kconfig | 9 - .../utest/testcases/posix/inttypes_h/Kconfig | 9 - .../utest/testcases/posix/libgen_h/Kconfig | 15 - .../utest/testcases/posix/locale_h/Kconfig | 15 - .../utest/testcases/posix/mqueue_h/Kconfig | 9 - examples/utest/testcases/posix/net/Kconfig | 1 - .../utest/testcases/posix/net/if_h/Kconfig | 11 - .../utest/testcases/posix/netdb_h/Kconfig | 11 - .../utest/testcases/posix/pthread_h/Kconfig | 43 -- .../testcases/posix/pthread_h/SConscript | 47 -- .../posix/pthread_h/definitions/pthread_h.c | 159 ----- .../posix/pthread_h/functions/posixtest.h | 25 - .../pthread_cond_broadcast_2-1_tc.c | 138 ----- .../pthread_cond_destroy_1-1_tc.c | 85 --- .../pthread_cond_init_1-1_tc.c | 65 -- .../pthread_cond_timedwait_2-1_tc.c | 143 ----- .../pthread_create/pthread_create_1-2_tc.c | 61 -- .../pthread_detach/pthread_detach_1-1_tc.c | 91 --- .../pthread_detach/pthread_detach_2-1_tc.c | 87 --- .../pthread_detach/pthread_detach_4-1_tc.c | 92 --- .../pthread_exit/pthread_exit_1-1_tc.c | 79 --- .../pthread_join/pthread_join_1-1_tc.c | 75 --- .../pthread_h/functions/rtt_utest_internal.h | 24 - .../pthread_h/functions/testfrmw/testfrmw.c | 68 --- .../pthread_h/functions/testfrmw/testfrmw.h | 96 --- .../functions/testfrmw/threads_scenarii.c | 555 ------------------ .../utest/testcases/posix/sched_h/Kconfig | 9 - .../utest/testcases/posix/semaphore_h/Kconfig | 9 - .../utest/testcases/posix/setjmp_h/Kconfig | 9 - .../utest/testcases/posix/signal_h/Kconfig | 23 - .../utest/testcases/posix/stdarg_h/Kconfig | 9 - .../utest/testcases/posix/stdio_h/Kconfig | 149 ----- .../utest/testcases/posix/stdio_h/SConscript | 122 ---- .../posix/stdio_h/definitions/stdio_h.c | 123 ---- .../posix/stdio_h/functions/clearerr_tc.c | 31 - .../posix/stdio_h/functions/fclose_tc.c | 34 -- .../posix/stdio_h/functions/fdopen_tc.c | 39 -- .../posix/stdio_h/functions/feof_tc.c | 55 -- .../posix/stdio_h/functions/ferror_tc.c | 28 - .../posix/stdio_h/functions/fflush_tc.c | 29 - .../posix/stdio_h/functions/fgetc_tc.c | 54 -- .../posix/stdio_h/functions/fgets_tc.c | 50 -- .../posix/stdio_h/functions/fileno_tc.c | 26 - .../posix/stdio_h/functions/fopen_tc.c | 28 - .../posix/stdio_h/functions/fprintf_tc.c | 45 -- .../posix/stdio_h/functions/fputc_tc.c | 44 -- .../posix/stdio_h/functions/fputs_tc.c | 45 -- .../posix/stdio_h/functions/fread_tc.c | 44 -- .../posix/stdio_h/functions/fscanf_tc.c | 44 -- .../posix/stdio_h/functions/fseek_tc.c | 44 -- .../posix/stdio_h/functions/ftell_tc.c | 38 -- .../posix/stdio_h/functions/fwrite_tc.c | 45 -- .../posix/stdio_h/functions/perror_tc.c | 27 - .../posix/stdio_h/functions/printf_tc.c | 19 - .../posix/stdio_h/functions/putc_tc.c | 44 -- .../posix/stdio_h/functions/putchar_tc.c | 25 - .../posix/stdio_h/functions/puts_tc.c | 22 - .../posix/stdio_h/functions/remove_tc.c | 35 -- .../posix/stdio_h/functions/rename_tc.c | 37 -- .../posix/stdio_h/functions/rewind_tc.c | 44 -- .../posix/stdio_h/functions/setbuf_tc.c | 41 -- .../posix/stdio_h/functions/setvbuf_tc.c | 41 -- .../posix/stdio_h/functions/snprintf_tc.c | 27 - .../posix/stdio_h/functions/sprintf_tc.c | 27 - .../posix/stdio_h/functions/sscanf_tc.c | 30 - .../posix/stdio_h/functions/vfprintf_tc.c | 51 -- .../posix/stdio_h/functions/vprintf_tc.c | 30 - .../posix/stdio_h/functions/vsnprintf_tc.c | 38 -- .../posix/stdio_h/functions/vsprintf_tc.c | 38 -- .../utest/testcases/posix/stdlib_h/Kconfig | 23 - .../utest/testcases/posix/stdlib_h/SConscript | 27 - .../posix/stdlib_h/definitions/stdlib_h.c | 85 --- .../posix/stdlib_h/functions/atoi_tc.c | 67 --- .../posix/stdlib_h/functions/atol_tc.c | 69 --- .../posix/stdlib_h/functions/qsort_tc.c | 136 ----- .../posix/stdlib_h/functions/strtol_tc.c | 125 ---- .../utest/testcases/posix/string_h/Kconfig | 9 - .../utest/testcases/posix/stropts_h/Kconfig | 9 - examples/utest/testcases/posix/sys/Kconfig | 3 - .../utest/testcases/posix/sys/mman_h/Kconfig | 31 - .../testcases/posix/sys/select_h/Kconfig | 11 - .../utest/testcases/posix/sys/shm_h/Kconfig | 9 - .../testcases/posix/sys/socket_h/Kconfig | 11 - .../utest/testcases/posix/sys/stat_h/Kconfig | 23 - .../testcases/posix/sys/statvfs_h/Kconfig | 11 - .../utest/testcases/posix/sys/uio_h/Kconfig | 15 - .../testcases/posix/sys/utsname_h/Kconfig | 9 - examples/utest/testcases/posix/time_h/Kconfig | 55 -- .../utest/testcases/posix/unistd_h/Kconfig | 27 - .../utest/testcases/posix/unistd_h/SConscript | 33 -- .../posix/unistd_h/functions/access_tc.c | 44 -- .../posix/unistd_h/functions/chdir_tc.c | 66 --- .../posix/unistd_h/functions/ftruncate_tc.c | 36 -- .../posix/unistd_h/functions/isatty_tc.c | 22 - .../open_read_write_fsync_close_tc.c | 67 --- .../posix/unistd_h/functions/rmdir_tc.c | 32 - 112 files changed, 5181 deletions(-) delete mode 100644 examples/utest/testcases/posix/Kconfig delete mode 100644 examples/utest/testcases/posix/SConscript delete mode 100644 examples/utest/testcases/posix/aio_h/Kconfig delete mode 100644 examples/utest/testcases/posix/arpa/Kconfig delete mode 100644 examples/utest/testcases/posix/arpa/inet_h/Kconfig delete mode 100644 examples/utest/testcases/posix/ctype_h/Kconfig delete mode 100644 examples/utest/testcases/posix/ctype_h/SConscript delete mode 100644 examples/utest/testcases/posix/ctype_h/definitions/ctype_h.c delete mode 100644 examples/utest/testcases/posix/dirent_h/Kconfig delete mode 100644 examples/utest/testcases/posix/dirent_h/SConscript delete mode 100644 examples/utest/testcases/posix/dirent_h/functions/open_read_close_dir_tc.c delete mode 100644 examples/utest/testcases/posix/errno_h/Kconfig delete mode 100644 examples/utest/testcases/posix/errno_h/SConscript delete mode 100644 examples/utest/testcases/posix/errno_h/definitions/errno_h.c delete mode 100644 examples/utest/testcases/posix/fcntl_h/Kconfig delete mode 100644 examples/utest/testcases/posix/fenv_h/Kconfig delete mode 100644 examples/utest/testcases/posix/inttypes_h/Kconfig delete mode 100644 examples/utest/testcases/posix/libgen_h/Kconfig delete mode 100644 examples/utest/testcases/posix/locale_h/Kconfig delete mode 100644 examples/utest/testcases/posix/mqueue_h/Kconfig delete mode 100644 examples/utest/testcases/posix/net/Kconfig delete mode 100644 examples/utest/testcases/posix/net/if_h/Kconfig delete mode 100644 examples/utest/testcases/posix/netdb_h/Kconfig delete mode 100644 examples/utest/testcases/posix/pthread_h/Kconfig delete mode 100644 examples/utest/testcases/posix/pthread_h/SConscript delete mode 100644 examples/utest/testcases/posix/pthread_h/definitions/pthread_h.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/posixtest.h delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_cond_broadcast/pthread_cond_broadcast_2-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_cond_destroy/pthread_cond_destroy_1-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_cond_init/pthread_cond_init_1-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_cond_timedwait/pthread_cond_timedwait_2-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_create/pthread_create_1-2_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_1-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_2-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_4-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_exit/pthread_exit_1-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/pthread_join/pthread_join_1-1_tc.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/rtt_utest_internal.h delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/testfrmw/testfrmw.c delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/testfrmw/testfrmw.h delete mode 100644 examples/utest/testcases/posix/pthread_h/functions/testfrmw/threads_scenarii.c delete mode 100644 examples/utest/testcases/posix/sched_h/Kconfig delete mode 100644 examples/utest/testcases/posix/semaphore_h/Kconfig delete mode 100644 examples/utest/testcases/posix/setjmp_h/Kconfig delete mode 100644 examples/utest/testcases/posix/signal_h/Kconfig delete mode 100644 examples/utest/testcases/posix/stdarg_h/Kconfig delete mode 100644 examples/utest/testcases/posix/stdio_h/Kconfig delete mode 100644 examples/utest/testcases/posix/stdio_h/SConscript delete mode 100644 examples/utest/testcases/posix/stdio_h/definitions/stdio_h.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/clearerr_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fclose_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fdopen_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/feof_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/ferror_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fflush_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fgetc_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fgets_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fileno_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fopen_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fprintf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fputc_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fputs_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fread_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fscanf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fseek_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/ftell_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/fwrite_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/perror_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/printf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/putc_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/putchar_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/puts_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/remove_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/rename_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/rewind_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/setbuf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/setvbuf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/snprintf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/sprintf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/sscanf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/vfprintf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/vprintf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/vsnprintf_tc.c delete mode 100644 examples/utest/testcases/posix/stdio_h/functions/vsprintf_tc.c delete mode 100644 examples/utest/testcases/posix/stdlib_h/Kconfig delete mode 100644 examples/utest/testcases/posix/stdlib_h/SConscript delete mode 100644 examples/utest/testcases/posix/stdlib_h/definitions/stdlib_h.c delete mode 100644 examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c delete mode 100644 examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c delete mode 100644 examples/utest/testcases/posix/stdlib_h/functions/qsort_tc.c delete mode 100644 examples/utest/testcases/posix/stdlib_h/functions/strtol_tc.c delete mode 100644 examples/utest/testcases/posix/string_h/Kconfig delete mode 100644 examples/utest/testcases/posix/stropts_h/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/mman_h/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/select_h/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/shm_h/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/socket_h/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/stat_h/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/statvfs_h/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/uio_h/Kconfig delete mode 100644 examples/utest/testcases/posix/sys/utsname_h/Kconfig delete mode 100644 examples/utest/testcases/posix/time_h/Kconfig delete mode 100644 examples/utest/testcases/posix/unistd_h/Kconfig delete mode 100644 examples/utest/testcases/posix/unistd_h/SConscript delete mode 100644 examples/utest/testcases/posix/unistd_h/functions/access_tc.c delete mode 100644 examples/utest/testcases/posix/unistd_h/functions/chdir_tc.c delete mode 100644 examples/utest/testcases/posix/unistd_h/functions/ftruncate_tc.c delete mode 100644 examples/utest/testcases/posix/unistd_h/functions/isatty_tc.c delete mode 100644 examples/utest/testcases/posix/unistd_h/functions/open_read_write_fsync_close_tc.c delete mode 100644 examples/utest/testcases/posix/unistd_h/functions/rmdir_tc.c diff --git a/Kconfig.utestcases b/Kconfig.utestcases index f89ac66aa3..8bedaf2d40 100644 --- a/Kconfig.utestcases +++ b/Kconfig.utestcases @@ -10,7 +10,6 @@ if RT_USING_UTESTCASES rsource "components/utilities/utest/utest/Kconfig" rsource "src/utest/Kconfig" rsource "examples/utest/testcases/cpp11/Kconfig" -rsource "examples/utest/testcases/posix/Kconfig" rsource "examples/utest/testcases/mm/Kconfig" rsource "examples/utest/testcases/tmpfs/Kconfig" diff --git a/examples/utest/testcases/posix/Kconfig b/examples/utest/testcases/posix/Kconfig deleted file mode 100644 index 7b1e428a7d..0000000000 --- a/examples/utest/testcases/posix/Kconfig +++ /dev/null @@ -1,37 +0,0 @@ -menu "RTT Posix Testcase" - - config RTT_POSIX_TESTCASE - select RT_USING_UTEST - bool "RTT Posix Testcase" - default n - - if RTT_POSIX_TESTCASE - # rsource "aio_h/Kconfig" # reserve - # rsource "arpa/Kconfig" # reserve - # rsource "ctype_h/Kconfig" # reserve - rsource "dirent_h/Kconfig" - # rsource "errno_h/Kconfig" # reserve - # rsource "fcntl_h/Kconfig" # reserve - # rsource "fenv_h/Kconfig" # reserve - # rsource "inttypes_h/Kconfig" # reserve - # rsource "libgen_h/Kconfig" # reserve - # rsource "locale_h/Kconfig" # reserve - # rsource "mqueue_h/Kconfig" # reserve - # rsource "net/Kconfig" # reserve - # rsource "netdb_h/Kconfig" # reserve - rsource "pthread_h/Kconfig" - # rsource "sched_h/Kconfig" # reserve - # rsource "semaphore_h/Kconfig" # reserve - # rsource "setjmp_h/Kconfig" # reserve - # rsource "signal_h/Kconfig" # reserve - # rsource "stdarg_h/Kconfig" # reserve - rsource "stdio_h/Kconfig" - rsource "stdlib_h/Kconfig" - # rsource "string_h/Kconfig" # reserve - # rsource "stropts_h/Kconfig" # reserve - # rsource "sys/Kconfig" # reserve - # rsource "time_h/Kconfig" # reserve - rsource "unistd_h/Kconfig" - endif - -endmenu diff --git a/examples/utest/testcases/posix/SConscript b/examples/utest/testcases/posix/SConscript deleted file mode 100644 index e8914910af..0000000000 --- a/examples/utest/testcases/posix/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -import os -Import('RTT_ROOT') -from building import * - -cwd = GetCurrentDir() -objs = [] -list = os.listdir(cwd) - -for d in list: - path = os.path.join(cwd, d) - if os.path.isfile(os.path.join(path, 'SConscript')): - objs = objs + SConscript(os.path.join(d, 'SConscript')) - -Return('objs') diff --git a/examples/utest/testcases/posix/aio_h/Kconfig b/examples/utest/testcases/posix/aio_h/Kconfig deleted file mode 100644 index 863a8fc53f..0000000000 --- a/examples/utest/testcases/posix/aio_h/Kconfig +++ /dev/null @@ -1,39 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_AIO_H - bool "" - default n - -if RTT_POSIX_TESTCASE_AIO_H - - config AIO_H_AIO_CANCEL - bool " aio_cancel>" - default n - - config AIO_H_AIO_ERROR - bool " aio_error>" - default n - - config AIO_H_AIO_FSYNC - bool " aio_fsync>" - default n - - config AIO_H_AIO_READ - bool " aio_read>" - default n - - config AIO_H_AIO_RETURN - bool " aio_return>" - default n - - config AIO_H_AIO_SUSPEND - bool " aio_suspend>" - default n - - config AIO_H_AIO_WRITE - bool " aio_write>" - default n - - config AIO_H_AIO_LISTIO - bool " lio_listio>" - default n - -endif diff --git a/examples/utest/testcases/posix/arpa/Kconfig b/examples/utest/testcases/posix/arpa/Kconfig deleted file mode 100644 index 57d25dddee..0000000000 --- a/examples/utest/testcases/posix/arpa/Kconfig +++ /dev/null @@ -1 +0,0 @@ -rsource "inet_h/Kconfig" diff --git a/examples/utest/testcases/posix/arpa/inet_h/Kconfig b/examples/utest/testcases/posix/arpa/inet_h/Kconfig deleted file mode 100644 index 5f197a49ff..0000000000 --- a/examples/utest/testcases/posix/arpa/inet_h/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_ARPA_INET_H - bool "" - default n - -if RTT_POSIX_TESTCASE_ARPA_INET_H - - config ARPA_INET_H_INTERFACE - bool " -> htonl, htons, ntohl, ntohs, inet_addr, inet_ntoa, inet_ntop, inet_pton" - default n - -endif diff --git a/examples/utest/testcases/posix/ctype_h/Kconfig b/examples/utest/testcases/posix/ctype_h/Kconfig deleted file mode 100644 index e8694913e3..0000000000 --- a/examples/utest/testcases/posix/ctype_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_CTYPE_H - bool "" - default n - -if RTT_POSIX_TESTCASE_CTYPE_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/ctype_h/SConscript b/examples/utest/testcases/posix/ctype_h/SConscript deleted file mode 100644 index d4c0830526..0000000000 --- a/examples/utest/testcases/posix/ctype_h/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() -path = [cwd] -src = [] - -if GetDepend('RTT_POSIX_TESTCASE_CTYPE_H'): - src += Glob('./definitions/*.c') - -group = DefineGroup('rtt_posix_testcase', src, depend = ['RTT_POSIX_TESTCASE_CTYPE_H'], CPPPATH = path) - - -Return('group') diff --git a/examples/utest/testcases/posix/ctype_h/definitions/ctype_h.c b/examples/utest/testcases/posix/ctype_h/definitions/ctype_h.c deleted file mode 100644 index 5a3394ae0b..0000000000 --- a/examples/utest/testcases/posix/ctype_h/definitions/ctype_h.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - - /* */ - -#include - -static char xx; - -static int test_defined() -{ - isalnum(xx); - isalpha(xx); - isblank(xx); - iscntrl(xx); - isdigit(xx); - isgraph(xx); - islower(xx); - isprint(xx); - ispunct(xx); - isspace(xx); - isupper(xx); - isxdigit(xx); - tolower(xx); - toupper(xx); -} diff --git a/examples/utest/testcases/posix/dirent_h/Kconfig b/examples/utest/testcases/posix/dirent_h/Kconfig deleted file mode 100644 index 531a4f3894..0000000000 --- a/examples/utest/testcases/posix/dirent_h/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_DIRENT_H - bool "" - default n - -if RTT_POSIX_TESTCASE_DIRENT_H - - config DIRENT_H_OPENDIR_READDIR_CLOSEDIR - bool " -> opendir, readdir, closedir" - default n - -endif diff --git a/examples/utest/testcases/posix/dirent_h/SConscript b/examples/utest/testcases/posix/dirent_h/SConscript deleted file mode 100644 index 5dda6b0131..0000000000 --- a/examples/utest/testcases/posix/dirent_h/SConscript +++ /dev/null @@ -1,19 +0,0 @@ -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') diff --git a/examples/utest/testcases/posix/dirent_h/functions/open_read_close_dir_tc.c b/examples/utest/testcases/posix/dirent_h/functions/open_read_close_dir_tc.c deleted file mode 100644 index 1e35fb4bc9..0000000000 --- a/examples/utest/testcases/posix/dirent_h/functions/open_read_close_dir_tc.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include - -#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 -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); - diff --git a/examples/utest/testcases/posix/errno_h/Kconfig b/examples/utest/testcases/posix/errno_h/Kconfig deleted file mode 100644 index 7cd1dc4bf9..0000000000 --- a/examples/utest/testcases/posix/errno_h/Kconfig +++ /dev/null @@ -1,3 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_ERRNO_H - bool "" - default n diff --git a/examples/utest/testcases/posix/errno_h/SConscript b/examples/utest/testcases/posix/errno_h/SConscript deleted file mode 100644 index 6113c68cba..0000000000 --- a/examples/utest/testcases/posix/errno_h/SConscript +++ /dev/null @@ -1,15 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() -path = [cwd] -src = [] - -if GetDepend('RTT_POSIX_TESTCASE_ERRNO_H'): - src += Glob('./definitions/*.c') - -group = DefineGroup('rtt_posix_testcase', src, depend = ['RTT_POSIX_TESTCASE_ERRNO_H'], CPPPATH = path) - -Return('group') diff --git a/examples/utest/testcases/posix/errno_h/definitions/errno_h.c b/examples/utest/testcases/posix/errno_h/definitions/errno_h.c deleted file mode 100644 index a6799a46f9..0000000000 --- a/examples/utest/testcases/posix/errno_h/definitions/errno_h.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This test tests if error.h is exist and useble - *author:ysun@lnxw.com - */ - -#include - -static int errno_test; - -__attribute__((unused)) static int dummy1 = E2BIG; -__attribute__((unused)) static int dummy2 = EACCES; -__attribute__((unused)) static int dummy3 = EADDRINUSE; -__attribute__((unused)) static int dummy4 = EADDRNOTAVAIL; -__attribute__((unused)) static int dummy5 = EAFNOSUPPORT; -__attribute__((unused)) static int dummy6 = EAGAIN; -__attribute__((unused)) static int dummy7 = EALREADY; -__attribute__((unused)) static int dummy8 = EBADF; -#ifdef EBADMSG -__attribute__((unused)) static int dummy9 = EBADMSG; -#endif -__attribute__((unused)) static int dummy10 = EBUSY; -__attribute__((unused)) static int dummy11 = ECANCELED; -__attribute__((unused)) static int dummy12 = ECHILD; -__attribute__((unused)) static int dummy13 = ECONNABORTED; -__attribute__((unused)) static int dummy14 = ECONNREFUSED; -__attribute__((unused)) static int dummy15 = ECONNRESET; -__attribute__((unused)) static int dummy16 = EDEADLK; -__attribute__((unused)) static int dummy17 = EDESTADDRREQ; -__attribute__((unused)) static int dummy18 = EDOM; -__attribute__((unused)) static int dummy19 = EDQUOT; -__attribute__((unused)) static int dummy20 = EEXIST; -__attribute__((unused)) static int dummy21 = EFAULT; -__attribute__((unused)) static int dummy22 = EFBIG; -__attribute__((unused)) static int dummy23 = EHOSTUNREACH; -__attribute__((unused)) static int dummy24 = EIDRM; -__attribute__((unused)) static int dummy25 = EILSEQ; -__attribute__((unused)) static int dummy26 = EINPROGRESS; -__attribute__((unused)) static int dummy27 = EINTR; -__attribute__((unused)) static int dummy28 = EINVAL; -__attribute__((unused)) static int dummy29 = EIO; -__attribute__((unused)) static int dummy30 = EISCONN; -__attribute__((unused)) static int dummy31 = EISDIR; -__attribute__((unused)) static int dummy32 = ELOOP; -__attribute__((unused)) static int dummy33 = EMFILE; -__attribute__((unused)) static int dummy34 = EMLINK; -__attribute__((unused)) static int dummy35 = EMSGSIZE; -__attribute__((unused)) static int dummy36 = EMULTIHOP; -__attribute__((unused)) static int dummy37 = ENAMETOOLONG; -__attribute__((unused)) static int dummy38 = ENETDOWN; -__attribute__((unused)) static int dummy39 = ENETRESET; -__attribute__((unused)) static int dummy40 = ENETUNREACH; -__attribute__((unused)) static int dummy41 = ENFILE; -__attribute__((unused)) static int dummy42 = ENOBUFS; -#ifdef ENODATA -__attribute__((unused)) static int dummy43 = ENODATA; -#endif -__attribute__((unused)) static int dummy44 = ENODEV; -__attribute__((unused)) static int dummy45 = ENOENT; -__attribute__((unused)) static int dummy46 = ENOEXEC; -__attribute__((unused)) static int dummy47 = ENOLCK; -__attribute__((unused)) static int dummy48 = ENOLINK; -__attribute__((unused)) static int dummy49 = ENOMEM; -__attribute__((unused)) static int dummy50 = ENOMSG; -__attribute__((unused)) static int dummy51 = ENOPROTOOPT; -__attribute__((unused)) static int dummy52 = ENOSPC; -#ifdef ENOSR -__attribute__((unused)) static int dummy53 = ENOSR; -#endif -#ifdef ENOSTR -__attribute__((unused)) static int dummy54 = ENOSTR; -#endif -__attribute__((unused)) static int dummy55 = ENOSYS; -__attribute__((unused)) static int dummy56 = ENOTCONN; -__attribute__((unused)) static int dummy57 = ENOTDIR; -__attribute__((unused)) static int dummy58 = ENOTEMPTY; -__attribute__((unused)) static int dummy59 = ENOTSOCK; -__attribute__((unused)) static int dummy60 = ENOTSUP; -__attribute__((unused)) static int dummy61 = ENOTTY; -__attribute__((unused)) static int dummy62 = ENXIO; -__attribute__((unused)) static int dummy63 = EOPNOTSUPP; -__attribute__((unused)) static int dummy64 = EOVERFLOW; -__attribute__((unused)) static int dummy65 = EPERM; -__attribute__((unused)) static int dummy66 = EPIPE; -__attribute__((unused)) static int dummy67 = EPROTO; -__attribute__((unused)) static int dummy68 = EPROTONOSUPPORT; -__attribute__((unused)) static int dummy69 = EPROTOTYPE; -__attribute__((unused)) static int dummy70 = ERANGE; -__attribute__((unused)) static int dummy71 = EROFS; -__attribute__((unused)) static int dummy72 = ESPIPE; -__attribute__((unused)) static int dummy73 = ESRCH; -__attribute__((unused)) static int dummy74 = ESTALE; -#ifdef ETIME -__attribute__((unused)) static int dummy75 = ETIME; -#endif -__attribute__((unused)) static int dummy76 = ETIMEDOUT; -__attribute__((unused)) static int dummy77 = ETXTBSY; -__attribute__((unused)) static int dummy78 = EWOULDBLOCK; -__attribute__((unused)) static int dummy79 = EXDEV; - -__attribute__((unused))static int dummyfcn(void) -{ - errno_test = errno; - return 0; -} diff --git a/examples/utest/testcases/posix/fcntl_h/Kconfig b/examples/utest/testcases/posix/fcntl_h/Kconfig deleted file mode 100644 index 7e2e39159b..0000000000 --- a/examples/utest/testcases/posix/fcntl_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_FCNTL_H - bool "" - default n - -if RTT_POSIX_TESTCASE_FCNTL_H - -# function, TODO - -endif diff --git a/examples/utest/testcases/posix/fenv_h/Kconfig b/examples/utest/testcases/posix/fenv_h/Kconfig deleted file mode 100644 index 72e52356c5..0000000000 --- a/examples/utest/testcases/posix/fenv_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_FENV_H - bool "" - default n - -if RTT_POSIX_TESTCASE_FENV_H - -# function, TODO - -endif diff --git a/examples/utest/testcases/posix/inttypes_h/Kconfig b/examples/utest/testcases/posix/inttypes_h/Kconfig deleted file mode 100644 index 1c053c81e3..0000000000 --- a/examples/utest/testcases/posix/inttypes_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_INTTYPES_H - bool "" - default n - -if RTT_POSIX_TESTCASE_INTTYPES_H - -# function, TODO - -endif diff --git a/examples/utest/testcases/posix/libgen_h/Kconfig b/examples/utest/testcases/posix/libgen_h/Kconfig deleted file mode 100644 index 865227d315..0000000000 --- a/examples/utest/testcases/posix/libgen_h/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_LIBGEN_H - bool "" - default n - -if RTT_POSIX_TESTCASE_LIBGEN_H - - config LIBGEN_H_BASENAME - bool " -> basename" - default n - - config LIBGEN_H_DIRNAME - bool " -> dirname" - default n - -endif diff --git a/examples/utest/testcases/posix/locale_h/Kconfig b/examples/utest/testcases/posix/locale_h/Kconfig deleted file mode 100644 index 44b7b8ae17..0000000000 --- a/examples/utest/testcases/posix/locale_h/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_LOCALE_H - bool "" - default n - -if RTT_POSIX_TESTCASE_LOCALE_H - - config LOCALE_H_SETLOCALE - bool " setlocale>" - default n - - config LIBGEN_H_LOCALECONV - bool " localconv>" - default n - -endif diff --git a/examples/utest/testcases/posix/mqueue_h/Kconfig b/examples/utest/testcases/posix/mqueue_h/Kconfig deleted file mode 100644 index a3315464af..0000000000 --- a/examples/utest/testcases/posix/mqueue_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_MQUEUE_H - bool "" - default n - -if RTT_POSIX_TESTCASE_MQUEUE_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/net/Kconfig b/examples/utest/testcases/posix/net/Kconfig deleted file mode 100644 index 863c9d7aeb..0000000000 --- a/examples/utest/testcases/posix/net/Kconfig +++ /dev/null @@ -1 +0,0 @@ -rsource "if_h/Kconfig" diff --git a/examples/utest/testcases/posix/net/if_h/Kconfig b/examples/utest/testcases/posix/net/if_h/Kconfig deleted file mode 100644 index e7253e6d90..0000000000 --- a/examples/utest/testcases/posix/net/if_h/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_NET_IF_H - bool "" - default n - -if RTT_POSIX_TESTCASE_NET_IF_H - - config NET_IF_H_NAMEINDEX - bool " -> if_freenameindex, if_indextoname, if_nameindex, if_nametoindex" - default n - -endif diff --git a/examples/utest/testcases/posix/netdb_h/Kconfig b/examples/utest/testcases/posix/netdb_h/Kconfig deleted file mode 100644 index d7fd15c207..0000000000 --- a/examples/utest/testcases/posix/netdb_h/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_NETDB_H - bool "" - default n - -if RTT_POSIX_TESTCASE_NETDB_H - - config NETDB_H_ADDRINFO - bool " -> getaddrinfo, gai_strerror, getnameinfo, freeaddrinfo" - default n - -endif diff --git a/examples/utest/testcases/posix/pthread_h/Kconfig b/examples/utest/testcases/posix/pthread_h/Kconfig deleted file mode 100644 index ed6f328088..0000000000 --- a/examples/utest/testcases/posix/pthread_h/Kconfig +++ /dev/null @@ -1,43 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_PTHREAD_H - bool "" - default n - -if RTT_POSIX_TESTCASE_PTHREAD_H - - config PTHREAD_H_PTHREAD_CREATE - bool " -> pthread_create" - default n - - config PTHREAD_H_PTHREAD_JOIN - bool " -> pthread_join" - default n - - config PTHREAD_H_PTHREAD_EXIT - bool " -> pthread_exit" - default n - - config PTHREAD_H_PTHREAD_COND_INIT - bool " -> pthread_cond_init" - default n - - config PTHREAD_H_PTHREAD_COND_DESTROY - bool " -> pthread_cond_destroy" - default n - - config PTHREAD_H_PTHREAD_COND_BROADCAST - bool " -> pthread_cond_broadcast" - default n - - config PTHREAD_H_PTHREAD_COND_SIGNAL - bool " -> pthread_cond_signal" - default n - - config PTHREAD_H_PTHREAD_COND_TIMEWAIT - bool " -> pthread_cond_timedwait" - default n - - config PTHREAD_H_PTHREAD_DETACH - bool " -> pthread_detach" - default n - -endif diff --git a/examples/utest/testcases/posix/pthread_h/SConscript b/examples/utest/testcases/posix/pthread_h/SConscript deleted file mode 100644 index b09f4f44ae..0000000000 --- a/examples/utest/testcases/posix/pthread_h/SConscript +++ /dev/null @@ -1,47 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() -path = [cwd + '/functions'] -src = [] - -src += Glob('./definitions/testfrmw/*.c') -path += [cwd + '/functions/testfrmw'] - -if GetDepend('RTT_POSIX_TESTCASE_PTHREAD_H'): - src += Glob('./definitions/*.c') - -if GetDepend(['PTHREAD_H_PTHREAD_CREATE']): - src += Glob('./functions/pthread_create/pthread_create_1-2_tc.c') - -if GetDepend(['PTHREAD_H_PTHREAD_JOIN']): - src += Glob('./functions/pthread_join/pthread_join_1-1_tc.c') - -if GetDepend(['PTHREAD_H_PTHREAD_EXIT']): - src += Glob('./functions/pthread_exit/pthread_exit_1-1_tc.c') - -if GetDepend(['PTHREAD_H_PTHREAD_COND_INIT']): - src += Glob('./functions/pthread_cond_init/pthread_cond_init_1-1_tc.c') - -if GetDepend(['PTHREAD_H_PTHREAD_COND_DESTROY']): - src += Glob('./functions/pthread_cond_destroy/pthread_cond_destroy_1-1_tc.c') - -if GetDepend(['PTHREAD_H_PTHREAD_COND_BROADCAST']): - src += Glob('./functions/pthread_cond_broadcast/pthread_cond_broadcast_1-1_tc.c') - src += Glob('./functions/pthread_cond_broadcast/pthread_cond_broadcast_2-1_tc.c') - -if GetDepend(['PTHREAD_H_PTHREAD_COND_SIGNAL']): - src += Glob('./functions/pthread_cond_signal/pthread_cond_signal_2-2_tc.c') - -if GetDepend(['PTHREAD_H_PTHREAD_COND_TIMEWAIT']): - src += Glob('./functions/pthread_cond_timedwait/pthread_cond_timedwait_1-1_tc.c') - src += Glob('./functions/pthread_cond_timedwait/pthread_cond_timedwait_2-1_tc.c') - -if GetDepend(['PTHREAD_H_PTHREAD_DETACH']): - src += Glob('./functions/pthread_detach/pthread_detach_4-1_tc.c') - -group = DefineGroup('rtt_posix_testcase', src, depend = ['RTT_POSIX_TESTCASE_PTHREAD_H'], CPPPATH = path) - -Return('group') diff --git a/examples/utest/testcases/posix/pthread_h/definitions/pthread_h.c b/examples/utest/testcases/posix/pthread_h/definitions/pthread_h.c deleted file mode 100644 index baf3670b3a..0000000000 --- a/examples/utest/testcases/posix/pthread_h/definitions/pthread_h.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_mutexattr_destroy(pthread_mutexattr_t *); - */ - -#include - -int (*test_pthread_atfork)(void (*prepare)(void), void (*parent)(void), void (*child)(void)); -int (*test_pthread_attr_destroy)(pthread_attr_t *__attr); -int (*test_pthread_attr_getdetachstate)(const pthread_attr_t *__attr, int *__detachstate); -int (*test_pthread_attr_getguardsize)(const pthread_attr_t *__attr, size_t *__guardsize); -int (*test_pthread_attr_getinheritsched)(const pthread_attr_t *__attr, int *__inheritsched); -int (*test_pthread_attr_getschedparam)(const pthread_attr_t *__attr, struct sched_param *__param); -int (*test_pthread_attr_getschedpolicy)(const pthread_attr_t *__attr, int *__policy); -int (*test_pthread_attr_getscope)(const pthread_attr_t *__attr, int *__contentionscope); -int (*test_pthread_attr_getstack)(const pthread_attr_t *attr, void **__stackaddr, size_t *__stacksize); -int (*test_pthread_attr_getstackaddr)(const pthread_attr_t *__attr, void **__stackaddr); -int (*test_pthread_attr_getstacksize)(const pthread_attr_t *__attr, size_t *__stacksize); -int (*test_pthread_attr_init)(pthread_attr_t *__attr); -int (*test_pthread_attr_setdetachstate)(pthread_attr_t *__attr, int __detachstate); -int (*test_pthread_attr_setguardsize)(pthread_attr_t *__attr, size_t __guardsize); -int (*test_pthread_attr_setinheritsched)(pthread_attr_t *__attr, int __inheritsched); -int (*test_pthread_attr_setschedparam)(pthread_attr_t *__attr, const struct sched_param *__param); -int (*test_pthread_attr_setschedpolicy)(pthread_attr_t *__attr, int __policy); -int (*test_pthread_attr_setscope)(pthread_attr_t *__attr, int __contentionscope); -int (*test_pthread_attr_setstack)(pthread_attr_t *attr, void *__stackaddr, size_t __stacksize); -int (*test_pthread_attr_setstackaddr)(pthread_attr_t *__attr, void *__stackaddr); -int (*test_pthread_attr_setstacksize)(pthread_attr_t *__attr, size_t __stacksize); -int (*test_pthread_cancel)(pthread_t __pthread); -void (*test_pthread_cleanup_pop)(int execute); -void (*test_pthread_cleanup_push)(void (*routine)(void*), void *arg); -int (*test_pthread_cond_broadcast)(pthread_cond_t *__cond); -int (*test_pthread_cond_destroy)(pthread_cond_t *__mutex); -int (*test_pthread_cond_init)(pthread_cond_t *__cond, const pthread_condattr_t *__attr); -int (*test_pthread_cond_signal)(pthread_cond_t *__cond); -int (*test_pthread_cond_timedwait)(pthread_cond_t *__cond, pthread_mutex_t *__mutex, const struct timespec *__abstime); -int (*test_pthread_cond_wait)(pthread_cond_t *__cond, pthread_mutex_t *__mutex); -int (*test_pthread_condattr_destroy)(pthread_condattr_t *__attr); -int (*test_pthread_condattr_getclock)(const pthread_condattr_t *__restrict __attr, clockid_t *__restrict __clock_id); -int (*test_pthread_condattr_init)(pthread_condattr_t *__attr); -int (*test_pthread_condattr_setclock)(pthread_condattr_t *__attr, clockid_t __clock_id); -int (*test_pthread_create)(pthread_t *__pthread, const pthread_attr_t *__attr, void *(*__start_routine)(void *), void *__arg); -int (*test_pthread_detach)(pthread_t __pthread); -int (*test_pthread_equal)(pthread_t __t1, pthread_t __t2); -void (*test_pthread_exit)(void *__value_ptr); -int (*test_pthread_getcpuclockid)(pthread_t thread, clockid_t *clock_id); -int (*test_pthread_getconcurrency)(void); -int (*test_pthread_getschedparam)(pthread_t __pthread, int *__policy, struct sched_param *__param); -void * (*test_pthread_getspecific)(pthread_key_t __key); -int (*test_pthread_join)(pthread_t __pthread, void **__value_ptr); -int (*test_pthread_key_create)(pthread_key_t *__key, void (*__destructor)(void *)); -int (*test_pthread_key_delete)(pthread_key_t __key); -int (*test_pthread_mutex_destroy)(pthread_mutex_t *__mutex); -int (*test_pthread_mutex_getprioceiling)(const pthread_mutex_t *__restrict __mutex, int *__prioceiling); -int (*test_pthread_mutex_init)(pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr); -int (*test_pthread_mutex_lock)(pthread_mutex_t *__mutex); -int (*test_pthread_mutex_setprioceiling)(pthread_mutex_t *__mutex, int __prioceiling, int *__old_ceiling); -int (*test_pthread_mutex_trylock)(pthread_mutex_t *__mutex); -int (*test_pthread_mutex_unlock)(pthread_mutex_t *__mutex); -int (*test_pthread_mutexattr_destroy)(pthread_mutexattr_t *__attr); -int (*test_pthread_mutexattr_getprioceiling)(const pthread_mutexattr_t *__attr, int *__prioceiling); -int (*test_pthread_mutexattr_getprotocol)(const pthread_mutexattr_t *__attr, int *__protocol); -int (*test_pthread_mutexattr_gettype)(const pthread_mutexattr_t *__attr, int *__kind); -int (*test_pthread_mutexattr_init)(pthread_mutexattr_t *__attr); -int (*test_pthread_mutexattr_setprioceiling)(const pthread_mutexattr_t *__attr, int __prioceiling); -int (*test_pthread_mutexattr_setprotocol)(const pthread_mutexattr_t *__attr, int __protocol); -int (*test_pthread_mutexattr_settype)(pthread_mutexattr_t *__attr, int __kind); -int (*test_pthread_once)(pthread_once_t *__once_control, void (*__init_routine)(void)); -pthread_t (*test_pthread_self)(void); -int (*test_pthread_setcancelstate)(int __state, int *__oldstate); -int (*test_pthread_setcanceltype)(int __type, int *__oldtype); -int (*test_pthread_setconcurrency)(int new_level); -int (*test_pthread_setschedparam)(pthread_t __pthread, int __policy, const struct sched_param *__param); -int (*test_pthread_setschedprio)(pthread_t thread, int prio); -int (*test_pthread_setspecific)(pthread_key_t __key, const void *__value); -void (*test_pthread_testcancel)(void); - - -__attribute__((unused)) static void dummy_func() -{ - test_pthread_atfork = pthread_atfork; - test_pthread_attr_destroy = pthread_attr_destroy; - test_pthread_attr_getdetachstate = pthread_attr_getdetachstate; - test_pthread_attr_getguardsize = pthread_attr_getguardsize; - test_pthread_attr_getinheritsched = pthread_attr_getinheritsched; - test_pthread_attr_getschedparam = pthread_attr_getschedparam; - test_pthread_attr_getschedpolicy = pthread_attr_getschedpolicy; - test_pthread_attr_getscope = pthread_attr_getscope; - test_pthread_attr_getstack = pthread_attr_getstack; - test_pthread_attr_getstackaddr = pthread_attr_getstackaddr; - test_pthread_attr_getstacksize = pthread_attr_getstacksize; - test_pthread_attr_init = pthread_attr_init; - test_pthread_attr_setdetachstate = pthread_attr_setdetachstate; - test_pthread_attr_setguardsize = pthread_attr_setguardsize; - test_pthread_attr_setinheritsched = pthread_attr_setinheritsched; - test_pthread_attr_setschedparam = pthread_attr_setschedparam; - test_pthread_attr_setschedpolicy = pthread_attr_setschedpolicy; - test_pthread_attr_setscope = pthread_attr_setscope; - test_pthread_attr_setstack = pthread_attr_setstack; - test_pthread_attr_setstackaddr = pthread_attr_setstackaddr; - test_pthread_attr_setstacksize = pthread_attr_setstacksize; - test_pthread_cancel = pthread_cancel; - test_pthread_cleanup_pop = pthread_cleanup_pop; - test_pthread_cleanup_push = pthread_cleanup_push; - test_pthread_cond_broadcast = pthread_cond_broadcast; - test_pthread_cond_destroy = pthread_cond_destroy; - test_pthread_cond_init = pthread_cond_init; - test_pthread_cond_signal = pthread_cond_signal; - test_pthread_cond_timedwait = pthread_cond_timedwait; - test_pthread_cond_wait = pthread_cond_wait; - test_pthread_condattr_destroy = pthread_condattr_destroy; - test_pthread_condattr_getclock = pthread_condattr_getclock; - test_pthread_condattr_init = pthread_condattr_init; - test_pthread_condattr_setclock = pthread_condattr_setclock; - test_pthread_create = pthread_create; - test_pthread_detach = pthread_detach; - test_pthread_equal = pthread_equal; - test_pthread_exit = pthread_exit; - test_pthread_getcpuclockid = pthread_getcpuclockid; - test_pthread_getconcurrency = pthread_getconcurrency; - test_pthread_getschedparam = pthread_getschedparam; - test_pthread_getspecific = pthread_getspecific; - test_pthread_join = pthread_join; - test_pthread_key_create = pthread_key_create; - test_pthread_key_delete = pthread_key_delete; - test_pthread_mutex_destroy = pthread_mutex_destroy; - test_pthread_mutex_getprioceiling = pthread_mutex_getprioceiling; - test_pthread_mutex_init = pthread_mutex_init; - test_pthread_mutex_lock = pthread_mutex_lock; - test_pthread_mutex_setprioceiling = pthread_mutex_setprioceiling; - test_pthread_mutex_trylock = pthread_mutex_trylock; - test_pthread_mutex_unlock = pthread_mutex_unlock; - test_pthread_mutexattr_destroy = pthread_mutexattr_destroy; - test_pthread_mutexattr_getprioceiling = pthread_mutexattr_getprioceiling; - test_pthread_mutexattr_getprotocol = pthread_mutexattr_getprotocol; - test_pthread_mutexattr_gettype = pthread_mutexattr_gettype; - test_pthread_mutexattr_init = pthread_mutexattr_init; - test_pthread_mutexattr_setprioceiling = pthread_mutexattr_setprioceiling; - test_pthread_mutexattr_setprotocol = pthread_mutexattr_setprotocol; - test_pthread_mutexattr_settype = pthread_mutexattr_settype; - test_pthread_once = pthread_once; - test_pthread_self = pthread_self; - test_pthread_setcancelstate = pthread_setcancelstate; - test_pthread_setcanceltype = pthread_setcanceltype; - test_pthread_setconcurrency = pthread_setconcurrency; - test_pthread_setschedparam = pthread_setschedparam; - test_pthread_setschedprio = pthread_setschedprio; - test_pthread_setspecific = pthread_setspecific; - test_pthread_testcancel = pthread_testcancel; - - return; -} diff --git a/examples/utest/testcases/posix/pthread_h/functions/posixtest.h b/examples/utest/testcases/posix/pthread_h/functions/posixtest.h deleted file mode 100644 index 1caf304a8b..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/posixtest.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * return codes - */ - -#define PTS_PASS 0 -#define PTS_FAIL 1 -#define PTS_UNRESOLVED 2 -#define PTS_UNSUPPORTED 4 -#define PTS_UNTESTED 5 - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) -#endif - -#define PTS_ATTRIBUTE_NORETURN __attribute__((noreturn)) -#define PTS_ATTRIBUTE_UNUSED __attribute__((unused)) -#define PTS_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result)) diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_broadcast/pthread_cond_broadcast_2-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_broadcast/pthread_cond_broadcast_2-1_tc.c deleted file mode 100644 index dc8342898a..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_broadcast/pthread_cond_broadcast_2-1_tc.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_broadcast() - * When each thread unblocked as a result of pthread_cond_signal() - * returns from its call to pthread_cond_wait(), the thread shall - * own the mutex with which it called pthread_cond_wait(). - */ - - -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 3 - -static struct testdata { - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -static int start_num; -static int waken_num; - -static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED) -{ - int rc; - pthread_t self = pthread_self(); - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr, "[Thread 0x%p] failed to acquire the mutex\n", - (void *)self); - exit(PTS_UNRESOLVED); - } - fprintf(stderr, "[Thread 0x%p] started and locked the mutex\n", - (void *)self); - start_num++; - - fprintf(stderr, "[Thread 0x%p] is waiting for the cond\n", - (void *)self); - rc = pthread_cond_wait(&td.cond, &td.mutex); - if (rc != 0) { - fprintf(stderr, "pthread_cond_wait return %d\n", rc); - exit(PTS_UNRESOLVED); - } - - if (pthread_mutex_trylock(&td.mutex) == 0) { - fprintf(stderr, "[Thread 0x%p] should not be able to lock the " - "mutex again\n", (void *)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr, "[Thread 0x%p] was wakened and acquired the " - "mutex again\n", (void *)self); - waken_num++; - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr, "[Thread 0x%p] failed to release the " - "mutex\n", (void *)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr, "[Thread 0x%p] released the mutex\n", (void *)self); - return NULL; -} - -static int posix_testcase(void) -{ - struct timespec completion_wait_ts = {0, 100000}; - int i, rc; - pthread_t thread[THREAD_NUM]; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr, "Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr, "Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - for (i = 0; i < THREAD_NUM; i++) { - if (pthread_create(&thread[i], NULL, thr_func, NULL) != 0) { - fprintf(stderr, "Fail to create thread[%d]\n", i); - return PTS_UNRESOLVED; - } - } - while (start_num < THREAD_NUM) - nanosleep(&completion_wait_ts, NULL); - - /* Acquire the mutex to make sure that all waiters are currently - blocked on pthread_cond_wait */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr, "Main: Fail to acquire mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr, "Main: Fail to release mutex\n"); - return PTS_UNRESOLVED; - } - - /* broadcast the condition to wake up all waiters */ - fprintf(stderr, "[Main thread] broadcast the condition\n"); - rc = pthread_cond_broadcast(&td.cond); - if (rc != 0) { - fprintf(stderr, "[Main thread] failed to broadcast the " - "condition\n"); - return PTS_UNRESOLVED; - } - sleep(1); - if (waken_num < THREAD_NUM) { - fprintf(stderr, "[Main thread] Not all waiters were wakened\n"); - for (i = 0; i < THREAD_NUM; i++) - pthread_cancel(thread[i]); - - return PTS_UNRESOLVED; - } - fprintf(stderr, "[Main thread] all waiters were wakened\n"); - - /* join all secondary threads */ - for (i = 0; i < THREAD_NUM; i++) { - if (pthread_join(thread[i], NULL) != 0) { - fprintf(stderr, "Fail to join thread[%d]\n", i); - return PTS_UNRESOLVED; - } - } - printf("Test PASSED\n"); - return PTS_PASS; -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_cond_broadcast.2-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_destroy/pthread_cond_destroy_1-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_destroy/pthread_cond_destroy_1-1_tc.c deleted file mode 100644 index c2a009973d..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_destroy/pthread_cond_destroy_1-1_tc.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_destroy() - * shall destroy the condition variable referenced by 'cond'; - * the condition variable object in effect becomes uninitialized. - * - */ - -#include -#include -#include "posixtest.h" - -static pthread_cond_t cond1, cond2; -static pthread_cond_t cond3 = PTHREAD_COND_INITIALIZER; - -static int posix_testcase(void) -{ - pthread_condattr_t condattr; - int rc; - - /* Initialize a condition variable attribute object */ - if ((rc = pthread_condattr_init(&condattr)) != 0) { - fprintf(stderr, "Error at pthread_condattr_init(), rc=%d\n", - rc); - return PTS_UNRESOLVED; - } - printf("Line-%04d\n", __LINE__); - - /* Initialize cond1 with the default condition variable attribute */ - if ((rc = pthread_cond_init(&cond1, &condattr)) != 0) { - fprintf(stderr, "Fail to initialize cond1, rc=%d\n", rc); - return PTS_UNRESOLVED; - } - - printf("Line-%04d\n", __LINE__); - /* Initialize cond2 with NULL attributes */ - if ((rc = pthread_cond_init(&cond2, NULL)) != 0) { - fprintf(stderr, "Fail to initialize cond2, rc=%d\n", rc); - return PTS_UNRESOLVED; - } - - printf("Line-%04d\n", __LINE__); - /* Destroy the condition variable attribute object */ - if ((rc = pthread_condattr_destroy(&condattr)) != 0) { - fprintf(stderr, "Error at pthread_condattr_destroy(), rc=%d\n", - rc); - return PTS_UNRESOLVED; - } - - printf("Line-%04d\n", __LINE__); - /* Destroy cond1 */ - if ((rc = pthread_cond_destroy(&cond1)) != 0) { - fprintf(stderr, "Fail to destroy cond1, rc=%d\n", rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Line-%04d\n", __LINE__); - /* Destroy cond2 */ - if ((rc = pthread_cond_destroy(&cond2)) != 0) { - fprintf(stderr, "Fail to destroy cond2, rc=%d\n", rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Line-%04d", __LINE__); - /* Destroy cond3 */ - if ((rc = pthread_cond_destroy(&cond3)) != 0) { - fprintf(stderr, "Fail to destroy cond3, rc=%d\n", rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Line-%04d", __LINE__); - printf("Test PASSED\n"); - return PTS_PASS; -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_cond_destroy.1-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_init/pthread_cond_init_1-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_init/pthread_cond_init_1-1_tc.c deleted file mode 100644 index 912e7f686f..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_init/pthread_cond_init_1-1_tc.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_init() - * shall initialize the condition variable referenced by cond with attributes - * referenced by attr. If attr is NULL, the default condition variable - * attributes shall be used; the effect is the same as passing the address - * of a default condition variable attributes object. - - * NOTE: There is no direct way to judge if two condition variables are equal, - * so this test does not cover the statement in the last sentence. - * - * - * Modified - LK coding style 30/05/2011 - * Peter W. Morreale - */ - -#include -#include -#include -#include "posixtest.h" - -#define ERR_MSG(f, rc) printf("Failed: func: %s rc: %s (%u)\n", \ - f, strerror(rc), rc); - -static int posix_testcase(void) -{ - pthread_condattr_t condattr; - pthread_cond_t cond1; - pthread_cond_t cond2; - int rc; - char *f; - int status = PTS_UNRESOLVED; - - f = "pthread_condattr_init()"; - rc = pthread_condattr_init(&condattr); - if (rc) - goto done; - - status = PTS_FAIL; - f = "pthread_cond_init() - condattr"; - rc = pthread_cond_init(&cond1, &condattr); - if (rc) - goto done; - - f = "pthread_cond_init() - NULL"; - rc = pthread_cond_init(&cond2, NULL); - if (rc) - goto done; - - printf("Test PASSED\n"); - return PTS_PASS; - -done: - ERR_MSG(f, rc); - return status; - -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_cond_init.1-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_timedwait/pthread_cond_timedwait_2-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_timedwait/pthread_cond_timedwait_2-1_tc.c deleted file mode 100644 index 5a69a7d0bf..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_cond_timedwait/pthread_cond_timedwait_2-1_tc.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_timedwait() - * shall be equivalent to pthread_cond_wait(), except that an error is returned - * if the absolute time specified by abstime passes before the condition cond is - * signaled or broadcasted, or if the absolute time specified by abstime has - * already been passed at the time of the call. - * - * Case 2-1 - * Upon successful return, the mutex shall have been locked and shall - * be owned by the calling thread. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define INTERVAL 1 -#define TIMEOUT 5 - -static struct testdata { - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -static int t1_start = 0; -static int signaled = 0; - -static void *t1_func(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - - (void) arg; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr, "Thread1 failed to acquire the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr, "Thread1 started\n"); - t1_start = 1; /* let main thread continue */ - - if (gettimeofday(&curtime, NULL) != 0) { - fprintf(stderr, "Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec + TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - fprintf(stderr, "Thread1 is waiting for the cond\n"); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if (rc != 0) { - if (rc == ETIMEDOUT) { - fprintf(stderr, - "Thread1 stops waiting when time is out\n"); - exit(PTS_UNRESOLVED); - } else { - fprintf(stderr, "pthread_cond_timedwait return %d\n", - rc); - exit(PTS_UNRESOLVED); - } - } - - fprintf(stderr, "Thread1 wakened\n"); - if (signaled == 0) { - fprintf(stderr, "Thread1 did not block on the cond at all\n"); - exit(PTS_UNRESOLVED); - } - - if (pthread_mutex_trylock(&td.mutex) == 0) { - fprintf(stderr, - "Thread1 should not be able to lock the mutex again\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr, "Thread1 failed to trylock the mutex (as expected)\n"); - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr, "Thread1 failed to release the mutex\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr, "Thread1 released the mutex\n"); - return NULL; -} - -static int posix_testcase(void) -{ - pthread_t thread1; - struct timespec thread_start_ts = {0, 100000}; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr, "Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr, "Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr, "Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - while (!t1_start) /* wait for thread1 started */ - nanosleep(&thread_start_ts, NULL); - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr, "Main failed to acquire mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr, "Main failed to release mutex\n"); - return PTS_UNRESOLVED; - } - sleep(INTERVAL); - - fprintf(stderr, "Time to wake up thread1 by signaling a condition\n"); - signaled = 1; - if (pthread_cond_signal(&td.cond) != 0) { - fprintf(stderr, "Main failed to signal the condition\n"); - return PTS_UNRESOLVED; - } - - pthread_join(thread1, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_cond_timedwait.2-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_create/pthread_create_1-2_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_create/pthread_create_1-2_tc.c deleted file mode 100644 index 654c1433a6..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_create/pthread_create_1-2_tc.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_create() creates a new thread with attributes specified - * by 'attr', within a process. - * - * Steps: - * 1. Create a thread using pthread_create() - * 2. Cancel that thread with pthread_cancel() - * 3. If that thread doesn't exist, then it pthread_cancel() will return - * an error code. This would mean that pthread_create() did not create - * a thread successfully. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -static void *a_thread_func() -{ - sleep(10); - - /* Shouldn't reach here. If we do, then the pthread_cancel() - * function did not succeed. */ - fprintf(stderr, "Could not send cancel request correctly\n"); - - return NULL; -} - -static int posix_testcase(void) -{ - pthread_t new_th; - int ret; - - ret = pthread_create(&new_th, NULL, a_thread_func, NULL); - if (ret) { - fprintf(stderr, "pthread_create(): %s\n", strerror(ret)); - return PTS_UNRESOLVED; - } - - /* Try to cancel the newly created thread. If an error is returned, - * then the thread wasn't created successfully. */ - ret = pthread_cancel(new_th); - if (ret) { - printf("Test FAILED: A new thread wasn't created: %s\n", - strerror(ret)); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_create.1-2.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_1-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_1-1_tc.c deleted file mode 100644 index 418fb00ef9..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_1-1_tc.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_detach() - * - * shall detach a thread. It shall indicate to the implementation that storage - * for 'thread' can be reclaimed when that thread terminates. - * - * STEPS: - * 1. Create a joinable thread - * 2. Detach that thread with pthread_detach() - * 3. Try and join the thread to main() using pthread_join() - * 4. An error should return from the pthread_join() function saying that the - * thread is detched. The test passes. - * 5. Else, if pthread_join is successful, the test fails. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -static void *a_thread_func() -{ - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - /* If the thread wasn't canceled in 10 seconds, time out */ - sleep(10); - - perror("Thread couldn't be canceled (at cleanup time), timing out\n"); - pthread_exit(0); - return NULL; -} - -static int posix_testcase(void) -{ - pthread_attr_t new_attr; - pthread_t new_th; - int ret; - - /* Initialize attribute */ - if (pthread_attr_init(&new_attr) != 0) { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to be joinable */ - if (pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != - 0) { - perror("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* Create the thread */ - if (pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Detach the thread. */ - if (pthread_detach(new_th) != 0) { - printf("Error detaching thread\n"); - return PTS_FAIL; - } - - /* Now try and join it. This should fail. */ - ret = pthread_join(new_th, NULL); - - /* Cleanup: Cancel the thread */ - pthread_cancel(new_th); - - if (ret == 0) { - printf("Test FAILED\n"); - return PTS_FAIL; - } else if (ret == EINVAL) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("Error in pthread_join\n"); - return PTS_UNRESOLVED; - } - -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_detach.1-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_2-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_2-1_tc.c deleted file mode 100644 index 0b15e1d99b..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_2-1_tc.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_detach() - * - * If 'thread' has not terminated, pthread_detach() shall not cause it to - * terminate. The effect of multiple pthread_detach() calls on the same - * - * STEPS: - * 1.Create a joinable thread - * 2.Detach that thread - * 3.Verify that the thread did not terminate because of this - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -static void *a_thread_func() -{ - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - /* If the thread wasn't canceled in 10 seconds, time out */ - sleep(10); - - perror("Thread couldn't be canceled (at cleanup time), timing out\n"); - pthread_exit(0); - return NULL; -} - -static int posix_testcase(void) -{ - pthread_attr_t new_attr; - pthread_t new_th; - int ret; - - /* Initialize attribute */ - if (pthread_attr_init(&new_attr) != 0) { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to be joinable */ - if (pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != - 0) { - perror("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* Create the thread */ - if (pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Detach the thread. */ - if (pthread_detach(new_th) != 0) { - printf("Error detaching thread\n"); - return PTS_FAIL; - } - - /* Verify that it hasn't terminated the thread */ - ret = pthread_cancel(new_th); - - if (ret != 0) { - if (ret == ESRCH) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - perror("Error canceling thread\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_detach.2-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_4-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_4-1_tc.c deleted file mode 100644 index 21975212a4..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_detach/pthread_detach_4-1_tc.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_detach() - * - * Upon failure, it shall return an error number: - * -[EINVAL] The implemenation has detected that the value specified by - * 'thread' does not refer to a joinable thread. - * -[ESRCH] No thread could be found corresponding to that thread - - * It shall not return an error code of [EINTR] - * - * STEPS: - * 1.Create a detached state thread - * 2.Detach that thread - * 3.Check the return value and make sure it is EINVAL - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -/* Thread function */ -static void *a_thread_func() -{ - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - /* If the thread wasn't canceled in 10 seconds, time out */ - sleep(10); - - perror("Thread couldn't be canceled (at cleanup time), timing out\n"); - pthread_exit(0); - return NULL; -} - -static int posix_testcase(void) -{ - pthread_attr_t new_attr; - pthread_t new_th; - int ret; - - /* Initialize attribute */ - if (pthread_attr_init(&new_attr) != 0) { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to be detached */ - if (pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_DETACHED) != - 0) { - perror("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* Create the thread */ - if (pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Detach the thread. */ - ret = pthread_detach(new_th); - - /* Cleanup and cancel the thread */ - pthread_cancel(new_th); - - /* Check return value of pthread_detach() */ - if (ret != EINVAL) { - if (ret == ESRCH) { - perror("Error detaching thread\n"); - return PTS_UNRESOLVED; - } - - printf("Test FAILED: Incorrect return code\n"); - return PTS_FAIL; - - } - - printf("Test PASSED\n"); - return PTS_PASS; -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_detach.4-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_exit/pthread_exit_1-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_exit/pthread_exit_1-1_tc.c deleted file mode 100644 index 8f99c6f7ba..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_exit/pthread_exit_1-1_tc.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_exit() - * - * terminates the calling thread and makes the value 'value_ptr' available - * to any successful join with the terminating thread. - * - * Steps: - * 1. Create a new thread. Have it return a return code on pthread_exit(); - * 2. Call pthread_join() in main(), and pass to it 'value_ptr'. - * 3. Check to see of the value_ptr and the value returned by pthread_exit() are the same; - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define RETURN_CODE 100 /* Set a random return code number. This shall be the return code of the - thread when using pthread_exit(). */ - -#define INTHREAD 0 /* Control going to or is already for Thread */ -#define INMAIN 1 /* Control going to or is already for Main */ - -static int sem; /* Manual semaphore used to indicate when the thread has been created. */ - -/* Thread's function. */ -static void *a_thread_func() -{ - sem = INMAIN; - pthread_exit((void *)RETURN_CODE); - return NULL; -} - -static int posix_testcase(void) -{ - pthread_t new_th; - int *value_ptr; - - /* Initializing variables. */ - value_ptr = 0; - sem = INTHREAD; - - /* Create a new thread. */ - if (pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure the thread was created before we join it. */ - while (sem == INTHREAD) - sleep(1); - - /* Wait for thread to return */ - if (pthread_join(new_th, (void *)&value_ptr) != 0) { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check to make sure that 'value_ptr' that was passed to pthread_join() and the - * pthread_exit() return code that was used in the thread function are the same. */ - if ((long)value_ptr != RETURN_CODE) { - printf - ("Test FAILED: pthread_exit() could not pass the return value of the thread in 'value_ptr' to pthread_join().\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_exit.1-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/pthread_join/pthread_join_1-1_tc.c b/examples/utest/testcases/posix/pthread_h/functions/pthread_join/pthread_join_1-1_tc.c deleted file mode 100644 index aaabd12503..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/pthread_join/pthread_join_1-1_tc.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that pthread_join() - * - * shall suspend the execution of the calling thread until the target - * 'thread' terminates, unless 'thread' has already terminated. - * - * Steps: - * 1. Create a new thread. Have it sleep for 3 seconds. - * 2. The main() thread should wait for the new thread to finish - * execution before exiting out. - * - */ - -#include -#include -#include -#include "posixtest.h" - -static int end_exec; - -static void *a_thread_func() -{ - int i; - - printf("Wait for 3 seconds for thread to finish execution:\n"); - for (i = 1; i < 4; i++) { - printf("Waited (%d) second\n", i); - sleep(1); - } - - /* Indicate that the thread has ended execution. */ - end_exec = 1; - - pthread_exit(0); - return NULL; -} - -static int posix_testcase(void) -{ - pthread_t new_th; - - /* Initialize flag */ - end_exec = 0; - - /* Create a new thread. */ - if (pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to return */ - if (pthread_join(new_th, NULL) != 0) { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if (end_exec == 0) { - printf("Test FAILED: When using pthread_join(), " - "main() did not wait for thread to finish " - "execution before continuing.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} -#include -UTEST_TC_EXPORT(testcase, "posix.pthread_join.1-1.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/pthread_h/functions/rtt_utest_internal.h b/examples/utest/testcases/posix/pthread_h/functions/rtt_utest_internal.h deleted file mode 100644 index 524728546c..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/rtt_utest_internal.h +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -static void posix_unit_test(void) -{ - pthread_t new_th; /* Create a new thread. */ - int err_val; - - if (pthread_create(&new_th, NULL, (void *(*)(void *))posix_testcase, NULL) != 0) { - perror("Error creating thread\n"); - } - - /* Wait for thread to return */ - if (pthread_join(new_th, (void*)&err_val) != 0) { - perror("Error in pthread_join()\n"); - } - - rt_thread_mdelay(1000); - - uassert_true(err_val == 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(posix_unit_test); -} diff --git a/examples/utest/testcases/posix/pthread_h/functions/testfrmw/testfrmw.c b/examples/utest/testcases/posix/pthread_h/functions/testfrmw/testfrmw.c deleted file mode 100644 index 7ce293b515..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/testfrmw/testfrmw.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -static void output_init(void) -{ - return; -} - -static void output(char *string, ...) -{ - va_list ap; - struct tm *now; - time_t nw; - int oldstate; - - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate); - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf("[??:??:??]\n"); - else - printf("[%2.2d:%2.2d:%2.2d]\n", - now->tm_hour, now->tm_min, now->tm_sec); - va_start(ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); - pthread_setcancelstate(oldstate, NULL); -} - -static void output_fini(void) -{ - return; -} diff --git a/examples/utest/testcases/posix/pthread_h/functions/testfrmw/testfrmw.h b/examples/utest/testcases/posix/pthread_h/functions/testfrmw/testfrmw.h deleted file mode 100644 index e6397890e2..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/testfrmw/testfrmw.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - * - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is - * an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - */ - -#include "posixtest.h" -#include - -#ifdef __GNUC__ - -#define UNRESOLVED(x, s) \ -{ \ - output("Test %s unresolved: got %i (%s) on line %i (%s)\n", \ - __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); \ -} - -#define FAILED(s) \ -{ \ - output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); \ -} - -#define PASSED \ -{ \ - output_fini(); \ - exit(PTS_PASS); \ -} - -#define UNTESTED(s) \ -{ \ - output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else - -#define UNRESOLVED(x, s) \ -{ \ - output("Test unresolved: got %i (%s) on line %i (%s)\n", \ - x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); \ -} - -#define FAILED(s) \ -{ \ - output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); \ -} - -#define PASSED \ -{ \ - output_fini(); \ - exit(PTS_PASS); \ -} - -#define UNTESTED(s) \ -{ \ - output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif diff --git a/examples/utest/testcases/posix/pthread_h/functions/testfrmw/threads_scenarii.c b/examples/utest/testcases/posix/pthread_h/functions/testfrmw/threads_scenarii.c deleted file mode 100644 index f4976388e0..0000000000 --- a/examples/utest/testcases/posix/pthread_h/functions/testfrmw/threads_scenarii.c +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * This file is a helper file for the pthread_create tests - * It defines the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -static struct __scenario { - /* - * Object to hold the given configuration, - * and which will be used to create the threads - */ - pthread_attr_t ta; - - /* General parameters */ - /* 0 => joinable; 1 => detached */ - int detached; - - /* Scheduling parameters */ - /* - * 0 => sched policy is inherited; - * 1 => sched policy from the attr param - */ - int explicitsched; - /* 0 => default; 1=> SCHED_FIFO; 2=> SCHED_RR */ - int schedpolicy; - /* - * 0 => default sched param; - * 1 => max value for sched param; - * -1 => min value for sched param - */ - int schedparam; - /* - * 0 => default contension scope; - * 1 => alternative contension scope - */ - int altscope; - - /* Stack parameters */ - /* 0 => system manages the stack; 1 => stack is provided */ - int altstack; - /* - * 0 => default guardsize; - * 1=> guardsize is 0; - * 2=> guard is 1 page - * -- this setting only affect system stacks (not user's). - */ - int guard; - /* - * 0 => default stack size; - * 1 => stack size specified (min value) - * -- ignored when stack is provided - */ - int altsize; - - /* Additionnal information */ - /* object description */ - char *descr; - /* Stores the stack start when an alternate stack is required */ - void *bottom; - /* - * This thread creation is expected to: - * 0 => succeed; 1 => fail; 2 => unknown - */ - int result; - /* - * This semaphore is used to signal the end of - * the detached threads execution - */ - sem_t sem; -} scenarii[] = -#define CASE(det, expl, scp, spa, sco, sta, gua, ssi, desc, res) \ -{ \ - .detached = det, \ - .explicitsched = expl, \ - .schedpolicy = scp, \ - .schedparam = spa, \ - .altscope = sco, \ - .altstack = sta, \ - .guard = gua, \ - .altsize = ssi, \ - .descr = desc, \ - .bottom = NULL, \ - .result = res \ -} -#define CASE_POS(det, expl, scp, spa, sco, sta, gua, ssi, desc) \ - CASE(det, expl, scp, spa, sco, sta, gua, ssi, desc, 0) -#define CASE_NEG(det, expl, scp, spa, sco, sta, gua, ssi, desc) \ - CASE(det, expl, scp, spa, sco, sta, gua, ssi, desc, 1) -#define CASE_UNK(det, expl, scp, spa, sco, sta, gua, ssi, desc) \ - CASE(det, expl, scp, spa, sco, sta, gua, ssi, desc, 2) -/* - * This array gives the different combinations of threads - * attributes for the testcases. - * - * Some combinations must be avoided. - * -> Do not have a detached thread use an alternative stack; - * as we don't know when the thread terminates to free the stack memory - * -> ... (to be completed) - */ -{ - /* Unary tests */ - CASE_POS(0, 0, 0, 0, 0, 0, 0, 0, "default"), - CASE_POS(1, 0, 0, 0, 0, 0, 0, 0, "detached"), - CASE_POS(0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched"), - CASE_UNK(0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy"), - CASE_UNK(0, 0, 2, 0, 0, 0, 0, 0, "RR Policy"), - CASE_UNK(0, 0, 0, 1, 0, 0, 0, 0, "Max sched param"), - CASE_UNK(0, 0, 0, -1, 0, 0, 0, 0, "Min sched param"), - CASE_POS(0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope"), - CASE_POS(0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack"), - CASE_POS(0, 0, 0, 0, 0, 0, 1, 0, "No guard size"), - CASE_UNK(0, 0, 0, 0, 0, 0, 2, 0, "1p guard size"), - CASE_POS(0, 0, 0, 0, 0, 0, 0, 1, "Min stack size"), - /* Stack play */ - CASE_POS(0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard"), - CASE_UNK(0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard"), - CASE_POS(1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack"), - CASE_POS(1, 0, 0, 0, 0, 0, 1, 1, - "Detached, Min stack size, no guard"), CASE_UNK(1, 0, 0, 0, - 0, 0, 2, 1, - "Detached, Min stack size, 1p guard"), - /* - * Scheduling play - * -- all results are unknown since it might depend on - * the user priviledges - */ -CASE_UNK(0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param"), - CASE_UNK(0, 1, 2, 1, 0, 0, 0, 0, - "Explicit RR max param"), - CASE_UNK(0, 1, 1, -1, 0, 0, 0, 0, - "Explicit FIFO min param"), - CASE_UNK(0, 1, 2, -1, 0, 0, 0, 0, - "Explicit RR min param"), - CASE_UNK(0, 1, 1, 1, 1, 0, 0, 0, - "Explicit FIFO max param, alt scope"), - CASE_UNK(0, 1, 2, 1, 1, 0, 0, 0, - "Explicit RR max param, alt scope"), - CASE_UNK(0, 1, 1, -1, 1, 0, 0, 0, - "Explicit FIFO min param, alt scope"), - CASE_UNK(0, 1, 2, -1, 1, 0, 0, 0, - "Explicit RR min param, alt scope"), - CASE_UNK(1, 1, 1, 1, 0, 0, 0, 0, - "Detached, explicit FIFO max param"), - CASE_UNK(1, 1, 2, 1, 0, 0, 0, 0, - "Detached, explicit RR max param"), - CASE_UNK(1, 1, 1, -1, 0, 0, 0, 0, - "Detached, explicit FIFO min param"), - CASE_UNK(1, 1, 2, -1, 0, 0, 0, 0, - "Detached, explicit RR min param"), - CASE_UNK(1, 1, 1, 1, 1, 0, 0, 0, - "Detached, explicit FIFO max param," - " alt scope"), CASE_UNK(1, 1, 2, 1, - 1, - 0, - 0, - 0, - "Detached, explicit RR max param," - " alt scope"), - CASE_UNK(1, 1, 1, -1, 1, 0, 0, 0, - "Detached, explicit FIFO min param," - " alt scope"), CASE_UNK(1, 1, 2, - -1, - 1, - 0, - 0, - 0, - "Detached, explicit RR min param," - " alt scope"),}; - -#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0])) - -/* - * This function will initialize every pthread_attr_t object - * in the scenarii array - */ -static void scenar_init(void) -{ - int ret = 0; - unsigned int i; - int old; - long pagesize, minstacksize; - long tsa, tss, tps; - - pagesize = sysconf(_SC_PAGESIZE); - minstacksize = sysconf(_SC_THREAD_STACK_MIN); - tsa = sysconf(_SC_THREAD_ATTR_STACKADDR); - tss = sysconf(_SC_THREAD_ATTR_STACKSIZE); - tps = sysconf(_SC_THREAD_PRIORITY_SCHEDULING); - -#if VERBOSE > 0 - output("System abilities:\n"); - output(" TSA: %li\n", tsa); - output(" TSS: %li\n", tss); - output(" TPS: %li\n", tps); - output(" pagesize: %li\n", pagesize); - output(" min stack size: %li\n", minstacksize); -#endif - - if (minstacksize % pagesize) - UNTESTED("The min stack size is not a multiple" - " of the page size"); - - for (i = 0; i < NSCENAR; i++) { -#if VERBOSE > 2 - output("Initializing attribute for scenario %i: %s\n", - i, scenarii[i].descr); -#endif - - ret = pthread_attr_init(&scenarii[i].ta); - if (ret != 0) - UNRESOLVED(ret, "Failed to initialize a" - " thread attribute object"); - - /* Set the attributes according to the scenario */ - if (scenarii[i].detached == 1) { - ret = pthread_attr_setdetachstate(&scenarii[i].ta, - PTHREAD_CREATE_DETACHED); - if (ret != 0) - UNRESOLVED(ret, "Unable to set detachstate"); - } else { - ret = - pthread_attr_getdetachstate(&scenarii[i].ta, &old); - if (ret != 0) - UNRESOLVED(ret, "Unable to get detachstate" - " from initialized attribute"); - if (old != PTHREAD_CREATE_JOINABLE) - FAILED("The default attribute is not" - " PTHREAD_CREATE_JOINABLE"); - } -#if VERBOSE > 4 - output("Detach state was set successfully\n"); -#endif - - /* Sched related attributes */ - /* - * This routine is dependent on the Thread Execution - * Scheduling option - */ - if (tps > 0) { - if (scenarii[i].explicitsched == 1) - ret = - pthread_attr_setinheritsched(&scenarii - [i].ta, - PTHREAD_EXPLICIT_SCHED); - else - ret = - pthread_attr_setinheritsched(&scenarii - [i].ta, - PTHREAD_INHERIT_SCHED); - if (ret != 0) - UNRESOLVED(ret, "Unable to set inheritsched" - " attribute"); -#if VERBOSE > 4 - output("inheritsched state was set successfully\n"); -#endif - } -#if VERBOSE > 4 - else - output("TPS unsupported => inheritsched parameter" - " untouched\n"); -#endif - - if (tps > 0) { - if (scenarii[i].schedpolicy == 1) - ret = - pthread_attr_setschedpolicy(&scenarii[i].ta, - SCHED_FIFO); - if (scenarii[i].schedpolicy == 2) - ret = - pthread_attr_setschedpolicy(&scenarii[i].ta, - SCHED_RR); - if (ret != 0) - UNRESOLVED(ret, "Unable to set the" - " sched policy"); -#if VERBOSE > 4 - if (scenarii[i].schedpolicy) - output("Sched policy was set successfully\n"); - else - output("Sched policy untouched\n"); -#endif - } -#if VERBOSE > 4 - else - output("TPS unsupported => sched policy parameter" - " untouched\n"); -#endif - - if (scenarii[i].schedparam != 0) { - struct sched_param sp; - - ret = - pthread_attr_getschedpolicy(&scenarii[i].ta, &old); - if (ret != 0) - UNRESOLVED(ret, "Unable to get sched policy" - " from attribute"); - - if (scenarii[i].schedparam == 1) - sp.sched_priority = sched_get_priority_max(old); - if (scenarii[i].schedparam == -1) - sp.sched_priority = sched_get_priority_min(old); - - ret = pthread_attr_setschedparam(&scenarii[i].ta, &sp); - if (ret != 0) - UNRESOLVED(ret, - "Failed to set the sched param"); - -#if VERBOSE > 4 - output("Sched param was set successfully to %i\n", - sp.sched_priority); - } else { - output("Sched param untouched\n"); -#endif - } - - if (tps > 0) { - ret = pthread_attr_getscope(&scenarii[i].ta, &old); - if (ret != 0) - UNRESOLVED(ret, "Failed to get contension" - " scope from thread attribute"); - - if (scenarii[i].altscope != 0) { - if (old == PTHREAD_SCOPE_PROCESS) - old = PTHREAD_SCOPE_SYSTEM; - else - old = PTHREAD_SCOPE_PROCESS; - - ret = - pthread_attr_setscope(&scenarii[i].ta, old); - -#if VERBOSE > 0 - if (ret != 0) - output("WARNING: The TPS option is" - " claimed to be supported but" - " setscope fails\n"); -#endif - -#if VERBOSE > 4 - output("Contension scope set to %s\n", - old == PTHREAD_SCOPE_PROCESS ? - "PTHREAD_SCOPE_PROCESS" : - "PTHREAD_SCOPE_SYSTEM"); - } else { - output("Contension scope untouched (%s)\n", - old == PTHREAD_SCOPE_PROCESS ? - "PTHREAD_SCOPE_PROCESS" : - "PTHREAD_SCOPE_SYSTEM"); -#endif - } - } -#if VERBOSE > 4 - else - output("TPS unsupported => sched contension scope" - " parameter untouched\n"); -#endif - - /* Stack related attributes */ - /* - * This routine is dependent on the Thread Stack Address - * Attribute and Thread Stack Size Attribute options - */ - if ((tss > 0) && (tsa > 0)) { - if (scenarii[i].altstack != 0) { - /* - * This is slightly more complicated. - * We need to alloc a new stackand free - * it upon test termination. - * We will alloc with a simulated guardsize - * of 1 pagesize */ - scenarii[i].bottom = malloc(minstacksize + pagesize); - if (scenarii[i].bottom == NULL) - UNRESOLVED(errno, "Unable to alloc" - " enough memory for" - " alternative stack"); - - ret = pthread_attr_setstack(&scenarii[i].ta, - scenarii[i].bottom, - minstacksize); - if (ret != 0) - UNRESOLVED(ret, "Failed to specify" - " alternate stack"); - -#if VERBOSE > 1 - output("Alternate stack created successfully." - " Bottom=%p, Size=%i\n", - scenarii[i].bottom, minstacksize); -#endif - } - } -#if VERBOSE > 4 - else - output("TSA or TSS unsupported => " - "No alternative stack\n"); -#endif - -#ifndef WITHOUT_XOPEN - if (scenarii[i].guard != 0) { - if (scenarii[i].guard == 1) - ret = - pthread_attr_setguardsize(&scenarii[i].ta, - 0); - if (scenarii[i].guard == 2) - ret = - pthread_attr_setguardsize(&scenarii[i].ta, - pagesize); - if (ret != 0) - UNRESOLVED(ret, "Unable to set guard area" - " size in thread stack"); -#if VERBOSE > 4 - output("Guard size set to %i\n", - scenarii[i].guard == 1 ? 1 : pagesize); -#endif - } -#endif - - if (tss > 0) { - if (scenarii[i].altsize != 0) { - ret = pthread_attr_setstacksize(&scenarii[i].ta, - minstacksize); - if (ret != 0) - UNRESOLVED(ret, "Unable to change" - " stack size"); -#if VERBOSE > 4 - output("Stack size set to %i (this is the " - "min)\n", minstacksize); -#endif - } - } -#if VERBOSE > 4 - else - output("TSS unsupported => stack size unchanged\n"); -#endif - - ret = sem_init(&scenarii[i].sem, 0, 0); - if (ret == -1) - UNRESOLVED(errno, "Unable to init a semaphore"); - - } -#if VERBOSE > 0 - output("All %i thread attribute objects were initialized\n\n", NSCENAR); -#endif -} - -/* - * This function will free all resources consumed - * in the scenar_init() routine - */ -static void scenar_fini(void) -{ - int ret = 0; - unsigned int i; - - for (i = 0; i < NSCENAR; i++) { - if (scenarii[i].bottom != NULL) - free(scenarii[i].bottom); - - ret = sem_destroy(&scenarii[i].sem); - if (ret == -1) - UNRESOLVED(errno, "Unable to destroy a semaphore"); - - ret = pthread_attr_destroy(&scenarii[i].ta); - if (ret != 0) - UNRESOLVED(ret, "Failed to destroy a thread" - " attribute object"); - } -} - -static unsigned int sc; - -#ifdef STD_MAIN - -static void *threaded(void *arg); - -int main(void) -{ - int ret = 0; - pthread_t child; - - output_init(); - scenar_init(); - - for (sc = 0; sc < NSCENAR; sc++) { -#if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", - sc, scenarii[sc].descr); -#endif - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, NULL); - switch (scenarii[sc].result) { - case 0: /* Operation was expected to succeed */ - if (ret != 0) - UNRESOLVED(ret, "Failed to create this thread"); - break; - case 1: /* Operation was expected to fail */ - if (ret == 0) - UNRESOLVED(-1, "An error was expected but the" - " thread creation succeeded"); - break; - case 2: /* We did not know the expected result */ - default: -#if VERBOSE > 0 - if (ret == 0) - output("Thread has been created successfully" - " for this scenario\n"); - else - output("Thread creation failed with the error:" - " %s\n", strerror(ret)); -#endif - } - if (ret == 0) { - if (scenarii[sc].detached == 0) { - ret = pthread_join(child, NULL); - if (ret != 0) - UNRESOLVED(ret, "Unable to join a" - " thread"); - } else { - /* Just wait for the thread to terminate */ - do { - ret = sem_wait(&scenarii[sc].sem); - } while ((ret == -1) && (errno == EINTR)); - if (ret == -1) - UNRESOLVED(errno, "Failed to wait for" - " the semaphore"); - } - } - } - - scenar_fini(); -#if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); -#endif - - PASSED; -} -#endif diff --git a/examples/utest/testcases/posix/sched_h/Kconfig b/examples/utest/testcases/posix/sched_h/Kconfig deleted file mode 100644 index 4df5ad78b0..0000000000 --- a/examples/utest/testcases/posix/sched_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SCHED_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SCHED_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/semaphore_h/Kconfig b/examples/utest/testcases/posix/semaphore_h/Kconfig deleted file mode 100644 index cb172291ab..0000000000 --- a/examples/utest/testcases/posix/semaphore_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SEMAPHORE_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SEMAPHORE_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/setjmp_h/Kconfig b/examples/utest/testcases/posix/setjmp_h/Kconfig deleted file mode 100644 index f812e9c51c..0000000000 --- a/examples/utest/testcases/posix/setjmp_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SETJMP_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SETJMP_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/signal_h/Kconfig b/examples/utest/testcases/posix/signal_h/Kconfig deleted file mode 100644 index 3cbd217dc5..0000000000 --- a/examples/utest/testcases/posix/signal_h/Kconfig +++ /dev/null @@ -1,23 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SIGNAL_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SIGNAL_H - - config SIGNAL_H_SIGACTION - bool " -> sigaction" - default n - - config SIGNAL_H_SIGPROCMASK - bool " -> sigprocmask" - default n - - config SIGNAL_H_RAISE - bool " -> raise" - default n - - config SIGNAL_H_SIGNAL - bool " -> signal" - default n - -endif diff --git a/examples/utest/testcases/posix/stdarg_h/Kconfig b/examples/utest/testcases/posix/stdarg_h/Kconfig deleted file mode 100644 index 410e2c2dd0..0000000000 --- a/examples/utest/testcases/posix/stdarg_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_STDARG_H - bool "" - default n - -if RTT_POSIX_TESTCASE_STDARG_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/stdio_h/Kconfig b/examples/utest/testcases/posix/stdio_h/Kconfig deleted file mode 100644 index e8dc70451a..0000000000 --- a/examples/utest/testcases/posix/stdio_h/Kconfig +++ /dev/null @@ -1,149 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_STDIO_H - bool "" - default n - -if RTT_POSIX_TESTCASE_STDIO_H - - config STDIO_H_CLEARERR - bool " -> clearerr" - default n - - config STDIO_H_FCLOSE - bool " -> fclose" - default n - - config STDIO_H_FDOPEN - bool " -> fdopen" - default n - - config STDIO_H_FEOF - bool " -> feof" - default n - - config STDIO_H_FERROR - bool " -> ferror" - default n - - config STDIO_H_FFLUSH - bool " -> fflush" - default n - - config STDIO_H_FGETC - bool " -> fgetc" - default n - - config STDIO_H_FGETS - bool " -> fgets" - default n - - config STDIO_H_FILENO - bool " -> fileno" - default n - - config STDIO_H_FOPEN - bool " -> fopen" - default n - - config STDIO_H_FPRINTF - bool " -> fprintf" - default n - - config STDIO_H_FPUTC - bool " -> fputc" - default n - - config STDIO_H_FPUTS - bool " -> fputs" - default n - - config STDIO_H_FREAD - bool " -> fread" - default n - - config STDIO_H_FSCANF - bool " -> fscanf" - default n - - config STDIO_H_FSEEK - bool " -> fseek" - default n - - config STDIO_H_FTELL - bool " -> ftell" - default n - - config STDIO_H_FWRITE - bool " -> fwrite" - default n - - - - config STDIO_H_PERROR - bool " -> perror" - default n - - config STDIO_H_PRINTF - bool " -> printf" - default n - - config STDIO_H_PUTC - bool " -> putc" - default n - - config STDIO_H_PUTCHAR - bool " -> putchar" - default n - - config STDIO_H_PUTS - bool " -> puts" - default n - - config STDIO_H_REMOVE - bool " -> remove" - default n - - config STDIO_H_RENAME - bool " -> rename" - default n - - config STDIO_H_REWIND - bool " -> rewind" - default n - - config STDIO_H_SETBUF - bool " -> setbuf" - default n - - config STDIO_H_SETVBUF - bool " -> setvbuf" - default n - - config STDIO_H_SNPRINTF - bool " -> snprintf" - default n - - config STDIO_H_SPRINTF - bool " -> sprintf" - default n - - config STDIO_H_SSCANF - bool " -> sscanf" - default n - - config STDIO_H_VFPRINTF - bool " -> vfprintf" - default n - - config STDIO_H_VPRINTF - bool " -> vprintf" - default n - - config STDIO_H_VSNPRINTF - bool " -> vsnprintf" - default n - - config STDIO_H_VSPRINTF - bool " -> vsprintf" - default n - -endif diff --git a/examples/utest/testcases/posix/stdio_h/SConscript b/examples/utest/testcases/posix/stdio_h/SConscript deleted file mode 100644 index 39894302fb..0000000000 --- a/examples/utest/testcases/posix/stdio_h/SConscript +++ /dev/null @@ -1,122 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() -path = [cwd] -src = [] - -if GetDepend('RTT_POSIX_TESTCASE_STDIO_H'): - src += Glob('./definitions/*.c') - - -if GetDepend('STDIO_H_CLEARERR'): - src += Glob('./functions/clearerr_tc.c') - -if GetDepend('STDIO_H_FCLOSE'): - src += Glob('./functions/fclose_tc.c') - -if GetDepend('STDIO_H_FDOPEN'): - src += Glob('./functions/fdopen_tc.c') - -if GetDepend('STDIO_H_FEOF'): - src += Glob('./functions/feof_tc.c') - -if GetDepend('STDIO_H_FERROR'): - src += Glob('./functions/ferror_tc.c') - -if GetDepend('STDIO_H_FFLUSH'): - src += Glob('./functions/fflush_tc.c') - -if GetDepend('STDIO_H_FGETC'): - src += Glob('./functions/fgetc_tc.c') - -if GetDepend('STDIO_H_FGETS'): - src += Glob('./functions/fgets_tc.c') - -if GetDepend('STDIO_H_FILENO'): - src += Glob('./functions/fileno_tc.c') - -if GetDepend('STDIO_H_FOPEN'): - src += Glob('./functions/fopen_tc.c') - -if GetDepend('STDIO_H_FPRINTF'): - src += Glob('./functions/fprintf_tc.c') - -if GetDepend('STDIO_H_FPUTC'): - src += Glob('./functions/fputc_tc.c') - -if GetDepend('STDIO_H_FPUTS'): - src += Glob('./functions/fputs_tc.c') - -if GetDepend('STDIO_H_FREAD'): - src += Glob('./functions/fread_tc.c') - -if GetDepend('STDIO_H_FSCANF'): - src += Glob('./functions/fscanf_tc.c') - -if GetDepend('STDIO_H_FSEEK'): - src += Glob('./functions/fseek_tc.c') - -if GetDepend('STDIO_H_FTELL'): - src += Glob('./functions/ftell_tc.c') - -if GetDepend('STDIO_H_FWRITE'): - src += Glob('./functions/fwrite_tc.c') - - -if GetDepend('STDIO_H_PERROR'): - src += Glob('./functions/perror_tc.c') - -if GetDepend('STDIO_H_PRINTF'): - src += Glob('./functions/printf_tc.c') - -if GetDepend('STDIO_H_PUTC'): - src += Glob('./functions/putc_tc.c') - -if GetDepend('STDIO_H_PUTCHAR'): - src += Glob('./functions/putchar_tc.c') - -if GetDepend('STDIO_H_PUTS'): - src += Glob('./functions/puts_tc.c') - -if GetDepend('STDIO_H_REMOVE'): - src += Glob('./functions/remove_tc.c') - -if GetDepend('STDIO_H_RENAME'): - src += Glob('./functions/rename_tc.c') - -if GetDepend('STDIO_H_REWIND'): - src += Glob('./functions/rewind_tc.c') - -if GetDepend('STDIO_H_SETBUF'): - src += Glob('./functions/setbuf_tc.c') - -if GetDepend('STDIO_H_SETVBUF'): - src += Glob('./functions/setvbuf_tc.c') - -if GetDepend('STDIO_H_SNPRINTF'): - src += Glob('./functions/snprintf_tc.c') - -if GetDepend('STDIO_H_SPRINTF'): - src += Glob('./functions/sprintf_tc.c') - -if GetDepend('STDIO_H_SSCANF'): - src += Glob('./functions/sscanf_tc.c') - -if GetDepend('STDIO_H_VFPRINTF'): - src += Glob('./functions/vfprintf_tc.c') - -if GetDepend('STDIO_H_VPRINTF'): - src += Glob('./functions/vprintf_tc.c') - -if GetDepend('STDIO_H_VSNPRINTF'): - src += Glob('./functions/vsnprintf_tc.c') - -if GetDepend('STDIO_H_VSPRINTF'): - src += Glob('./functions/vsprintf_tc.c') - -group = DefineGroup('rtt_posix_testcase', src, depend = ['RTT_POSIX_TESTCASE_STDIO_H'], CPPPATH = path) - -Return('group') diff --git a/examples/utest/testcases/posix/stdio_h/definitions/stdio_h.c b/examples/utest/testcases/posix/stdio_h/definitions/stdio_h.c deleted file mode 100644 index 0a5e3006bd..0000000000 --- a/examples/utest/testcases/posix/stdio_h/definitions/stdio_h.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - - /* test if stdio.h exists and can be included */ - -// #define _POSIX_C_SOURCE 2 - -#include -#include - -void (*test_clearerr)(FILE *); -int (*test_fclose)(FILE *); -FILE * (*test_fdopen)(int, const char *); -int (*test_feof)(FILE *); -int (*test_ferror)(FILE *); -int (*test_fflush)(FILE *); -int (*test_fgetc)(FILE *); -char * (*test_fgets)(char *__restrict, int, FILE *__restrict); -int (*test_fileno)(FILE *); -void (*test_flockfile)(FILE *); -FILE * (*test_fopen)(const char *__restrict _name, const char *__restrict _type); -int (*test_fprintf)(FILE *__restrict, const char *__restrict, ...); -int (*test_fputc)(int, FILE *); -int (*test_fputs)(const char *__restrict, FILE *__restrict); -size_t (*test_fread)(void *__restrict, size_t _size, size_t _n, FILE *__restrict); -FILE * (*test_freopen)(const char *__restrict, const char *__restrict, FILE *__restrict); -int (*test_fscanf)(FILE *__restrict, const char *__restrict, ...); -int (*test_ftrylockfile)(FILE *); -void (*test_funlockfile)(FILE *); -size_t (*test_fwrite)(const void *__restrict , size_t _size, size_t _n, FILE *); -int (*test_getc)(FILE *); -int (*test_getc_unlocked)(FILE *); -int (*test_getchar)(void); -int (*test_getchar_unlocked)(void); -char * (*test_gets)(char *); -void (*test_perror)(const char *); -int (*test_printf)(const char *__restrict, ...); -int (*test_putc)(int, FILE *); -int (*test_putc_unlocked)(int, FILE *); -int (*test_putchar)(int); -int (*test_putchar_unlocked)(int); -int (*test_puts)(const char *); -int (*test_scanf)(const char *__restrict, ...); -void (*test_setbuf)(FILE *__restrict, char *__restrict); -int (*test_setvbuf)(FILE *__restrict, char *__restrict, int, size_t); -int (*test_snprintf)(char *__restrict, size_t, const char *__restrict, ...); -int (*test_sprintf)(char *__restrict, const char *__restrict, ...); -int (*test_sscanf)(const char *__restrict, const char *__restrict, ...); -int (*test_ungetc)(int, FILE *); - -FILE *test_stderr; -FILE *test_stdin; -FILE *test_stdout; - -int (*test_vfprintf)(FILE *restrict, const char *restrict, va_list); -int (*test_vfscanf)(FILE *restrict, const char *restrict, va_list); -int (*test_vprintf)(const char *restrict, va_list); -int (*test_vscanf)(const char *restrict, va_list); -int (*test_vsnprintf)(char *restrict, size_t, const char *restrict, va_list); -int (*test_vsprintf)(char *restrict, const char *restrict, va_list); -int (*test_vsscanf)(const char *restrict, const char *restrict, va_list); - -__attribute__((unused)) static int test_defined() -{ - test_clearerr = clearerr; - test_fclose = fclose; - // test_fdopen = fdopen; - test_feof = feof; - test_ferror = ferror; - test_fflush = fflush; - test_fgetc = fgetc; - test_fgets = fgets; - // test_fileno = fileno; - // test_flockfile = flockfile; - test_fopen = fopen; - test_fprintf = fprintf; - test_fputc = fputc; - test_fputs = fputs; - test_fread = fread; - test_freopen = freopen; - test_fscanf = fscanf; - // test_ftrylockfile = ftrylockfile; - // test_funlockfile = funlockfile; - test_fwrite = fwrite; - test_getc = getc; - // test_getc_unlocked = getc_unlocked; - test_getchar = getchar; - test_gets = gets; - test_perror = perror; - test_printf = printf; - test_putc = putc; - // test_putc_unlocked = putc_unlocked; - test_putchar = putchar; - // test_putchar_unlocked = putchar_unlocked; - test_puts = puts; - test_scanf = scanf; - test_setbuf = setbuf; - test_setvbuf = setvbuf; - test_snprintf = snprintf; - test_sprintf = sprintf; - test_sscanf = sscanf; - test_ungetc = ungetc; - - test_stderr = stderr; - test_stdin = stdin; - test_stdout = stdout; - - test_vfprintf = vfprintf; - test_vfscanf = vfscanf; - test_vprintf = vprintf; - test_vscanf = vscanf; - test_vsnprintf = vsnprintf; - test_vsprintf = vsprintf; - test_vsscanf = vsscanf; - - return 0; -} - diff --git a/examples/utest/testcases/posix/stdio_h/functions/clearerr_tc.c b/examples/utest/testcases/posix/stdio_h/functions/clearerr_tc.c deleted file mode 100644 index db1b6860e9..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/clearerr_tc.c +++ /dev/null @@ -1,31 +0,0 @@ -#include - -static int clearerr_entry(void) -{ - putc( 'c', stdin ); - if( ferror( stdin ) ) - { - perror( "Write error" ); - clearerr( stdin ); - } - - if( ferror( stdin )) - { - perror( "clearerr error" ); - return -1; - } - - return 0; -} - -#include -static void test_clearerr(void) -{ - uassert_int_equal(clearerr_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_clearerr); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.clearerr.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fclose_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fclose_tc.c deleted file mode 100644 index fef2235d4b..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fclose_tc.c +++ /dev/null @@ -1,34 +0,0 @@ -#include - -static int fclose_entry(void) -{ - FILE *stream; - stream = fopen("fopen_file.txt","a+"); - if (stream == NULL) - { - perror("fopen fail"); - return -1; - } - if(fclose(stream) != 0) - { - perror("fclose fail"); - return -1; - } - else - { - printf("fclose success \n"); - } - return 0; -} - -#include -static void test_fclose(void) -{ - uassert_int_equal(fclose_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fclose); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fclose.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fdopen_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fdopen_tc.c deleted file mode 100644 index ffde15628e..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fdopen_tc.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include - -static int fdopen_entry(void) -{ - int fd; - FILE *stream; - - fd = open("fdopen_file.txt", O_CREAT | O_RDWR | O_APPEND); - if (fd < 0) - { - printf("open fail.\n"); - return -1; - } - - /* TODO */ - stream = fdopen(fd, "w"); - if (stream == NULL) - { - printf("fdopen fail.\n"); - return -1; - } - - fclose(stream); - return 0; -} - -#include -static void test_fdopen(void) -{ - uassert_int_equal(fdopen_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fdopen); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fdopen_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/feof_tc.c b/examples/utest/testcases/posix/stdio_h/functions/feof_tc.c deleted file mode 100644 index 7394283f94..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/feof_tc.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include - -static int feof_entry(void) -{ - FILE *stream; - char data[] = "test fgetc"; - char getc[sizeof(data)] = {0}; - size_t size = 0; - int ret = 0; - int i=0; - - stream = fopen("fopen_file.txt","w+"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - - fwrite(data, sizeof(data), 1, stream); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - while(1) - { - getc[i] = fgetc(stream); - i++; - if( feof(stream) ) - { - break ; - } - } - - if(strcmp(getc, data)) - { - return -1; - } - - fclose(stream); -__exit: - return ret; -} - -#include -static void test_feof(void) -{ - uassert_int_equal(feof_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_feof); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.feof.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/ferror_tc.c b/examples/utest/testcases/posix/stdio_h/functions/ferror_tc.c deleted file mode 100644 index 18084113c4..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/ferror_tc.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -static int ferror_entry(void) -{ - int c; - putc( 'c', stdin ); - if( ferror( stdin ) ) - { - clearerr( stdin ); - } - else - { - return -1; - } - return 0; -} - -#include -static void test_ferror(void) -{ - uassert_int_equal(ferror_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_ferror); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.ferror.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fflush_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fflush_tc.c deleted file mode 100644 index 672caa0b57..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fflush_tc.c +++ /dev/null @@ -1,29 +0,0 @@ -#include - -static int fflush_entry(void) -{ - fflush(stdout); - printf("test fflush\n"); - - printf("t"); - printf("e"); - printf("s"); - printf("t"); - fflush(stdout); - printf(" fflush"); - fflush(stdout); - printf("\n"); - return 0; -} - -#include -static void test_fflush(void) -{ - uassert_int_equal(fflush_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fflush); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fflush.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fgetc_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fgetc_tc.c deleted file mode 100644 index c6e6f64ed6..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fgetc_tc.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include - -static int fgetc_entry(void) -{ - FILE *stream; - char data[] = "test fgetc"; - char getc[sizeof(data)] = {0}; - size_t size = 0; - int ret = 0; - int i=0; - - stream = fopen("fopen_file.txt","w+"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - - fwrite(data, sizeof(data), 1, stream); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - while(1) - { - getc[i] = fgetc(stream); - i++; - if( feof(stream) ) - { - break ; - } - } - - if(strcmp(getc, data)) - { - return -1; - } - fclose(stream); -__exit: - return ret; -} - -#include -static void test_fgetc(void) -{ - uassert_int_equal(fgetc_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fgetc); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fgetc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fgets_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fgets_tc.c deleted file mode 100644 index e0b2a4766a..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fgets_tc.c +++ /dev/null @@ -1,50 +0,0 @@ -#include - -static int fgets_entry(void) -{ - FILE *stream; - char data[] = "test fgets"; - char gets[sizeof(data)] = {0}; - size_t size = 0; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - fwrite(data, sizeof(data), 1, stream); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - fgets(gets, sizeof(gets), stream); - - if(strcmp(gets, data)) - { - ret = -1; - } - fclose(stream); - -__exit: - return ret; -} - -#include -static void test_fgets(void) -{ - uassert_int_equal(fgets_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fgets); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fgets.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fileno_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fileno_tc.c deleted file mode 100644 index 55686bda57..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fileno_tc.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -static int fdopen_entry(void) -{ - int stdin_no = fileno(stdin); - int stdout_no = fileno(stdout); - int stderr_no = fileno(stderr); - - if((stdin_no == 0) && (stdout_no == 1) && (stderr_no == 2)) - { - return 0; - } - return -1; -} - -#include -static void test_fdopen(void) -{ - uassert_int_equal(fdopen_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fdopen); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fileno.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fopen_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fopen_tc.c deleted file mode 100644 index 8b231936a4..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fopen_tc.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -static int fopen_entry(void) -{ - FILE *stream; - /* TODO: other mode fopen */ - stream = fopen("fopen_file.txt","a+"); - if (stream == NULL) - { - perror("fopen fail"); - return -1; - } - - fclose(stream); - return 0; -} - -#include -static void test_fopen(void) -{ - uassert_int_equal(fopen_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fopen); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fopen.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fprintf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fprintf_tc.c deleted file mode 100644 index c44dcb57b7..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fprintf_tc.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -static int fdopen_entry(void) -{ - FILE *stream; - char test_data[] = "1a2bxx"; - char gets[sizeof(test_data)] = {0}; - size_t size = 0; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - fprintf(stream, "%d%c%d%c%s",1,'a',2,'b',"xx"); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - fgets(gets, sizeof(gets), stream); - - if(strcmp(test_data, gets)) - { - printf("%s\n",gets); - ret = -1; - } -__exit: - fclose(stream); - return ret; -} - -#include -static void test_fdopen(void) -{ - uassert_int_equal(fdopen_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fdopen); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fprintf.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fputc_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fputc_tc.c deleted file mode 100644 index e1e932b795..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fputc_tc.c +++ /dev/null @@ -1,44 +0,0 @@ -#include - -static int fputc_entry(void) -{ - FILE *stream; - int ch = 'a'; - int getc = {0}; - size_t size = 0; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - fputc(ch, stream); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - getc = fgetc(stream); - - if(getc != ch) - { - perror("fputc"); - ret = -1; - } -__exit: - fclose(stream); - return ret; -} - -#include -static void test_fputc(void) -{ - uassert_int_equal(fputc_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fputc); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fputs_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fputs_tc.c deleted file mode 100644 index a01deefa6f..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fputs_tc.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -static int fputs_entry(void) -{ - FILE *stream; - char test_data[] = "1a2bxx"; - char gets[sizeof(test_data)] = {0}; - size_t size = 0; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - fputs(test_data, stream); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - fgets(gets, sizeof(gets), stream); - - if(strcmp(test_data, gets)) - { - printf("%s\n",gets); - ret = -1; - } -__exit: - fclose(stream); - return ret; -} - -#include -static void test_fputs(void) -{ - uassert_int_equal(fputs_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fputs); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fread_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fread_tc.c deleted file mode 100644 index febf567f45..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fread_tc.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include - - -static int fread_entry(void) -{ - FILE *stream; - char data[] = "test fread"; - char gets[sizeof(data)] = {0}; - size_t size = 0; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - fwrite(data, sizeof(data), 1, stream); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - fread(gets, sizeof(gets), 1, stream); - if(strcmp(gets, data)) - { - ret = -1; - } -__exit: - fclose(stream); - return ret; -} - -#include -static void test_fread(void) -{ - uassert_int_equal(fread_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fread); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fscanf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fscanf_tc.c deleted file mode 100644 index 4e44c5633d..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fscanf_tc.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include - -static int fscanf_entry(void) -{ - long l; - char s[81] = {0}; - char c; - int ret = 0; - FILE* stream = fopen("fopen_file.txt","w+"); - if(stream == NULL) - { - ret = -1; - perror("fopen"); - } - else - { - fprintf(stream,"%s %d %c","a_string",6500,'x'); - fseek(stream,0L,SEEK_SET); - fscanf(stream,"%s",s); - fscanf(stream,"%ld",&l); - fscanf(stream," %c",&c); - - if((strcmp(s,"a_string") != 0) || (l != 6500) || (c != 'x')) - { - ret = -1; - } - - fclose(stream); - } - return ret; -} - -#include -static void test_fscanf(void) -{ - uassert_int_equal(fscanf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fscanf); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.fscanf.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fseek_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fseek_tc.c deleted file mode 100644 index c6c9b2b5b8..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fseek_tc.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include - -static int fdopen_entry(void) -{ - long l; - char s[81] = {0}; - char c; - int ret = 0; - FILE* stream = fopen("fopen_file.txt","w+"); - if(stream == NULL) - { - ret = -1; - perror("fopen"); - } - else - { - fprintf(stream,"%s %d %c","a_string",6500,'x'); - fseek(stream,0L,SEEK_SET); - fscanf(stream,"%s",s); - fscanf(stream,"%ld",&l); - fscanf(stream," %c",&c); - - if((strcmp(s,"a_string") != 0) || (l != 6500) || (c != 'x')) - { - ret = -1; - } - - fclose(stream); - } - return ret; -} - -#include -static void test_fdopen(void) -{ - uassert_int_equal(fdopen_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fdopen); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/ftell_tc.c b/examples/utest/testcases/posix/stdio_h/functions/ftell_tc.c deleted file mode 100644 index f89a07c3dc..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/ftell_tc.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -static int ftell_entry(void) -{ - FILE *stream; - char str[] = "123456789"; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen"); - ret = -1; - } - else - { - fprintf(stream, "%s",str); - if(ftell(stream) != strlen(str)) - { - ret = -1; - } - fclose(stream); - } - return ret; -} - -#include -static void test_ftell(void) -{ - uassert_int_equal(ftell_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_ftell); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/fwrite_tc.c b/examples/utest/testcases/posix/stdio_h/functions/fwrite_tc.c deleted file mode 100644 index 19a5e0cf1e..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/fwrite_tc.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -static int fwrite_entry(void) -{ - FILE *stream; - char test_data[] = "1a2bxx"; - char gets[sizeof(test_data)] = {0}; - size_t size = 0; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - fwrite(test_data, sizeof(test_data), 1,stream); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - fgets(gets, sizeof(gets), stream); - - if(strcmp(test_data, gets)) - { - printf("%s\n",gets); - ret = -1; - } -__exit: - fclose(stream); - return ret; -} - -#include -static void test_fwrite(void) -{ - uassert_int_equal(fwrite_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_fwrite); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/perror_tc.c b/examples/utest/testcases/posix/stdio_h/functions/perror_tc.c deleted file mode 100644 index 6c2620fcc4..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/perror_tc.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -static int perror_entry(void) -{ - FILE *stream; - stream = fopen( "nulltest.txt", "r" ); - if(stream == NULL) - { - printf("perror test:"); - perror("nulltest.txt"); - return -1; - } - fclose(stream); - return 0; -} - -#include -static void test_perror(void) -{ - uassert_int_equal(perror_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_perror); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/printf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/printf_tc.c deleted file mode 100644 index ef777082cd..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/printf_tc.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -static int printf_entry(void) -{ - printf("printf test:%s-%d-%c %f 0x%x","2021" ,8 ,'1' ,3.14 ,0xff); - return 0; -} - -#include -static void test_printf(void) -{ - uassert_int_equal(printf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_printf); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/putc_tc.c b/examples/utest/testcases/posix/stdio_h/functions/putc_tc.c deleted file mode 100644 index 58f389d362..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/putc_tc.c +++ /dev/null @@ -1,44 +0,0 @@ -#include - -static int putc_entry(void) -{ - FILE *stream; - int ch = 'a'; - int getc = {0}; - size_t size = 0; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - putc(ch, stream); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - getc = fgetc(stream); - - if(getc != ch) - { - printf("fputc test:getc %c",getc); - ret = -1; - } -__exit: - fclose(stream); - return ret; -} - -#include -static void test_putc(void) -{ - uassert_int_equal(putc_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_putc); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/putchar_tc.c b/examples/utest/testcases/posix/stdio_h/functions/putchar_tc.c deleted file mode 100644 index 70c24520c6..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/putchar_tc.c +++ /dev/null @@ -1,25 +0,0 @@ -#include - -static int putchar_entry(void) -{ - char data[] = "putchar testcase\n"; - int i = 0; - for(;i < sizeof(data);i++) - { - putchar(data[i]); - } - fflush(stdout); - return 0; -} - -#include -static void test_putchar(void) -{ - uassert_int_equal(putchar_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_putchar); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/puts_tc.c b/examples/utest/testcases/posix/stdio_h/functions/puts_tc.c deleted file mode 100644 index 703fbeb41c..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/puts_tc.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -static int puts_entry(void) -{ - char data[] = "puts testcase\n"; - printf("puts testcase:"); - puts(data); - - return 0; -} - -#include -static void test_puts(void) -{ - uassert_int_equal(puts_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_puts); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.puts.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/remove_tc.c b/examples/utest/testcases/posix/stdio_h/functions/remove_tc.c deleted file mode 100644 index 8093f667b3..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/remove_tc.c +++ /dev/null @@ -1,35 +0,0 @@ -#include - -static int remove_entry(void) -{ - FILE *stream; - stream = fopen("fopen_file.txt","w"); - if(stream) - { - fclose(stream); - remove("fopen_file.txt"); - stream = fopen("fopen_file.txt","r"); - if(stream) - { - fclose(stream); - return -1; - } - } - else - { - return -1; - } - return 0; -} - -#include -static void test_remove(void) -{ - uassert_int_equal(remove_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_remove); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/rename_tc.c b/examples/utest/testcases/posix/stdio_h/functions/rename_tc.c deleted file mode 100644 index ff9c8dc885..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/rename_tc.c +++ /dev/null @@ -1,37 +0,0 @@ -#include - -static int rename_entry(void) -{ - FILE *stream; - stream = fopen("fopen_file.txt","r"); - if(stream == NULL) - { - stream = fopen("fopen_file.txt","w"); - if(stream == NULL) - { - return -1; - } - } - fclose(stream); - - rename("fopen_file.txt", "rename_test.txt"); - stream = fopen("rename_test.txt","r"); - if(stream == NULL) - { - return -1; - } - fclose(stream); - return 0; -} - -#include -static void test_rename(void) -{ - uassert_int_equal(rename_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_rename); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.rename.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/rewind_tc.c b/examples/utest/testcases/posix/stdio_h/functions/rewind_tc.c deleted file mode 100644 index 265bad12ec..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/rewind_tc.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include - -static int rewind_entry(void) -{ - long l; - char s[81] = {0}; - char c; - int ret = 0; - FILE* stream = fopen("fopen_file.txt","w+"); - if(stream == NULL) - { - ret = -1; - perror("fopen"); - } - else - { - fprintf(stream,"%s %d %c","a_string",6500,'x'); - rewind(stream); - fscanf(stream,"%s",s); - fscanf(stream,"%ld",&l); - fscanf(stream," %c",&c); - - if((strcmp(s,"a_string") != 0) || (l != 6500) || (c != 'x')) - { - ret = -1; - } - - fclose(stream); - } - return ret; -} - -#include -static void test_rewind(void) -{ - uassert_int_equal(rewind_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_rewind); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.rewind.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/setbuf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/setbuf_tc.c deleted file mode 100644 index 69fe5de615..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/setbuf_tc.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -static char outbuf[BUFSIZ]; -static int setbuf_entry(void) -{ - FILE *stream; - char test_data[] = "test setbuf"; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - setbuf(stream, outbuf); - fwrite(test_data, sizeof(test_data), 1,stream); - - if(strcmp(test_data, outbuf)) - { - printf("setbuf test:%s\n",test_data); - ret = -1; - } - fclose(stream); -__exit: - return ret; -} - -#include -static void test_setbuf(void) -{ - uassert_int_equal(setbuf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_setbuf); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.setbuf.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/setvbuf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/setvbuf_tc.c deleted file mode 100644 index 6ee91e569e..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/setvbuf_tc.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -static char outbuf[BUFSIZ]; -static int setvbuf_entry(void) -{ - FILE *stream; - char test_data[] = "test setbuf"; - int ret = 0; - - stream = fopen("fopen_file.txt","w"); - if (stream == NULL) - { - perror("fopen fail"); - ret = -1; - goto __exit; - } - setvbuf(stream, outbuf, _IOLBF, BUFSIZ); - fwrite(test_data, sizeof(test_data), 1,stream); - - if(strcmp(test_data, outbuf)) - { - printf("setvbuf test:%s\n",test_data); - ret = -1; - } -__exit: - fclose(stream); - return ret; -} - -#include -static void test_setvbuf(void) -{ - uassert_int_equal(setvbuf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_setvbuf); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.setvbuf.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/snprintf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/snprintf_tc.c deleted file mode 100644 index 8b7241f101..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/snprintf_tc.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -static int snprintf_entry(void) -{ - char buf[64] = {0}; - char test_data[] = "snprintf test:2021-8-"; - snprintf(buf, 22,"snprintf test:%s-%d-%c %.02f 0x%x","2021" ,8 ,'1' ,3.14 ,0xff); - - if(strcmp(buf, test_data)) - { - return -1; - } - return 0; -} - -#include -static void test_snprintf(void) -{ - uassert_int_equal(snprintf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_snprintf); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.snprintf.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/sprintf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/sprintf_tc.c deleted file mode 100644 index 6cba36f907..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/sprintf_tc.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -static int sprintf_entry(void) -{ - char buf[64] = {0}; - char test_data[] = "sprintf test:2021-8-1 3.14 0xff"; - sprintf(buf, "sprintf test:%s-%d-%c %.02f 0x%x","2021" ,8 ,'1' ,3.14 ,0xff); - - if(strcmp(buf, test_data)) - { - return -1; - } - return 0; -} - -#include -static void test_sprintf(void) -{ - uassert_int_equal(sprintf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_sprintf); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.sprintf.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/sscanf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/sscanf_tc.c deleted file mode 100644 index f026d2582a..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/sscanf_tc.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -static int sscanf_entry(void) -{ - int day, year; - char weekday[20], month[20], dtm[100]; - - strcpy( dtm, "Friday January 1 2021" ); - sscanf( dtm, "%s %s %d %d", weekday, month, &day, &year ); - - if(strcmp(month,"January") || strcmp(weekday,"Friday") - || (year != 2021) ||(day != 1)) - { - return -1; - } - return 0; -} - -#include -static void test_sscanf(void) -{ - uassert_int_equal(sscanf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_sscanf); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.sscanf.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/vfprintf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/vfprintf_tc.c deleted file mode 100644 index 046cdbb284..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/vfprintf_tc.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include - -static void WriteFrmtd(FILE *stream ,char *format, ...) -{ - va_list args; - - va_start(args, format); - vfprintf(stream, format, args); - va_end(args); -} - -static int vfprintf_entry(void) -{ - int ret = 0; - char buf[64] = {0}; - char test_data[] = "vfprintf test:2021-8-1 3.14 0xff"; - FILE *stream = fopen("fopen_file.txt", "w"); - if(stream) - { - WriteFrmtd(stream, "vfprintf test:%s-%d-%c %.02f 0x%x","2021" ,8 ,'1' ,3.14 ,0xff); - fclose(stream); - - stream = fopen("fopen_file.txt","r"); - fread(buf, 1, sizeof(test_data), stream); - if(strcmp(buf, test_data)) - { - ret = -1; - } - fclose(stream); - } - else - { - ret = -1; - } - - return ret; -} - -#include -static void test_vfprintf(void) -{ - uassert_int_equal(vfprintf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_vfprintf); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/vprintf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/vprintf_tc.c deleted file mode 100644 index 1d290df9a9..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/vprintf_tc.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include - -static void WriteFrmtd(char *format, ...) -{ - va_list args; - - va_start(args, format); - vprintf(format, args); - va_end(args); -} - -static int vprintf_entry(void) -{ - WriteFrmtd("vprintf test:%s-%d-%c %.02f 0x%x\n","2021" ,8 ,'1' ,3.14 ,0xff); - return 0; -} - -#include -static void test_vprintf(void) -{ - uassert_int_equal(vprintf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_vprintf); -} -UTEST_TC_EXPORT(testcase, "posix.stdio_h.vprintf.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/vsnprintf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/vsnprintf_tc.c deleted file mode 100644 index b09f272b1d..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/vsnprintf_tc.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include - -static char buf[64] = {0}; -static void WriteFrmtd(char *format, ...) -{ - va_list args; - - va_start(args, format); - vsnprintf(buf, 22, format, args); - va_end(args); -} - -static int vsnprintf_entry(void) -{ - char buf[64] = {0}; - char test_data[] = "vsnprintf test:2021-8"; - snprintf(buf, 22,"vsnprintf test:%s-%d-%c %.02f 0x%x","2021" ,8 ,'1' ,3.14 ,0xff); - - if(strcmp(buf, test_data)) - { - return -1; - } - return 0; -} - -#include -static void test_vsnprintf(void) -{ - uassert_int_equal(vsnprintf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_vsnprintf); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdio_h/functions/vsprintf_tc.c b/examples/utest/testcases/posix/stdio_h/functions/vsprintf_tc.c deleted file mode 100644 index aa70bd695d..0000000000 --- a/examples/utest/testcases/posix/stdio_h/functions/vsprintf_tc.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include - -static char buf[64] = {0}; -static void WriteFrmtd(char *format, ...) -{ - va_list args; - - va_start(args, format); - vsprintf(buf, format, args); - va_end(args); -} - -static int vsprintf_entry(void) -{ - char buf[64] = {0}; - char test_data[] = "vsprintf test:2021-8-1 3.14 0xff"; - sprintf(buf, "vsprintf test:%s-%d-%c %.02f 0x%x","2021" ,8 ,'1' ,3.14 ,0xff); - - if(strcmp(buf, test_data)) - { - return -1; - } - return 0; -} - -#include -static void test_vsprintf(void) -{ - uassert_int_equal(vsprintf_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_vsprintf); -} -UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdlib_h/Kconfig b/examples/utest/testcases/posix/stdlib_h/Kconfig deleted file mode 100644 index 6436ac106f..0000000000 --- a/examples/utest/testcases/posix/stdlib_h/Kconfig +++ /dev/null @@ -1,23 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_STDLIB_H - bool "" - default n - -if RTT_POSIX_TESTCASE_STDLIB_H - - config STDLIB_H_ATOI - bool " -> atoi" - default n - - config STDLIB_H_ATOL - bool " -> atol" - default n - - config STDLIB_H_QSORT - bool " -> qsort" - default n - - config STDLIB_H_STRTOL - bool " -> strtol" - default n - -endif diff --git a/examples/utest/testcases/posix/stdlib_h/SConscript b/examples/utest/testcases/posix/stdlib_h/SConscript deleted file mode 100644 index 54130ca46f..0000000000 --- a/examples/utest/testcases/posix/stdlib_h/SConscript +++ /dev/null @@ -1,27 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() -path = [cwd] -src = [] - -if GetDepend('RTT_POSIX_TESTCASE_STDLIB_H'): - src += Glob('./definitions/*.c') - -if GetDepend('STDLIB_H_ATOI'): - src += Glob('./functions/atoi_tc.c') - -if GetDepend('STDLIB_H_ATOL'): - src += Glob('./functions/atol_tc.c') - -if GetDepend('STDLIB_H_QSORT'): - src += Glob('./functions/qsort_tc.c') - -if GetDepend('STDLIB_H_STRTOL'): - src += Glob('./functions/strtol_tc.c') - -group = DefineGroup('rtt_posix_testcase', src, depend = ['RTT_POSIX_TESTCASE_STDLIB_H'], CPPPATH = path) - -Return('group') diff --git a/examples/utest/testcases/posix/stdlib_h/definitions/stdlib_h.c b/examples/utest/testcases/posix/stdlib_h/definitions/stdlib_h.c deleted file mode 100644 index a7bca062d7..0000000000 --- a/examples/utest/testcases/posix/stdlib_h/definitions/stdlib_h.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - - /* test if stdlib.h exists and can be included */ - -// #define _POSIX_C_SOURCE 200809L - -#include -#include - -#ifndef __compar_fn_t_defined -#define __compar_fn_t_defined -typedef int (*__compar_fn_t) (const void *, const void *); -#endif - -void (*test_abort)(void); -int (*test_abs)(int); -double (*test_atof)(const char *__nptr); -int (*test_atoi)(const char *__nptr); -long (*test_atol)(const char *__nptr); -long long (*test_atoll)(const char *__nptr); -void * (*test_bsearch)(const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar); -void * (*test_calloc)(size_t, size_t); -div_t (*test_div)(int __numer, int __denom); -void (*test_free)(void *); -char * (*test_getenv)(const char *__string); -long (*test_labs)(long); -ldiv_t (*test_ldiv)(long __numer, long __denom); -void * (*test_malloc)(size_t); -void (*test_qsort)(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar); -int (*test_rand)(void); -int (*test_rand_r)(unsigned *__seed); -void * (*test_realloc)(void *, size_t); -int (*test_setenv)(const char *__string, const char *__value, int __overwrite); -void (*test_srand)(unsigned __seed); -double (*test_strtod)(const char *__restrict __n, char **__restrict __end_PTR); -float (*test_strtof)(const char *__restrict __n, char **__restrict __end_PTR); -long (*test_strtol)(const char *__restrict __n, char **__restrict __end_PTR, int __base); -long double (*test_strtold)(const char *__restrict, char **__restrict); -long long (*test_strtoll)(const char *__restrict __n, char **__restrict __end_PTR, int __base); -unsigned long (*test_strtoul)(const char *__restrict __n, char **__restrict __end_PTR, int __base); -unsigned long long (*test_strtoull)(const char *__restrict __n, char **__restrict __end_PTR, int __base); -int (*test_unsetenv)(const char *__string); - - - -__attribute__((unused)) static int test_defined() -{ - test_abort = abort; - test_abs = abs; - test_atof = atof; - test_atoi = atoi; - test_atol = atol; - test_atoll = atoll; - test_bsearch = bsearch; - test_calloc = calloc; - test_div = div; - test_free = free; - test_getenv = getenv; - test_labs = labs; - test_ldiv = ldiv; - test_malloc = malloc; - test_qsort = qsort; - test_rand = rand; - // test_rand_r = rand_r; - test_realloc = realloc; - // test_setenv = setenv; - test_srand = srand; - test_strtod = strtod; - test_strtof = strtof; - test_strtol = strtol; - test_strtold = strtold; - test_strtoll = strtoll; - test_strtoul = strtoul; - test_strtoull = strtoull; - // test_unsetenv = unsetenv; - - return 0; -} - diff --git a/examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c b/examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c deleted file mode 100644 index 540d297cb0..0000000000 --- a/examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include -#include - -struct atoi_data -{ - char string[15]; // int max 2147483647 - int ret_num; -}; - -struct atoi_data test_data[] = -{ - /* positive integer */ - {"0", 0}, - {"1", 1}, - {"1.123", 1}, - {"123", 123}, - {"98993489", 98993489}, - {"98993489.12", 98993489}, - {"2147483647", 2147483647}, - - /* negtive integer */ - {"-1", -1}, - {"-1.123", -1}, - {"-123", -123}, - {"-98993489", -98993489}, - {"-98993489.12", -98993489}, - {"-2147483647", -2147483647}, - - /* letters and numbers */ - {"12a45", 12}, - {"-12a45", -12}, - {"12/45", 12}, - {"-12/45", -12}, - - /* cannot be resolved */ - {"", 0}, - {" ", 0}, - {"abc12", 0}, - {" abc12", 0}, - /* {NULL, -1} compiler warning */ -}; - -#include -int atoi_entry(void) -{ - int i = 0; - int res = 0; - for (i = 0; i < sizeof(test_data) / sizeof(test_data[0]); i++) - { - res = atoi(test_data[i].string); - uassert_int_equal(res, test_data[i].ret_num); - } - return 0; -} - -static void test_atoi(void) -{ - atoi_entry(); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_atoi); -} -UTEST_TC_EXPORT(testcase, "posix.stdlib_h.atoi_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c b/examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c deleted file mode 100644 index 18567920b8..0000000000 --- a/examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include -#include - - - -struct atol_data -{ - char string[15]; // long max 2147483647 - int ret_num; -}; - -struct atol_data test_data1[] = -{ - /* positive integer */ - {"0", 0}, - {"1", 1}, - {"1.123", 1}, - {"123", 123}, - {"98993489", 98993489}, - {"98993489.12", 98993489}, - {"2147483647", 2147483647}, - - /* negtive integer */ - {"-1", -1}, - {"-1.123", -1}, - {"-123", -123}, - {"-98993489", -98993489}, - {"-98993489.12", -98993489}, - {"-2147483647", -2147483647}, - - /* letters and numbers */ - {"12a45", 12}, - {"-12a45", -12}, - {"12/45", 12}, - {"-12/45", -12}, - - /* cannot be resolved */ - {"", 0}, - {" ", 0}, - {"abc12", 0}, - {" abc12", 0}, - /* {NULL, -1} compiler warning */ -}; - -#include -int atol_entry(void) -{ - int i = 0; - int res = 0; - for (i = 0; i < sizeof(test_data1) / sizeof(test_data1[0]); i++) - { - res = atol(test_data1[i].string); - uassert_int_equal(res, test_data1[i].ret_num); - } - return 0; -} - -static void test_atol(void) -{ - atol_entry(); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_atol); -} -UTEST_TC_EXPORT(testcase, "posix.stdlib_h.atol_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdlib_h/functions/qsort_tc.c b/examples/utest/testcases/posix/stdlib_h/functions/qsort_tc.c deleted file mode 100644 index 5b00749a47..0000000000 --- a/examples/utest/testcases/posix/stdlib_h/functions/qsort_tc.c +++ /dev/null @@ -1,136 +0,0 @@ -#include -#include -#include -#include - -#include - -static int scmp(const void *a, const void *b) -{ - return strcmp(*(char **)a, *(char **)b); -} - -static int icmp(const void *a, const void *b) -{ - return *(int *)a - *(int *)b; -} - -static int ccmp(const void *a, const void *b) -{ - return *(char *)a - *(char *)b; -} - -/** - * static int cmp64(const void *a, const void *b) - * { - * const uint64_t *ua = a, *ub = b; - * return *ua < *ub ? -1 : *ua != *ub; - * } - */ - -/* 26 items -- even */ -static const char *s[] = -{ - "Bob", "Alice", "John", "Ceres", - "Helga", "Drepper", "Emeralda", "Zoran", - "Momo", "Frank", "Pema", "Xavier", - "Yeva", "Gedun", "Irina", "Nono", - "Wiener", "Vincent", "Tsering", "Karnica", - "Lulu", "Quincy", "Osama", "Riley", - "Ursula", "Sam" -}; -static const char *s_sorted[] = -{ - "Alice", "Bob", "Ceres", "Drepper", - "Emeralda", "Frank", "Gedun", "Helga", - "Irina", "John", "Karnica", "Lulu", - "Momo", "Nono", "Osama", "Pema", - "Quincy", "Riley", "Sam", "Tsering", - "Ursula", "Vincent", "Wiener", "Xavier", - "Yeva", "Zoran" -}; - -/* 23 items -- odd, prime */ -static int n[] = -{ - 879045, 394, 99405644, 33434, 232323, 4334, 5454, - 343, 45545, 454, 324, 22, 34344, 233, 45345, 343, - 848405, 3434, 3434344, 3535, 93994, 2230404, 4334 -}; -static int n_sorted[] = -{ - 22, 233, 324, 343, 343, 394, 454, 3434, - 3535, 4334, 4334, 5454, 33434, 34344, 45345, 45545, - 93994, 232323, 848405, 879045, 2230404, 3434344, 99405644 -}; - -static void str_test(const char **a, const char **a_sorted, int len) -{ - int i; - qsort(a, len, sizeof * a, scmp); - for (i = 0; i < len; i++) - { - uassert_true(strcmp(a[i], a_sorted[i]) == 0); - } -} - -static void int_test(int *a, int *a_sorted, int len) -{ - int i; - qsort(a, len, sizeof * a, icmp); - for (i = 0; i < len; i++) - { - uassert_true(a[i] == a_sorted[i]); - } -} - -#define T(a, a_sorted) do { \ - char p[] = a; \ - qsort(p, sizeof p - 1, 1, ccmp); \ - uassert_true(memcmp(p, a_sorted, sizeof p) == 0);\ -} while(0) - -static void char_test(void) -{ - T("", ""); - T("1", "1"); - T("11", "11"); - T("12", "12"); - T("21", "12"); - T("111", "111"); - T("211", "112"); - T("121", "112"); - T("112", "112"); - T("221", "122"); - T("212", "122"); - T("122", "122"); - T("123", "123"); - T("132", "123"); - T("213", "123"); - T("231", "123"); - T("321", "123"); - T("312", "123"); - T("1423", "1234"); - T("51342", "12345"); - T("261435", "123456"); - T("4517263", "1234567"); - T("37245618", "12345678"); - T("812436597", "123456789"); - T("987654321", "123456789"); - T("321321321", "111222333"); - T("49735862185236174", "11223344556677889"); -} - -void posix_testcase(void) -{ - str_test(s, s_sorted, sizeof s / sizeof * s); - int_test(n, n_sorted, sizeof n / sizeof * n); - char_test(); - /* todo uint64 test */ -} -static void testcase(void) -{ - UTEST_UNIT_RUN(posix_testcase); -} -UTEST_TC_EXPORT(testcase, "posix.stdlib_h.qsort_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/stdlib_h/functions/strtol_tc.c b/examples/utest/testcases/posix/stdlib_h/functions/strtol_tc.c deleted file mode 100644 index 747ed5666a..0000000000 --- a/examples/utest/testcases/posix/stdlib_h/functions/strtol_tc.c +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include -#include -#include - -#define TEST(r, f, x, m) uassert_int_equal(f, x) -#define TEST2(r, f, x, m) uassert_int_equal(f, x) -#define TEST3(r, f, x, m) uassert_int_not_equal(f, x) - -#include -#define ERANGE 34 -#define EINVAL 22 - -int strtol_entry(void) -{ - __attribute__((unused)) int i; - __attribute__((unused)) long l; - __attribute__((unused)) unsigned long ul; - __attribute__((unused)) long long ll; - __attribute__((unused)) unsigned long long ull; - __attribute__((unused)) char *msg = ""; - __attribute__((unused)) char *s, *c; - - TEST(l, atol("2147483647"), 2147483647L, "max 32bit signed %ld != %ld"); - TEST(l, strtol("2147483647", 0, 0), 2147483647L, "max 32bit signed %ld != %ld"); - TEST(ul, strtoul("4294967295", 0, 0), 4294967295UL, "max 32bit unsigned %lu != %lu"); - - if (sizeof(long) == 4) - { - TEST(l, strtol(s = "2147483648", &c, 0), 2147483647L, "uncaught overflow %ld != %ld"); - TEST2(i, c - s, 10, "wrong final position %d != %d"); - TEST(l, strtol(s = "-2147483649", &c, 0), -2147483647L - 1, "uncaught overflow %ld != %ld"); - TEST2(i, c - s, 11, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "4294967296", &c, 0), 4294967295UL, "uncaught overflow %lu != %lu"); - TEST2(i, c - s, 10, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-1", &c, 0), -1UL, "rejected negative %lu != %lu"); - TEST2(i, c - s, 2, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-2", &c, 0), -2UL, "rejected negative %lu != %lu"); - TEST2(i, c - s, 2, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-2147483648", &c, 0), -2147483648UL, "rejected negative %lu != %lu"); - TEST2(i, c - s, 11, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-2147483649", &c, 0), -2147483649UL, "rejected negative %lu != %lu"); - TEST2(i, c - s, 11, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-4294967296", &c, 0), 4294967295UL, "uncaught negative overflow %lu != %lu"); - TEST2(i, c - s, 11, "wrong final position %d != %d"); - } - else if (sizeof(long) == 8) - { - TEST(l, strtol(s = "9223372036854775808", &c, 0), 9223372036854775807L, "uncaught overflow %ld != %ld"); - TEST2(i, c - s, 19, "wrong final position %d != %d"); - TEST(l, strtol(s = "-9223372036854775809", &c, 0), -9223372036854775807L - 1, "uncaught overflow %ld != %ld"); - TEST2(i, c - s, 20, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "18446744073709551616", &c, 0), 18446744073709551615UL, "uncaught overflow %lu != %lu"); - TEST2(i, c - s, 20, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-1", &c, 0), -1UL, "rejected negative %lu != %lu"); - TEST2(i, c - s, 2, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-2", &c, 0), -2UL, "rejected negative %lu != %lu"); - TEST2(i, c - s, 2, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-9223372036854775808", &c, 0), -9223372036854775808UL, "rejected negative %lu != %lu"); - TEST2(i, c - s, 20, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-9223372036854775809", &c, 0), -9223372036854775809UL, "rejected negative %lu != %lu"); - TEST2(i, c - s, 20, "wrong final position %d != %d"); - TEST(ul, strtoul(s = "-18446744073709551616", &c, 0), 18446744073709551615UL, "uncaught negative overflow %lu != %lu"); - TEST2(i, c - s, 21, "wrong final position %d != %d"); - } - else - { - printf("sizeof(long) == %d, not implemented\n", (int)sizeof(long)); - } - - if (sizeof(long long) == 8) - { - TEST(ll, strtoll(s = "9223372036854775808", &c, 0), 9223372036854775807LL, "uncaught overflow %lld != %lld"); - TEST2(i, c - s, 19, "wrong final position %d != %d"); - TEST(ll, strtoll(s = "-9223372036854775809", &c, 0), -9223372036854775807LL - 1, "uncaught overflow %lld != %lld"); - TEST2(i, c - s, 20, "wrong final position %d != %d"); - TEST(ull, strtoull(s = "18446744073709551616", &c, 0), 18446744073709551615ULL, "uncaught overflow %llu != %llu"); - TEST2(i, c - s, 20, "wrong final position %d != %d"); - TEST(ull, strtoull(s = "-1", &c, 0), -1ULL, "rejected negative %llu != %llu"); - TEST2(i, c - s, 2, "wrong final position %d != %d"); - TEST(ull, strtoull(s = "-2", &c, 0), -2ULL, "rejected negative %llu != %llu"); - TEST2(i, c - s, 2, "wrong final position %d != %d"); - TEST(ull, strtoull(s = "-9223372036854775808", &c, 0), -9223372036854775808ULL, "rejected negative %llu != %llu"); - TEST2(i, c - s, 20, "wrong final position %d != %d"); - TEST(ull, strtoull(s = "-9223372036854775809", &c, 0), -9223372036854775809ULL, "rejected negative %llu != %llu"); - TEST2(i, c - s, 20, "wrong final position %d != %d"); - TEST(ull, strtoull(s = "-18446744073709551616", &c, 0), 18446744073709551615ULL, "uncaught negative overflow %llu != %llu"); - TEST2(i, c - s, 21, "wrong final position %d != %d"); - } - else - { - printf("sizeof(long long) == %d, not implemented\n", (int)sizeof(long long)); - } - - TEST(l, strtol("z", 0, 36), 35L, "%ld != %ld"); - TEST(l, strtol("00010010001101000101011001111000", 0, 2), 0x12345678L, "%ld != %ld"); - TEST(l, strtol(s = "0F5F", &c, 16), 0x0f5fL, "%ld != %ld"); - - TEST(l, strtol(s = "0xz", &c, 16), 0L, "%ld != %ld"); - TEST2(i, c - s, 1, "wrong final position %ld != %ld"); - - TEST(l, strtol(s = "0x1234", &c, 16), 0x1234, "%ld != %ld"); - TEST2(i, c - s, 6, "wrong final position %ld != %ld"); - - c = NULL; - TEST3(l, strtol(s = "123", &c, 36), 0, "%ld != %ld"); - TEST3(i, c - s, 0, "wrong final position %d != %d"); - - TEST(l, strtol(s = " 15437", &c, 8), 015437, "%ld != %ld"); - TEST2(i, c - s, 7, "wrong final position %d != %d"); - - TEST(l, strtol(s = " 1", &c, 0), 1, "%ld != %ld"); - TEST2(i, c - s, 3, "wrong final position %d != %d"); - return 0; -} -static void test_strtol(void) -{ - strtol_entry(); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_strtol); -} -UTEST_TC_EXPORT(testcase, "posix.stdlib_h.strtol_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/string_h/Kconfig b/examples/utest/testcases/posix/string_h/Kconfig deleted file mode 100644 index b80f4df9a7..0000000000 --- a/examples/utest/testcases/posix/string_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_STRING_H - bool "" - default n - -if RTT_POSIX_TESTCASE_STRING_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/stropts_h/Kconfig b/examples/utest/testcases/posix/stropts_h/Kconfig deleted file mode 100644 index ef4f3831b3..0000000000 --- a/examples/utest/testcases/posix/stropts_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_STROPTS_H - bool "" - default n - -if RTT_POSIX_TESTCASE_STROPTS_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/sys/Kconfig b/examples/utest/testcases/posix/sys/Kconfig deleted file mode 100644 index 9692ae1aa1..0000000000 --- a/examples/utest/testcases/posix/sys/Kconfig +++ /dev/null @@ -1,3 +0,0 @@ -rsource "mman_h/Kconfig" -rsource "shm_h/Kconfig" -rsource "utsname_h/Kconfig" diff --git a/examples/utest/testcases/posix/sys/mman_h/Kconfig b/examples/utest/testcases/posix/sys/mman_h/Kconfig deleted file mode 100644 index 995e364366..0000000000 --- a/examples/utest/testcases/posix/sys/mman_h/Kconfig +++ /dev/null @@ -1,31 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SYS_MMAN_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SYS_MMAN_H - - config MMAN_H_MLOCK - bool " -> mlock" - default n - - config MMAN_H_MMAP - bool " -> mmap" - default n - - config MMAN_H_MPROTECT - bool " -> mprotect" - default n - - config MMAN_H_MSYNC - bool " -> msync" - default n - - config MMAN_H_MUNLOCK - bool " -> munlock" - default n - - config MMAN_H_MUNMAP - bool " -> munmap" - default n - -endif diff --git a/examples/utest/testcases/posix/sys/select_h/Kconfig b/examples/utest/testcases/posix/sys/select_h/Kconfig deleted file mode 100644 index f00b3f2b43..0000000000 --- a/examples/utest/testcases/posix/sys/select_h/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SYS_SHM_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SYS_SELECT_H - - config SELECT_H_SELECT - bool " -> select" - default n - -endif diff --git a/examples/utest/testcases/posix/sys/shm_h/Kconfig b/examples/utest/testcases/posix/sys/shm_h/Kconfig deleted file mode 100644 index fe479e7673..0000000000 --- a/examples/utest/testcases/posix/sys/shm_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SYS_SHM_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SYS_SHM_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/sys/socket_h/Kconfig b/examples/utest/testcases/posix/sys/socket_h/Kconfig deleted file mode 100644 index 065f80e698..0000000000 --- a/examples/utest/testcases/posix/sys/socket_h/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SYS_SOCKET_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SYS_SOCKET_H - - config SOCKET_H_SELECT - bool " -> socket, accept, listen...." - default n - -endif diff --git a/examples/utest/testcases/posix/sys/stat_h/Kconfig b/examples/utest/testcases/posix/sys/stat_h/Kconfig deleted file mode 100644 index 4d2601cc15..0000000000 --- a/examples/utest/testcases/posix/sys/stat_h/Kconfig +++ /dev/null @@ -1,23 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SYS_STAT_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SYS_STAT_H - - config STAT_H_CHMOD - bool " -> chmod" - default n - - config STAT_H_FCHMOD - bool " -> fchmod" - default n - - config STAT_H_FSTAT - bool " -> fstat" - default n - - config STAT_H_LSTAT - bool " -> lstat" - default n - -endif diff --git a/examples/utest/testcases/posix/sys/statvfs_h/Kconfig b/examples/utest/testcases/posix/sys/statvfs_h/Kconfig deleted file mode 100644 index f84d96b522..0000000000 --- a/examples/utest/testcases/posix/sys/statvfs_h/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SYS_STATVFS_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SYS_STATVFS_H - - config STATVFS_H_STATVFS - bool " -> statvfs" - default n - -endif diff --git a/examples/utest/testcases/posix/sys/uio_h/Kconfig b/examples/utest/testcases/posix/sys/uio_h/Kconfig deleted file mode 100644 index 81be35d629..0000000000 --- a/examples/utest/testcases/posix/sys/uio_h/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SYS_UIO_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SYS_UIO_H - - config UIO_H_READV - bool " -> readv" - default n - - config UIO_H_WRITEV - bool " -> writev" - default n - -endif diff --git a/examples/utest/testcases/posix/sys/utsname_h/Kconfig b/examples/utest/testcases/posix/sys/utsname_h/Kconfig deleted file mode 100644 index 62e13d1628..0000000000 --- a/examples/utest/testcases/posix/sys/utsname_h/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_SYS_UTSNAME_H - bool "" - default n - -if RTT_POSIX_TESTCASE_SYS_UTSNAME_H - - # functions, TODO - -endif diff --git a/examples/utest/testcases/posix/time_h/Kconfig b/examples/utest/testcases/posix/time_h/Kconfig deleted file mode 100644 index 365fcc86aa..0000000000 --- a/examples/utest/testcases/posix/time_h/Kconfig +++ /dev/null @@ -1,55 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_TIME_H - bool "" - default n - -if RTT_POSIX_TESTCASE_TIME_H - - config TIME_H_ASCTIME - bool " -> asctime" - default n - - config TIME_H_CLOCK_GETTIME - bool " -> clock_gettime" - default n - - config TIME_H_CLOCK - bool " -> clock" - default n - - config TIME_H_DIFFTIME - bool " -> difftime" - default n - - config TIME_H_GMTIME_R - bool " -> gmtime_r" - default n - - config TIME_H_GMTIME - bool " -> gmtime" - default n - - config TIME_H_LOCALTIME - bool " -> localtime" - default n - - config TIME_H_MKTIME - bool " -> mktime" - default n - - config TIME_H_NANOSLEEP - bool " -> nanosleep" - default n - - config TIME_H_STRFTIME - bool " -> strftime" - default n - - config TIME_H_TIME - bool " -> time" - default n - - config TIME_H_UTIMES - bool " -> utimes" - default n - -endif diff --git a/examples/utest/testcases/posix/unistd_h/Kconfig b/examples/utest/testcases/posix/unistd_h/Kconfig deleted file mode 100644 index ef6c0684d7..0000000000 --- a/examples/utest/testcases/posix/unistd_h/Kconfig +++ /dev/null @@ -1,27 +0,0 @@ -menuconfig RTT_POSIX_TESTCASE_UNISTD_H - bool "" - default n - -if RTT_POSIX_TESTCASE_UNISTD_H - - config UNISTD_H_ACCESS - bool " -> access" - default n - config UNISTD_H_CHDIR - bool " -> chdir" - default n - - config UNISTD_H_FTRUNCATE - bool " -> ftruncate" - default n - config UNISTD_H_ISATTY - bool " -> isatty" - default n - - config UNISTD_H_FSYNC - bool " -> fsync" - default n - config UNISTD_H_RMDIR - bool " -> rmdir" - default n -endif diff --git a/examples/utest/testcases/posix/unistd_h/SConscript b/examples/utest/testcases/posix/unistd_h/SConscript deleted file mode 100644 index bf3668e794..0000000000 --- a/examples/utest/testcases/posix/unistd_h/SConscript +++ /dev/null @@ -1,33 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() -path = [cwd] -src = [] - -if GetDepend('RTT_POSIX_TESTCASE_UNISTD_H'): - src += Glob('./definitions/*.c') - -if GetDepend('UNISTD_H_ACCESS'): - src += Glob('./functions/access_tc.c') - -if GetDepend('UNISTD_H_CHDIR'): - src += Glob('./functions/chdir_tc.c') - -if GetDepend('UNISTD_H_FTRUNCATE'): - src += Glob('./functions/ftruncate_tc.c') - -if GetDepend('UNISTD_H_ISATTY'): - src += Glob('./functions/isatty_tc.c') - -if GetDepend('UNISTD_H_FSYNC'): - src += Glob('./functions/open_read_write_fsync_close_tc.c') - -if GetDepend('UNISTD_H_RMDIR'): - src += Glob('./functions/rmdir_tc.c') - -group = DefineGroup('rtt_posix_testcase', src, depend = ['RTT_POSIX_TESTCASE_UNISTD_H'], CPPPATH = path) - -Return('group') diff --git a/examples/utest/testcases/posix/unistd_h/functions/access_tc.c b/examples/utest/testcases/posix/unistd_h/functions/access_tc.c deleted file mode 100644 index 696d1bc4b6..0000000000 --- a/examples/utest/testcases/posix/unistd_h/functions/access_tc.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include -#include - -#define ACCESS_DIR "./access_dir" - -#include -static int access_entry(void) -{ - int i = 0; - - /* file/dir that not exist*/ - char *files[] = - { - "/usr/local/nginx/conf/nginx.conf", - "./a.out", - "/usr/include/libgen.h", - "/ff/last", - NULL - }; - - for (i = 0; files[i] != NULL; i++) - { - /* mode=0: file/dir exist or not */ - uassert_int_not_equal(access(files[i], 0), 0); - } - - mkdir(ACCESS_DIR, 0x777); - uassert_int_equal(access(ACCESS_DIR, 0), 0); - return 0; -} - -static void test_access(void) -{ - uassert_int_equal(access_entry(), 0); -} - -static void testcase(void) -{ - UTEST_UNIT_RUN(test_access); -} -UTEST_TC_EXPORT(testcase, "posix.unistd_h.access_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/unistd_h/functions/chdir_tc.c b/examples/utest/testcases/posix/unistd_h/functions/chdir_tc.c deleted file mode 100644 index 3eaac44c65..0000000000 --- a/examples/utest/testcases/posix/unistd_h/functions/chdir_tc.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include -#include -#include - -#define NEW_CURR_DIR "./chdir_test" - -static int chdir_entry(void) -{ - __attribute__((unused)) long path_max; - size_t size; - char *buf; - char *ptr; - - __attribute__((unused)) char *old_dir; - - size = 1024; - - for (buf = ptr = NULL; ptr == NULL; size *= 2) - { - if ((buf = realloc(buf, size)) == NULL) - { - printf("error\n"); - } - ptr = getcwd(buf, size); - - if (ptr == NULL) - { - printf("error\n"); - } - else - { - printf("ptr %s\n",ptr); - printf("old curr dir is %s\n", ptr); - } - - mkdir(NEW_CURR_DIR, 0x777); - chdir(NEW_CURR_DIR); - - ptr = getcwd(buf, size); - if (ptr == NULL) - { - printf("error\n"); - } - else - { - printf("new curr dir is %s\n", ptr); - } - - } - free(buf); - return 0; -} - -#include -static void test_chdir(void) -{ - uassert_int_equal(chdir_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_chdir); -} -UTEST_TC_EXPORT(testcase, "posix.unistd_h.chdir_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/unistd_h/functions/ftruncate_tc.c b/examples/utest/testcases/posix/unistd_h/functions/ftruncate_tc.c deleted file mode 100644 index e1eb81842c..0000000000 --- a/examples/utest/testcases/posix/unistd_h/functions/ftruncate_tc.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include - -#define TRUN_SIZE 3 -#define TRUNCATE_TEST_NAME "./ftruncate_to3" - -static int ftruncate_entry(void) -{ - int res = 0; - int fd = 0; - - fd = open(TRUNCATE_TEST_NAME, O_RDWR | O_CREAT | O_APPEND); - if (fd < 0) - { - return -1; - } - - write(fd, "hello", 6); - /* TODO */ - res = ftruncate(fd, TRUN_SIZE); - close(fd); - return res; -} - -#include - -static void test_ftruncate(void) -{ - uassert_int_equal(ftruncate_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_ftruncate); -} -UTEST_TC_EXPORT(testcase, "posix.unistd_h.ftruncate_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/unistd_h/functions/isatty_tc.c b/examples/utest/testcases/posix/unistd_h/functions/isatty_tc.c deleted file mode 100644 index 47e34f4c8c..0000000000 --- a/examples/utest/testcases/posix/unistd_h/functions/isatty_tc.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#include -static void test_isatty(void) -{ - int i = 0; - - for (i = 0; i < 3; i++) /* 3: Number of terminals */ - { - uassert_int_equal(isatty(i), 1); - } - for (i = 3; i < 32; i++) /* 32: DFS_FD_MAX */ - { - uassert_int_equal(isatty(i), 0); - } -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_isatty); -} -UTEST_TC_EXPORT(testcase, "posix.unistd_h.isatty_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/unistd_h/functions/open_read_write_fsync_close_tc.c b/examples/utest/testcases/posix/unistd_h/functions/open_read_write_fsync_close_tc.c deleted file mode 100644 index 28470b1f6f..0000000000 --- a/examples/utest/testcases/posix/unistd_h/functions/open_read_write_fsync_close_tc.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include - -#define FILE_TEST_NAME "./rw_file_test.txt" -#define FILE_TEST_LENGTH(x) sizeof(x) - - -/* close read write fsync*/ -static int open_read_write_fsync_close_entry(void) -{ - __attribute__((unused)) int res = 0; - int size = 0; - int fd = 0; - char s[] = "RT-Thread Programmer!"; - char buffer[30]; - - printf("the data is: %s\n", s); - - fd = open(FILE_TEST_NAME, O_RDWR | O_CREAT | O_APPEND); - if (fd < 0) - { - printf("rw_entry open error\n"); - return -1; - } - write(fd, s, FILE_TEST_LENGTH(s)); - - /* write -> read */ - read(fd,buffer,FILE_TEST_LENGTH(s)); - printf("the read content is %s\n ",buffer); - - /* write -> fsync -> read */ - if(fsync(fd)!=0) - { - printf("fync failed\n "); - return -1; - } - - read(fd,buffer,FILE_TEST_LENGTH(s)); - printf("the fync read content is %s\n ",buffer); - - close(fd); - - /* close -> open -> read */ - fd = open(FILE_TEST_NAME, O_RDONLY); - if (fd>= 0) - { - size = read(fd, buffer, sizeof(buffer)); - close(fd); - printf("Read from file test.txt : %s \n", buffer); - if (size < 0) - return -1; - } - return 0; -} - -#include -static void test_open_read_write_fsync_close(void) -{ - uassert_int_equal(open_read_write_fsync_close_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_open_read_write_fsync_close); -} -UTEST_TC_EXPORT(testcase, "posix.unistd_h.open_read_write_fsync_close_tc.c", RT_NULL, RT_NULL, 10); - diff --git a/examples/utest/testcases/posix/unistd_h/functions/rmdir_tc.c b/examples/utest/testcases/posix/unistd_h/functions/rmdir_tc.c deleted file mode 100644 index f289ddf8f4..0000000000 --- a/examples/utest/testcases/posix/unistd_h/functions/rmdir_tc.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -#define RM_DIR "./rmdir" -static int rmdir_entry(void) -{ - int res = 0; - res = mkdir(RM_DIR, 0x777); - if(res != 0) - { - return -1; - } - - res = rmdir(RM_DIR); - if(res != 0) - { - return -1; - } - return res; -} - -#include -static void test_rmdir(void) -{ - uassert_int_equal(rmdir_entry(), 0); -} -static void testcase(void) -{ - UTEST_UNIT_RUN(test_rmdir); -} -UTEST_TC_EXPORT(testcase, "posix.unistd_h.rmdir_tc.c", RT_NULL, RT_NULL, 10); -