run timeout directly with out sh and check fork and execl returns
check returns in case fork or execl fail and report and abort approptiately. this should solve a always-timeout on some systems with some sh shells...
This commit is contained in:
parent
0d78dbadea
commit
a40ba25e05
|
@ -306,9 +306,9 @@ _efl_suite_wait_on_fork(int *num_forks, Eina_Bool *timeout)
|
||||||
ret = WEXITSTATUS(status);
|
ret = WEXITSTATUS(status);
|
||||||
else
|
else
|
||||||
ret = 1;
|
ret = 1;
|
||||||
if (pid == timeout_pid)
|
if ((timeout_pid > 0) && (pid == timeout_pid))
|
||||||
*timeout = EINA_TRUE;
|
*timeout = EINA_TRUE;
|
||||||
else
|
else if (timeout_pid > 0)
|
||||||
{
|
{
|
||||||
eina_hash_del_by_key(fork_map, &pid);
|
eina_hash_del_by_key(fork_map, &pid);
|
||||||
(*num_forks)--;
|
(*num_forks)--;
|
||||||
|
@ -374,8 +374,25 @@ _efl_suite_build_and_run(int argc, const char **argv, const char *suite_name, co
|
||||||
if (!timeout_pid)
|
if (!timeout_pid)
|
||||||
{
|
{
|
||||||
timeout_pid = fork();
|
timeout_pid = fork();
|
||||||
if (!timeout_pid)
|
if (timeout_pid == 0)
|
||||||
execl("/bin/sh", "/bin/sh", "-c", PACKAGE_BUILD_DIR "/src/tests/timeout", (char *)NULL);
|
{
|
||||||
|
int ret = execl(PACKAGE_BUILD_DIR "/src/tests/timeout",
|
||||||
|
(char *)NULL);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "EXECL %s TO RUN TIMEOUT!!!\n", PACKAGE_BUILD_DIR "/src/tests/timeout");
|
||||||
|
perror("EXECL");
|
||||||
|
fflush(stderr);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (timeout_pid < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "FORK TO RUN TIMEOUT TOOL FAILED!!!\n");
|
||||||
|
perror("FORK");
|
||||||
|
fflush(stderr);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (num_forks == eina_cpu_count())
|
if (num_forks == eina_cpu_count())
|
||||||
failed_count += _efl_suite_wait_on_fork(&num_forks, &timeout_reached);
|
failed_count += _efl_suite_wait_on_fork(&num_forks, &timeout_reached);
|
||||||
|
@ -392,6 +409,13 @@ _efl_suite_build_and_run(int argc, const char **argv, const char *suite_name, co
|
||||||
# endif
|
# endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (pid < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "FORK TO RUN TIMEOUT TOOL FAILED!!!\n");
|
||||||
|
perror("FORK");
|
||||||
|
fflush(stderr);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue