diff --git a/examples/fb/fb_main.c b/examples/fb/fb_main.c index 0eccf4b74e2..bd7d457e1c7 100644 --- a/examples/fb/fb_main.c +++ b/examples/fb/fb_main.c @@ -198,6 +198,7 @@ static int fb_init_mem2(FAR struct fb_state_s *state) int ret; uintptr_t buf_offset; struct fb_planeinfo_s pinfo; + FAR void *fbmem; memset(&pinfo, 0, sizeof(pinfo)); pinfo.display = state->pinfo.display + 1; @@ -207,6 +208,17 @@ static int fb_init_mem2(FAR struct fb_state_s *state) return EXIT_FAILURE; } + fbmem = mmap(NULL, pinfo.fblen, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_FILE, state->fd, 0); + + if (fbmem == MAP_FAILED) + { + int errcode = errno; + fprintf(stderr, "ERROR: ioctl(FBIOGET_PLANEINFO) failed: %d\n", + errcode); + return EXIT_FAILURE; + } + /* Check bpp */ if (pinfo.bpp != state->pinfo.bpp) @@ -219,7 +231,7 @@ static int fb_init_mem2(FAR struct fb_state_s *state) * It needs to be divisible by pinfo.stride */ - buf_offset = pinfo.fbmem - state->fbmem; + buf_offset = fbmem - state->fbmem; if ((buf_offset % state->pinfo.stride) != 0) { @@ -236,7 +248,7 @@ static int fb_init_mem2(FAR struct fb_state_s *state) /* Use consecutive fbmem2. */ state->mem2_yoffset = state->vinfo.yres; - state->fbmem2 = pinfo.fbmem + state->mem2_yoffset * pinfo.stride; + state->fbmem2 = fbmem + state->mem2_yoffset * pinfo.stride; printf("Use consecutive fbmem2 = %p, yoffset = %" PRIu32"\n", state->fbmem2, state->mem2_yoffset); } @@ -245,7 +257,7 @@ static int fb_init_mem2(FAR struct fb_state_s *state) /* Use non-consecutive fbmem2. */ state->mem2_yoffset = buf_offset / state->pinfo.stride; - state->fbmem2 = pinfo.fbmem; + state->fbmem2 = fbmem; printf("Use non-consecutive fbmem2 = %p, yoffset = %" PRIu32"\n", state->fbmem2, state->mem2_yoffset); } diff --git a/netutils/iperf/iperf.c b/netutils/iperf/iperf.c index cda61f68edc..5635443fd25 100644 --- a/netutils/iperf/iperf.c +++ b/netutils/iperf/iperf.c @@ -220,6 +220,7 @@ static void iperf_print_addr(FAR const char *str, FAR struct sockaddr *addr) { switch (addr->sa_family) { +#ifdef CONFIG_NET_IPv4 case AF_INET: { FAR struct sockaddr_in *inaddr = (FAR struct sockaddr_in *)addr; @@ -227,6 +228,7 @@ static void iperf_print_addr(FAR const char *str, FAR struct sockaddr *addr) inet_ntoa(inaddr->sin_addr), htons(inaddr->sin_port)); return; } +#endif case AF_LOCAL: { diff --git a/netutils/iperf/iperf_main.c b/netutils/iperf/iperf_main.c index 67ff3855ef0..b87a122bccc 100644 --- a/netutils/iperf/iperf_main.c +++ b/netutils/iperf/iperf_main.c @@ -140,7 +140,10 @@ int main(int argc, FAR char *argv[]) struct iperf_cfg_t cfg; struct in_addr addr; int nerrors; + +#ifdef CONFIG_NET_IPv4 char inetaddr[INET_ADDRSTRLEN]; +#endif bzero(&addr, sizeof(struct in_addr)); bzero(&cfg, sizeof(cfg)); @@ -226,6 +229,7 @@ int main(int argc, FAR char *argv[]) } else { +#ifdef CONFIG_NET_IPv4 if (iperf_args.bind->count > 0) { addr.s_addr = inet_addr(iperf_args.bind->sval[0]); @@ -248,6 +252,10 @@ int main(int argc, FAR char *argv[]) printf(" IP: %s\n", inet_ntoa_r(addr, inetaddr, sizeof(inetaddr))); cfg.sip = addr.s_addr; +#else + printf("ERROR: IPv4 Not Enabled\n"); + goto out; +#endif } if (iperf_args.udp->count == 0) diff --git a/system/libuv/CMakeLists.txt b/system/libuv/CMakeLists.txt index 4685da12fb9..12cde4fa749 100644 --- a/system/libuv/CMakeLists.txt +++ b/system/libuv/CMakeLists.txt @@ -106,10 +106,13 @@ if(CONFIG_LIBUV) ${LIBUV_UNIX_DIR}/fs.c ${LIBUV_SRC_DIR}/fs-poll.c ${LIBUV_SRC_DIR}/timer.c - ${LIBUV_UNIX_DIR}/process-spawn.c ${LIBUV_UNIX_DIR}/sysinfo-loadavg.c ${LIBUV_UNIX_DIR}/sysinfo-memory.c) + if(CONFIG_LIBC_EXECFUNCS) + list(APPEND SRCS ${LIBUV_UNIX_DIR}/process-spawn.c) + endif() + if(CONFIG_LIBC_DLFCN) list(APPEND SRCS ${LIBUV_UNIX_DIR}/dl.c) endif() diff --git a/testing/drivers/drivertest/drivertest_pm_smp.c b/testing/drivers/drivertest/drivertest_pm_smp.c index db3d70257e5..41115d18f65 100644 --- a/testing/drivers/drivertest/drivertest_pm_smp.c +++ b/testing/drivers/drivertest/drivertest_pm_smp.c @@ -46,9 +46,9 @@ #define TEST_PM_LOOP_COUNT 5 -#define TEST_STAYTIMEOUT 2 /* in ms */ +#define TEST_STAYTIMEOUT 20 /* in ms */ -#define TEST_SNAP_TICK_MAX 3 +#define TEST_SNAP_TICK_MAX 5 #define TEST_TIMEOUT_ENABLED 1 diff --git a/testing/drivers/drivertest/drivertest_uart.c b/testing/drivers/drivertest/drivertest_uart.c index fb19a980e42..24714386194 100644 --- a/testing/drivers/drivertest/drivertest_uart.c +++ b/testing/drivers/drivertest/drivertest_uart.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,7 @@ struct test_confs_s struct test_state_s { FAR const char *dev_path; + struct termios devtio; /* Original serial port setting */ FAR char *buffer; int fd; }; @@ -170,6 +172,8 @@ static int setup(FAR void **state) { FAR struct test_confs_s *confs = (FAR struct test_confs_s *)*state; FAR struct test_state_s *test_state = malloc(sizeof(struct test_state_s)); + struct termios ti; + int ret = 0; assert_true(test_state != NULL); test_state->dev_path = confs->dev_path; @@ -180,6 +184,16 @@ static int setup(FAR void **state) test_state->fd = open(test_state->dev_path, O_RDWR); assert_true(test_state->fd > 0); + ret = tcgetattr(test_state->fd, &ti); + assert_int_equal(ret, OK); + + /* Backup and enable data to be processed as raw input */ + + memcpy(&test_state->devtio, &ti, sizeof(struct termios)); + cfmakeraw(&ti); + ret = tcsetattr(test_state->fd, TCSANOW, &ti); + assert_int_equal(ret, OK); + *state = test_state; return 0; } @@ -191,6 +205,12 @@ static int setup(FAR void **state) static int teardown(FAR void **state) { FAR struct test_state_s *test_state = (FAR struct test_state_s *)*state; + int ret = 0; + + /* Retrieve termios updated flags */ + + ret = tcsetattr(test_state->fd, TCSANOW, &test_state->devtio); + assert_int_equal(ret, OK); free(test_state->buffer); assert_int_equal(close(test_state->fd), 0); diff --git a/testing/ostest/Kconfig b/testing/ostest/Kconfig index 98b54f101a4..83054fa688a 100644 --- a/testing/ostest/Kconfig +++ b/testing/ostest/Kconfig @@ -53,7 +53,7 @@ endif config TESTING_OSTEST_RR_RANGE int "Round-robin test - end of search range" - default 10000 + default 30000 range 1 32767 ---help--- During round-robin scheduling test two threads are created. Each of the threads @@ -62,7 +62,7 @@ config TESTING_OSTEST_RR_RANGE This value specifies the end of search range and together with number of runs allows to configure the length of this test - it should last at least a few - tens of seconds. Allowed values [1; 32767], default 10000 + tens of seconds. Allowed values [1; 32767], default 30000 config TESTING_OSTEST_RR_RUNS int "Round-robin test - number of runs" diff --git a/testing/ostest/roundrobin.c b/testing/ostest/roundrobin.c index c74bbc1f0c7..ed2f98ddbba 100644 --- a/testing/ostest/roundrobin.c +++ b/testing/ostest/roundrobin.c @@ -66,6 +66,8 @@ * Private Data ****************************************************************************/ +static uint8_t g_rr_values[CONFIG_TESTING_OSTEST_RR_RUNS * 2]; +static atomic_t g_rr_value_index; static sem_t g_rrsem; /**************************************************************************** @@ -132,6 +134,7 @@ static FAR void *get_primes_thread(FAR void *parameter) for (i = 0; i < CONFIG_TESTING_OSTEST_RR_RUNS; i++) { get_primes(&count, &last); + g_rr_values[atomic_fetch_add(&g_rr_value_index, 1)] = id; } printf("get_primes_thread id=%d finished, found %d primes, " @@ -154,11 +157,16 @@ void rr_test(void) pthread_t get_primes1_thread; pthread_t get_primes2_thread; struct sched_param sparam; + bool test_passed = false; pthread_attr_t attr; pthread_addr_t result; +#ifdef CONFIG_SMP + cpu_set_t cpuset; +#endif int status; + int i; - /* Setup common thread attrributes */ + /* Setup common thread attributes */ status = pthread_attr_init(&attr); if (status != OK) @@ -194,9 +202,25 @@ void rr_test(void) printf("rr_test: Set thread policy to SCHED_RR\n"); } +#ifdef CONFIG_SMP + /* RR case on SMP only run on core0 */ + + CPU_ZERO(&cpuset); + CPU_SET(0, &cpuset); + status = pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset); + if (status != OK) + { + printf("rr_test: ERROR: pthread_attr_setaffinity_np failed," + " status=%d\n", status); + ASSERT(false); + } +#endif + /* This semaphore will prevent anything from running until we are ready */ sched_lock(); + atomic_set(&g_rr_value_index, 0); + memset(g_rr_values, 0, sizeof(g_rr_values)); sem_init(&g_rrsem, 0, 0); /* Start the threads */ @@ -235,7 +259,26 @@ void rr_test(void) pthread_join(get_primes2_thread, &result); pthread_join(get_primes1_thread, &result); - printf("rr_test: Done\n"); + + for (i = 1; i < CONFIG_TESTING_OSTEST_RR_RUNS; i++) + { + if (g_rr_values[i - 1] != g_rr_values[i]) + { + test_passed = true; + break; + } + } + + if (test_passed) + { + printf("rr_test: Done\n"); + } + else + { + printf("rr_test: Roundrobin Failed\n"); + ASSERT(false); + } + sem_destroy(&g_rrsem); } diff --git a/testing/testsuites/kernel/fs/cases/fs_stat_test.c b/testing/testsuites/kernel/fs/cases/fs_stat_test.c index 6a4bfb00cb2..2afb114e019 100644 --- a/testing/testsuites/kernel/fs/cases/fs_stat_test.c +++ b/testing/testsuites/kernel/fs/cases/fs_stat_test.c @@ -88,18 +88,9 @@ void test_nuttx_fs_stat01(FAR void **state) struct tm *tm_1 = NULL; struct tm *tm_2 = NULL; - int year1; - int year2; - int month1; - int month2; - int day1; - int day2; - int hour1; - int hour2; - int min1; - int min2; time_t t_1; time_t t_2; + time_t t_diff; struct fs_testsuites_state_s *test_state; test_state = (struct fs_testsuites_state_s *)*state; @@ -127,14 +118,6 @@ void test_nuttx_fs_stat01(FAR void **state) tm_1 = gmtime(&t_1); assert_non_null(tm_1); - /* set time */ - - year1 = tm_1->tm_year; - month1 = tm_1->tm_mon; - day1 = tm_1->tm_mday; - hour1 = tm_1->tm_hour; - min1 = tm_1->tm_min; - /* get file info */ ret = stat(TEST_FILE, &file_s); @@ -144,23 +127,17 @@ void test_nuttx_fs_stat01(FAR void **state) t_2 = file_s.st_mtime; tm_2 = gmtime(&t_2); - assert_non_null(tm_2); - /* set time */ + /* compare time */ + + t_diff = t_2 - t_1; + + /* tolerance for 30s for worst case */ - year2 = tm_2->tm_year; - month2 = tm_2->tm_mon; - day2 = tm_2->tm_mday; - hour2 = tm_2->tm_hour; - min2 = tm_2->tm_min; + assert_int_in_range(t_diff, -30, 30); - /* compare time and size */ + /* compare size */ - assert_int_equal(year1, year2); - assert_int_equal(month1, month2); - assert_int_equal(day1, day2); - assert_int_equal(hour1, hour2); - assert_int_equal(min1, min2); assert_int_equal(file_s.st_size, BUF_SIZE); } diff --git a/testing/testsuites/kernel/syscall/cmocka_syscall_test.c b/testing/testsuites/kernel/syscall/cmocka_syscall_test.c index e1fceb592ba..70b1c592f79 100644 --- a/testing/testsuites/kernel/syscall/cmocka_syscall_test.c +++ b/testing/testsuites/kernel/syscall/cmocka_syscall_test.c @@ -161,6 +161,7 @@ int main(int argc, char *argv[]) test_nuttx_syscall_getpeername01, test_nuttx_syscall_test_group_setup, test_nuttx_syscall_test_group_teardown), +# ifdef CONFIG_NET_IPv4 cmocka_unit_test_setup_teardown( test_nuttx_syscall_getsockopt01, test_nuttx_syscall_test_group_setup, @@ -175,6 +176,7 @@ int main(int argc, char *argv[]) test_nuttx_syscall_setsockopt01, test_nuttx_syscall_test_group_setup, test_nuttx_syscall_test_group_teardown), +# endif cmocka_unit_test_setup_teardown( test_nuttx_syscall_listen01, test_nuttx_syscall_test_group_setup,