Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions testing/ostest/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void aio_test(void)

do
{
usleep(500 * 1000);
usleep(50 * 1000);
ret = check_done();
}
while (ret < 0);
Expand All @@ -333,7 +333,7 @@ void aio_test(void)
* task end of the last test case -- especially the dangling SIGPOLL.
*/

usleep(500 * 1000);
usleep(50 * 1000);

printf("AIO test case 2: Use LIO_WAIT for transfer complete\n");
g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC);
Expand Down Expand Up @@ -371,7 +371,7 @@ void aio_test(void)
* task end of the last test case -- especially the dangling SIGPOLL.
*/

usleep(500 * 1000);
usleep(50 * 1000);

printf("AIO test case 3: Use aio_suspend for transfer complete\n");
g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC);
Expand Down Expand Up @@ -439,7 +439,7 @@ void aio_test(void)
* task end of the last test case -- especially the dangling SIGPOLL.
*/

usleep(500 * 1000);
usleep(50 * 1000);

printf("AIO test case 4: Use individual signals for transfer complete\n");
g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC);
Expand Down Expand Up @@ -502,7 +502,7 @@ void aio_test(void)
* task end of the last test case -- especially the dangling SIGPOLL.
*/

usleep(500 * 1000);
usleep(50 * 1000);

printf("AIO test case 5:"
" Use list complete signal for transfer complete\n");
Expand Down Expand Up @@ -566,7 +566,7 @@ void aio_test(void)
* task end of the last test case -- especially the dangling SIGPOLL.
*/

usleep(500 * 1000);
usleep(50 * 1000);

printf("AIO test case 6: Cancel I/O by AIO control block\n");
g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC);
Expand Down Expand Up @@ -599,7 +599,7 @@ void aio_test(void)

do
{
usleep(500 * 1000);
usleep(50 * 1000);
ret = check_done();
}
while (ret < 0);
Expand All @@ -613,7 +613,7 @@ void aio_test(void)
* task end of the last test case -- especially the dangling SIGPOLL.
*/

usleep(500 * 1000);
usleep(50 * 1000);

printf("AIO test case 7:Cancel I/O by file descriptor\n");
g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC);
Expand Down Expand Up @@ -646,7 +646,7 @@ void aio_test(void)

do
{
usleep(500 * 1000);
usleep(50 * 1000);
ret = check_done();
}
while (ret < 0);
Expand Down
4 changes: 2 additions & 2 deletions testing/ostest/fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
#ifdef HAVE_FPU

#ifndef CONFIG_TESTING_OSTEST_FPULOOPS
# define CONFIG_TESTING_OSTEST_FPULOOPS 16
# define CONFIG_TESTING_OSTEST_FPULOOPS 8
#endif

#ifndef CONFIG_TESTING_OSTEST_FPUMSDELAY
# define CONFIG_TESTING_OSTEST_FPUMSDELAY 750
# define CONFIG_TESTING_OSTEST_FPUMSDELAY 10
#endif

#ifndef CONFIG_TESTING_OSTEST_FPUPRIORITY
Expand Down
6 changes: 3 additions & 3 deletions testing/ostest/posixtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ void timer_test(void)

printf("timer_test: Starting timer\n");

timer.it_value.tv_sec = 2;
timer.it_value.tv_sec = 1;
timer.it_value.tv_nsec = 0;
timer.it_interval.tv_sec = 2;
timer.it_interval.tv_sec = 1;
timer.it_interval.tv_nsec = 0;

status = timer_settime(timerid, 0, &timer, NULL);
Expand All @@ -219,7 +219,7 @@ void timer_test(void)

/* Take the semaphore */

for (i = 0; i < 5; i++)
for (i = 0; i < 3; i++)
{
printf("timer_test: Waiting on semaphore\n");
FFLUSH();
Expand Down
8 changes: 4 additions & 4 deletions testing/ostest/prioinherit.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static FAR void *highpri_thread(FAR void *parameter)

printf("highpri_thread-%d: Started\n", threadno);
FFLUSH();
sleep(1);
usleep(10 * 1000);

printf("highpri_thread-%d: Calling sem_wait()\n", threadno);
g_highstate[threadno - 1] = WAITING;
Expand Down Expand Up @@ -363,7 +363,7 @@ static FAR void *lowpri_thread(FAR void *parameter)
printf(" I still have a count on the semaphore\n");
sem_enumholders(&g_sem);
FFLUSH();
sleep(1);
usleep(10 * 1000);
}

/* Account for all of the semaphore counts. At any given time if there
Expand Down Expand Up @@ -574,7 +574,7 @@ void priority_inheritance(void)
}

printf("priority_inheritance: Waiting...\n");
sleep(2);
usleep(20 * 1000);
dump_nfreeholders("priority_inheritance:");

/* Start the medium priority thread */
Expand Down Expand Up @@ -615,7 +615,7 @@ void priority_inheritance(void)
}

printf("priority_inheritance: Waiting...\n");
sleep(1);
usleep(10 * 1000);
dump_nfreeholders("priority_inheritance:");

/* Start the high priority threads */
Expand Down
2 changes: 1 addition & 1 deletion testing/ostest/pthread_cleanup.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static void test_cleanup(void)
return;
}

usleep(500 * 1000);
usleep(50 * 1000);

status = pthread_cancel(thread1);
if (status != 0)
Expand Down
10 changes: 5 additions & 5 deletions testing/ostest/pthread_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ static FAR void *pthread_exit_thread(FAR void *parameter)
{
unsigned me = (unsigned)pthread_self();

printf("pthread_exit_thread %u: Sleeping for 10 second\n", me);
sleep(5);
printf("pthread_exit_thread %u: Sleeping for 100 ms\n", me);
usleep(50 * 1000);
printf("pthread_exit_thread %u: Still running...\n", me);
sleep(5);
usleep(50 * 1000);
printf("pthread_exit_thread %u: Exiting\n", me);
return NULL;
}
Expand All @@ -80,9 +80,9 @@ static FAR void *pthread_exit_main(FAR void *arg)
printf("Thread creation failed, return code %d", ret);
}

printf("pthread_exit_main %u: Sleeping for 5 seconds\n", me);
printf("pthread_exit_main %u: Sleeping for 50 ms\n", me);
fflush(stdout);
sleep(5);
usleep(50 * 1000);

printf("pthread_exit_main %u: Calling pthread_exit()\n", me);
pthread_exit(NULL);
Expand Down
6 changes: 3 additions & 3 deletions testing/ostest/pthread_rwlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static FAR void *timeout_thread2(FAR void *data)
pthread_yield();

status = clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += 2;
time.tv_sec += 1;

status = pthread_rwlock_timedwrlock(rc->rw_lock, &time);
if (status != ETIMEDOUT)
Expand All @@ -347,7 +347,7 @@ static FAR void *timeout_thread2(FAR void *data)
}

status = clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += 2;
time.tv_sec += 1;

status = pthread_rwlock_timedrdlock(rc->rw_lock, &time);
if (status != ETIMEDOUT)
Expand All @@ -357,7 +357,7 @@ static FAR void *timeout_thread2(FAR void *data)
}

status = clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += 2;
time.tv_sec += 10;

sem_post(rc->sem1);
status = pthread_rwlock_timedrdlock(rc->rw_lock, &time);
Expand Down
2 changes: 1 addition & 1 deletion testing/ostest/pthread_rwlock_cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static void test_timeout(void)

for (i = 0; i < 10; i++)
{
usleep(300 * 1000); /* Give threads few seconds to run */
usleep(30 * 1000); /* Give threads few seconds to run */
}

status = pthread_cancel(thread1);
Expand Down
49 changes: 21 additions & 28 deletions testing/ostest/restart.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,16 @@ static int restart_main(int argc, char *argv[])
}
#endif

/* Were we restarted? */
/* Let the main task restart */

switch (g_restartstep)
g_restartstep++;
sem_post(&g_sem);

/* Don't call printf here, to avoid recover sem failed during restart */

for (; ; )
{
case 0:
for (; ; )
{
sleep(2);
printf("restart_main: I am still here\n");
}
break;
case 1:
if (sem_wait(&g_sem) != 0)
{
printf("restart_main: ERROR thread sem_wait failed\n");
ASSERT(false);
}
break;
default:
break;
sleep(1);
}

return 0; /* Won't get here unless we were restarted */
Expand Down Expand Up @@ -192,11 +182,12 @@ void restart_test(void)

printf("restart_main: Started restart_main at PID=%d\n", pid);

/* Wait a bit and restart the task */
/* Check the child task result */

sleep(5);
sem_wait(&g_sem);
ASSERT(g_restartstep == 1);

g_restartstep = 1;
/* Restart the task */

ret = task_restart(pid);
if (ret < 0)
Expand All @@ -205,15 +196,14 @@ void restart_test(void)
ASSERT(false);
}

/* Start the task wait for a semaphore */

printf("restart_main: Started restart_main at PID=%d\n", pid);
/* Check the child task result */

/* Wait a bit and restart the task */
sem_wait(&g_sem);
ASSERT(g_restartstep == 2);

sleep(5);
printf("restart_main: Started restart_main at PID=%d\n", pid);

g_restartstep = 2;
/* Restart the task */

ret = task_restart(pid);
if (ret < 0)
Expand All @@ -222,7 +212,10 @@ void restart_test(void)
ASSERT(false);
}

sleep(1);
/* Check the child task result */

sem_wait(&g_sem);
ASSERT(g_restartstep == 3);
}

sem_destroy(&g_sem);
Expand Down
4 changes: 2 additions & 2 deletions testing/ostest/robust.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static FAR void *robust_waiter(FAR void *parameter)
printf("robust_waiter: Exiting with mutex\n");
}

sleep(2);
usleep(20 * 1000);
return NULL;
}

Expand Down Expand Up @@ -208,7 +208,7 @@ void robust_test(void)

do
{
sleep(1);
usleep(10 * 1000);
}
while (kill(waiter, 0) == 0 || errno != ESRCH);

Expand Down
2 changes: 1 addition & 1 deletion testing/ostest/schedlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void sched_lock_test(void)
}

printf("sched_lock: Waiting...\n");
sleep(1);
usleep(10 * 1000);

pthread_join(g_highpri, NULL);
pthread_join(g_lowpri, NULL);
Expand Down
4 changes: 2 additions & 2 deletions testing/ostest/semtimed.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ static void *poster_func(void *parameter)

/* Wait for one second, then post the semaphore */

printf("poster_func: Waiting for 1 second\n");
sleep(1);
printf("poster_func: Waiting for 10 ms\n");
usleep(10 * 1000);

printf("poster_func: Posting\n");
status = sem_post(&sem);
Expand Down
21 changes: 12 additions & 9 deletions testing/ostest/sighand.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,18 @@ void sighand_test(void)
printf("sighand_test: Started waiter_main pid=%d\n", waiterpid);
}

/* Wait a bit */
/* Wait the child thread enter sem_wait() */

FFLUSH();
sleep(2);
while (1)
{
usleep(1000);

sem_getvalue(&sem1, &status);
if (status < 0)
{
break;
}
}

/* Then signal the waiter thread. */

Expand All @@ -314,12 +322,7 @@ void sighand_test(void)

/* Wait a bit */

FFLUSH();
status = sleep(2);
while (status)
{
status = sleep(status);
}
usleep(2000);

/* Then check the result */

Expand Down
2 changes: 1 addition & 1 deletion testing/ostest/signest.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ void signest_test(void)
sem_post(&g_interferer_sem);
do
{
usleep(500 * 1000L);
usleep(50 * 1000L);
}
while (g_waiter_running || g_interferer_running);

Expand Down
Loading
Loading