Salut à tous
Dans le ltp -
posix test, il en est un exemple open_posix_testsuite \ conformité \ interfaces \ timer_gettime \ speculative/6-1.c
Citation:
# include <time.h>
# include <stdio.h>
# include <errno. h>
/ / # include "posixtest.h"
# define BOGUSTID 9999
int main (int argc, char * argv [])
(
timer_t tid;
struct itimerspec son;
tid \u003d (timer_t) BOGUSTID;
if (timer_gettime (tid, & sa) \u003d\u003d -1) (
if (\u003d\u003d EINVAL errno) (
printf ( "-1 et retourné fcn errno\u003d\u003d EINVAL \ n ");
/ / return PTS_PASS;
) Else (
printf ( "fcn retourné mais -1 errno! \u003d EINVAL \ n ");
printf ( "Test SUCCOMBE \ n");
/ / return PTS_FAIL;
)
)
printf ( "fcn n'a pas return -1 \ n");
/ / return PTS_PASS;
)
|
Je lance le code ci-dessus, il a un segment de la faute, si je le modifier ci-dessous, il fonctionne bien
Citation:
# include <time.h>
# include <stdio.h>
# include <errno. h>
/ / # include "posixtest.h"
# define BOGUSTID 9999
int main (int argc, char * argv [])
(
timer_t tid;
struct itimerspec son;
tval int \u003d BOGUSTID;
printf ( "% d \ n", tval);
tid \u003d (timer_t) &tval;
printf ( "% d \ n", tid);
if (timer_gettime (tid, & sa) \u003d\u003d -1) (
if (\u003d\u003d EINVAL errno) (
printf ( "-1 et retourné fcn errno\u003d\u003d EINVAL \ n ");
/ / return PTS_PASS;
) Else (
printf ( "fcn retourné mais -1 errno! \u003d EINVAL \ n ");
printf ( "Test SUCCOMBE \ n");
/ / return PTS_FAIL;
)
)
printf ( "fcn n'a pas return -1 \ n");
/ / Return PTS_PASS;
)
|
N'importe qui peut me dire pourquoi?