X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Futime.c;h=0c84ef8b5860c278ee2b65e0aeab5af41a380e09;hb=0bdf54969bce9b7336912c827c51860da88d3558;hp=8d8cd08dd3d22a806c0d0e5ebd2939be57631838;hpb=113303973ec9f8484eb2355a1a6ef3c4c7fd6a56;p=fs%2Flustre-release.git diff --git a/lustre/tests/utime.c b/lustre/tests/utime.c index 8d8cd08..0c84ef8 100644 --- a/lustre/tests/utime.c +++ b/lustre/tests/utime.c @@ -1,6 +1,41 @@ /* + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + * + * lustre/tests/utime.c + * * Simple test for validating mtime on a file create and set via utime. */ + #include #include #include @@ -29,9 +64,6 @@ int main(int argc, char *argv[]) int rc; int c; - utb.actime = 200000; - utb.modtime = 100000; - while ((c = getopt(argc, argv, "s:")) != -1) { switch(c) { case 's': @@ -67,9 +99,9 @@ int main(int argc, char *argv[]) } if (st.st_mtime < before_mknod || st.st_mtime > after_mknod) { - fprintf(stderr, - "%s: bad mknod times %lu <= %lu <= %lu false\n", - prog, before_mknod, st.st_mtime, after_mknod); + fprintf(stderr, "%s: bad mknod(%s) times %lu <= %lu <= " + "%lu false\n", prog, filename, before_mknod, + st.st_mtime, after_mknod); return 4; } @@ -89,9 +121,10 @@ int main(int argc, char *argv[]) if (st2.st_mtime < before_mknod || st2.st_mtime > after_mknod) { - fprintf(stderr, "%s: bad mknod times %lu <= %lu" - " <= %lu false\n", prog, before_mknod, - st2.st_mtime, after_mknod); + fprintf(stderr, "%s: bad mknod(%s) times %lu " + " <= %lu <= %lu false\n", prog, + filename, before_mknod, st2.st_mtime, + after_mknod); return 6; } @@ -102,7 +135,8 @@ int main(int argc, char *argv[]) } } - /* See above */ + utb.actime = 200000; + utb.modtime = 100000; rc = utime(filename, &utb); if (rc) { fprintf(stderr, "%s: utime(%s) failed: rc %d: %s\n", @@ -118,14 +152,14 @@ int main(int argc, char *argv[]) } if (st.st_mtime != utb.modtime ) { - fprintf(stderr, "%s: bad utime mtime %lu should be %lu\n", - prog, st.st_mtime, utb.modtime); + fprintf(stderr, "%s: bad utime mtime(%s) %lu should be %lu\n", + prog, filename, st.st_mtime, utb.modtime); return 9; } if (st.st_atime != utb.actime ) { - fprintf(stderr, "%s: bad utime atime %lu should be %lu\n", - prog, st.st_atime, utb.actime); + fprintf(stderr, "%s: bad utime atime(%s) %lu should be %lu\n", + prog, filename, st.st_atime, utb.actime); return 10; } @@ -144,14 +178,16 @@ int main(int argc, char *argv[]) } if (st2.st_mtime != st.st_mtime) { - fprintf(stderr, "%s: not synced mtime between clients: %lu " - "should be %lu\n", prog, st2.st_mtime, st.st_mtime); + fprintf(stderr, "%s: not synced mtime(%s) between clients: " + "%lu should be %lu\n", prog, secname, + st2.st_mtime, st.st_mtime); return 13; } if (st2.st_ctime != st.st_ctime) { - fprintf(stderr, "%s: not synced ctime between clients: %lu " - " should be %lu\n", prog, st2.st_ctime, st.st_ctime); + fprintf(stderr, "%s: not synced ctime(%s) between clients: " + "%lu should be %lu\n", prog, secname, + st2.st_ctime, st.st_ctime); return 14; }