On Sat, 2009-07-11 at 22:17 +0200, Jiri Palecek wrote: 
> Hello,
> 
> this adds some test cases for utimes(), among those one that actually should 
> return EACCESS.
> 
> Regards
>     Jiri Palecek
> 
> Signed-off-by: Jiri Palecek <[email protected]>

This one also fails probably because of the same reason:

patching file testcases/kernel/syscalls/utimes/utimes01.c
Hunk #1 succeeded at 145 (offset -14 lines).
Hunk #2 succeeded at 225 (offset -2 lines).
Hunk #3 succeeded at 272 with fuzz 1 (offset -7 lines).
Hunk #4 FAILED at 284.
Hunk #5 succeeded at 317 (offset 4 lines).
1 out of 5 hunks FAILED -- saving rejects to file
testcases/kernel/syscalls/utimes/utimes01.c.rej

Regards--
Subrata

> ---
>  testcases/kernel/syscalls/utimes/utimes01.c |   41 ++++++++++++++++++++------
>  1 files changed, 31 insertions(+), 10 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/utimes/utimes01.c 
> b/testcases/kernel/syscalls/utimes/utimes01.c
> index 2fddb99..370db5c 100644
> --- a/testcases/kernel/syscalls/utimes/utimes01.c
> +++ b/testcases/kernel/syscalls/utimes/utimes01.c
> @@ -159,6 +159,7 @@ enum test_type {
>               NORMAL,
>               FILE_NOT_EXIST,
>               NO_FNAME,
> +         NULL_TIMES
>  };
> 
> 
> @@ -226,6 +227,19 @@ static struct test_case tcase[] = {
>                  .ret            = -1,
>                  .err            = EFAULT,
>          },
> +        { // case05
> +                .ttype          = NULL_TIMES,
> +                .a_sec          = 1000,
> +                .m_sec          = 2000,
> +                .user           = "nobody",
> +                .ret            = -1,
> +                .err            = EACCES
> +        },
> +     { // case06
> +                .ttype          = NULL_TIMES,
> +                .ret            = 0,
> +                .err            = 0,
> +        },
>  };
> 
>  /*
> @@ -265,7 +279,8 @@ static int do_test(struct test_case *tc)
>                  fpath=FNAME_NX;
>          }
>          errno = 0;
> -        if (tc->ttype == NO_FNAME) {
> +        switch(tc->ttype) {
> +        case NO_FNAME:
>                  /**
>                   * Note (garrcoop):
>                   *
> @@ -276,12 +291,17 @@ static int do_test(struct test_case *tc)
>                   **/
>                  const char *dummy = NULL;
>                  TEST(sys_ret = utimes(dummy, tv));
> +                break;
> +        case NULL_TIMES:
> +                TEST(utimes(fpath, NULL));
> +                gettimeofday(tv, NULL);
> +                tv[1]=tv[0];
> +                break;
> +        default:
> +                TEST(utimes(fpath, tv));
> +                break;
>          }
> -     else
> -                TEST(sys_ret = utimes(fpath, tv));
> -        sys_errno = errno;
> -        if (sys_ret < 0)
> -                goto TEST_END;
> +        if(TEST_RETURN == 0) {
> 
>       /*
>           * Check test file's time stamp
> @@ -293,14 +313,15 @@ static int do_test(struct test_case *tc)
>                  goto EXIT1;
>          }
>          tst_resm(TINFO,"E:%ld,%ld <=> R:%ld,%ld",tv[0].tv_sec, tv[1].tv_sec, 
> st.st_atime, st.st_mtime);
> -        cmp_ok = st.st_atime == tv[0].tv_sec && st.st_mtime == tv[1].tv_sec;
> +        cmp_ok = abs( st.st_atime - tv[0].tv_sec ) <= 1 &&
> +                 abs( st.st_mtime - tv[1].tv_sec ) <= 1;
> 
> +        }
>          /*
>           * Check results
>           */
> -TEST_END:
> -        result |= (sys_errno != tc->err) || !cmp_ok;
> -        PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, 
> sys_errno,cmp_ok);
> +        result |= (TEST_ERRNO != tc->err) || !cmp_ok;
> +        PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, (int)TEST_RETURN, 
> (int)TEST_ERRNO, cmp_ok);
> 
>          /*
>           * Restore effective user id


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to