]> granicus.if.org Git - strace/commitdiff
tests: add utimensat test variants with different xlat verbosity levels
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 25 Aug 2018 23:30:15 +0000 (01:30 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 2 Sep 2018 17:44:26 +0000 (17:44 +0000)
* tests/utimensat-Xabbrev.c: New file.
* tests/utimensat-Xraw.c: Likewise.
* tests/utimensat-Xverbose.c: Likewise.
* tests/utimensat.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/pure_executables.list: Add utimensat-Xabbrev, utimensat-Xraw,
and utimensat-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (utimensat-Xabbrev, utimensat-Xraw, utimensat-Xverbose): New
tests.

tests/.gitignore
tests/gen_tests.in
tests/pure_executables.list
tests/utimensat-Xabbrev.c [new file with mode: 0644]
tests/utimensat-Xraw.c [new file with mode: 0644]
tests/utimensat-Xverbose.c [new file with mode: 0644]
tests/utimensat.c

index 3b662b60fe212b81fbbab84fbf66262e33c8b2de..a7f201ee2bf1fb4f14a128e3b65f13d9bb248dfd 100644 (file)
@@ -551,6 +551,9 @@ userfaultfd
 ustat
 utime
 utimensat
+utimensat-Xabbrev
+utimensat-Xraw
+utimensat-Xverbose
 utimes
 vfork-f
 vhangup
index 6744e556e4f92ab63120738c6c07c91171d7fd6b..16638970d5fb43e62864fbe254c828e4401cd0b0 100644 (file)
@@ -484,6 +484,9 @@ userfaultfd -a38
 ustat  -a33
 utime  -a16
 utimensat      -a33
+utimensat-Xabbrev      -a33 -Xabbrev -e trace=utimensat
+utimensat-Xraw -a29 -Xraw -e trace=utimensat
+utimensat-Xverbose     -a44 -Xverbose -e trace=utimensat
 utimes -a17
 vfork-f        -a26 -qq -f -e signal=none -e trace=chdir
 vhangup        -a10
index 0d19b75efa672604efbb42169199e6d1d52e10a4..361984aa5de28a98bccd8644da8b6e16d5431179 100755 (executable)
@@ -455,6 +455,9 @@ userfaultfd
 ustat
 utime
 utimensat
+utimensat-Xabbrev
+utimensat-Xraw
+utimensat-Xverbose
 utimes
 vhangup
 vmsplice
diff --git a/tests/utimensat-Xabbrev.c b/tests/utimensat-Xabbrev.c
new file mode 100644 (file)
index 0000000..77a4ca0
--- /dev/null
@@ -0,0 +1 @@
+#include "utimensat.c"
diff --git a/tests/utimensat-Xraw.c b/tests/utimensat-Xraw.c
new file mode 100644 (file)
index 0000000..5cd1f01
--- /dev/null
@@ -0,0 +1,2 @@
+#define XLAT_RAW 1
+#include "utimensat.c"
diff --git a/tests/utimensat-Xverbose.c b/tests/utimensat-Xverbose.c
new file mode 100644 (file)
index 0000000..cbcceae
--- /dev/null
@@ -0,0 +1,2 @@
+#define XLAT_VERBOSE 1
+#include "utimensat.c"
index ddfd3601022979e990707c137586135c147ec7a8..0d3c7586742b3706fbb2e9edcea7e07421b39477 100644 (file)
 
 #if defined __NR_utimensat && defined UTIME_NOW && defined UTIME_OMIT
 
+#if SIZEOF_KERNEL_LONG_T == 4
+#  define big_tv_sec "-559038737"
+#  define huge_tv_sec "-559038737"
+# else
+#  define big_tv_sec "3735928559"
+#  define huge_tv_sec "-3819351491602432273"
+# endif
+
+# if XLAT_RAW
+#  define str_at_fdcwd                 "-100"
+#  define str_at_symlink_nofollow      "0x100"
+#  define str_at_removedir             "0x200"
+#  define str_flags1                   "0x600"
+#  define str_flags2                   "0xffffffff"
+#  define str_utime_now_omit \
+       "[{tv_sec=" big_tv_sec ", tv_nsec=1073741823}, " \
+       "{tv_sec=" huge_tv_sec ", tv_nsec=1073741822}]"
+# elif XLAT_VERBOSE
+#  define str_at_fdcwd                 "-100 /* AT_FDCWD */"
+#  define str_at_symlink_nofollow      "0x100 /* AT_SYMLINK_NOFOLLOW */"
+#  define str_at_removedir             "0x200 /* AT_REMOVEDIR */"
+#  define str_flags1 \
+       "0x600 /* AT_REMOVEDIR|AT_SYMLINK_FOLLOW */"
+#  define str_flags2 \
+       "0xffffffff /* AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW" \
+       "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff */"
+#  define str_utime_now_omit \
+       "[{tv_sec=" big_tv_sec ", tv_nsec=1073741823} /* UTIME_NOW */, " \
+       "{tv_sec=" huge_tv_sec ", tv_nsec=1073741822} /* UTIME_OMIT */]"
+# else
+#  define str_at_fdcwd                 "AT_FDCWD"
+#  define str_at_symlink_nofollow      "AT_SYMLINK_NOFOLLOW"
+#  define str_at_removedir             "AT_REMOVEDIR"
+#  define str_flags1                   "AT_REMOVEDIR|AT_SYMLINK_FOLLOW"
+#  define str_flags2 \
+       "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW" \
+       "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff"
+#  define str_utime_now_omit           "[UTIME_NOW, UTIME_OMIT]"
+# endif
+
 static void
 print_ts(const struct timespec *ts)
 {
@@ -85,36 +125,36 @@ main(void)
               (int) bogus_fd, qname, errstr);
 
        k_utimensat(-100U, kfname, 0, 0);
-       printf("utimensat(AT_FDCWD, %s, NULL, 0) = %s\n", qname, errstr);
+       printf("utimensat(" str_at_fdcwd ", %s, NULL, 0) = %s\n", qname, errstr);
 
        k_utimensat(kfdcwd, kfname, 0, 0);
-       printf("utimensat(AT_FDCWD, %s, NULL, 0) = %s\n", qname, errstr);
+       printf("utimensat(" str_at_fdcwd ", %s, NULL, 0) = %s\n", qname, errstr);
 
        /* pathname */
        k_utimensat(kfdcwd, 0, 0, 0);
-       printf("utimensat(AT_FDCWD, NULL, NULL, 0) = %s\n", errstr);
+       printf("utimensat(" str_at_fdcwd ", NULL, NULL, 0) = %s\n", errstr);
 
        k_utimensat(kfdcwd, kfname + sizeof(proto_fname) - 1, 0, 0);
-       printf("utimensat(AT_FDCWD, \"\", NULL, 0) = %s\n", errstr);
+       printf("utimensat(" str_at_fdcwd ", \"\", NULL, 0) = %s\n", errstr);
 
        fname[sizeof(proto_fname) - 1] = '+';
        k_utimensat(kfdcwd, kfname, 0, 0);
        fname[sizeof(proto_fname) - 1] = '\0';
-       printf("utimensat(AT_FDCWD, %p, NULL, 0) = %s\n", fname, errstr);
+       printf("utimensat(" str_at_fdcwd ", %p, NULL, 0) = %s\n", fname, errstr);
 
        if (F8ILL_KULONG_SUPPORTED) {
                k_utimensat(kfdcwd, f8ill_ptr_to_kulong(fname), 0, 0);
-               printf("utimensat(AT_FDCWD, %#jx, NULL, 0) = %s\n",
+               printf("utimensat(" str_at_fdcwd ", %#jx, NULL, 0) = %s\n",
                       (uintmax_t) f8ill_ptr_to_kulong(fname), errstr);
        }
 
        /* times */
        k_utimensat(kfdcwd, kfname, (uintptr_t) (ts + 1), 0);
-       printf("utimensat(AT_FDCWD, %s, %p, 0) = %s\n",
+       printf("utimensat(" str_at_fdcwd ", %s, %p, 0) = %s\n",
               qname, ts + 1, errstr);
 
        k_utimensat(kfdcwd, kfname, (uintptr_t) (ts + 2), 0);
-       printf("utimensat(AT_FDCWD, %s, %p, 0)"
+       printf("utimensat(" str_at_fdcwd ", %s, %p, 0)"
               " = %s\n", qname, ts + 2, errstr);
 
        ts[0].tv_sec = 1492358706;
@@ -123,11 +163,11 @@ main(void)
        ts[1].tv_nsec = 234567890;
 
        k_utimensat(kfdcwd, kfname, (uintptr_t) ts, 0x100);
-       printf("utimensat(AT_FDCWD, %s, [", qname);
+       printf("utimensat(" str_at_fdcwd ", %s, [", qname);
        print_ts(&ts[0]);
        printf(", ");
        print_ts(&ts[1]);
-       printf("], AT_SYMLINK_NOFOLLOW) = %s\n", errstr);
+       printf("], " str_at_symlink_nofollow ") = %s\n", errstr);
 
        ts[0].tv_sec = -1;
        ts[0].tv_nsec = 2000000000;
@@ -135,11 +175,11 @@ main(void)
        ts[1].tv_nsec = 2345678900U;
 
        k_utimensat(kfdcwd, kfname, (uintptr_t) ts, 0x100);
-       printf("utimensat(AT_FDCWD, %s, [", qname);
+       printf("utimensat(" str_at_fdcwd ", %s, [", qname);
        print_ts(&ts[0]);
        printf(", ");
        print_ts(&ts[1]);
-       printf("], AT_SYMLINK_NOFOLLOW) = %s\n", errstr);
+       printf("], " str_at_symlink_nofollow ") = %s\n", errstr);
 
        ts[0].tv_sec = 0;
        ts[0].tv_nsec = 0;
@@ -147,11 +187,11 @@ main(void)
        ts[1].tv_nsec = 0;
 
        k_utimensat(kfdcwd, kfname, (uintptr_t) ts, 0x100);
-       printf("utimensat(AT_FDCWD, %s, [", qname);
+       printf("utimensat(" str_at_fdcwd ", %s, [", qname);
        print_ts(&ts[0]);
        printf(", ");
        print_ts(&ts[1]);
-       printf("], AT_SYMLINK_NOFOLLOW) = %s\n", errstr);
+       printf("], " str_at_symlink_nofollow ") = %s\n", errstr);
 
        ts[0].tv_sec = 0xdeadbeefU;
        ts[0].tv_nsec = 0xfacefeedU;
@@ -159,41 +199,40 @@ main(void)
        ts[1].tv_nsec = (long) 0xbadc0dedfacefeedLL;
 
        k_utimensat(kfdcwd, kfname, (uintptr_t) ts, 0x100);
-       printf("utimensat(AT_FDCWD, %s, [", qname);
+       printf("utimensat(" str_at_fdcwd ", %s, [", qname);
        print_ts(&ts[0]);
        printf(", ");
        print_ts(&ts[1]);
-       printf("], AT_SYMLINK_NOFOLLOW) = %s\n", errstr);
+       printf("], " str_at_symlink_nofollow ") = %s\n", errstr);
 
        ts[0].tv_nsec = UTIME_NOW;
        ts[1].tv_nsec = UTIME_OMIT;
        k_utimensat(kfdcwd, kfname, (uintptr_t) ts, 0x100);
-       printf("utimensat(AT_FDCWD, %s, [UTIME_NOW, UTIME_OMIT]"
-              ", AT_SYMLINK_NOFOLLOW) = %s\n", qname, errstr);
+       printf("utimensat(" str_at_fdcwd ", %s, " str_utime_now_omit
+              ", " str_at_symlink_nofollow ") = %s\n", qname, errstr);
 
        if (F8ILL_KULONG_SUPPORTED) {
                k_utimensat(kfdcwd, kfname, f8ill_ptr_to_kulong(ts), 0);
-               printf("utimensat(AT_FDCWD, %s, %#jx, 0) = %s\n",
+               printf("utimensat(" str_at_fdcwd ", %s, %#jx, 0) = %s\n",
                       qname, (uintmax_t) f8ill_ptr_to_kulong(ts), errstr);
        }
 
        /* flags */
        k_utimensat(kfdcwd, kfname, (uintptr_t) ts,
                    (kernel_ulong_t) 0xdefaced00000200);
-       printf("utimensat(AT_FDCWD, %s, [UTIME_NOW, UTIME_OMIT]"
-              ", AT_REMOVEDIR) = %s\n",
+       printf("utimensat(" str_at_fdcwd ", %s, " str_utime_now_omit
+              ", " str_at_removedir ") = %s\n",
               qname, errstr);
 
        k_utimensat(kfdcwd, kfname, (uintptr_t) ts,
                    (kernel_ulong_t) 0xdefaced00000600);
-       printf("utimensat(AT_FDCWD, %s, [UTIME_NOW, UTIME_OMIT]"
-              ", AT_REMOVEDIR|AT_SYMLINK_FOLLOW) = %s\n",
+       printf("utimensat(" str_at_fdcwd ", %s, " str_utime_now_omit
+              ", " str_flags1 ") = %s\n",
               qname, errstr);
 
        k_utimensat(kfdcwd, kfname, (uintptr_t) ts, (kernel_ulong_t) -1ULL);
-       printf("utimensat(AT_FDCWD, %s, [UTIME_NOW, UTIME_OMIT]"
-              ", AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW"
-              "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff) = %s\n",
+       printf("utimensat(" str_at_fdcwd ", %s, " str_utime_now_omit
+              ", " str_flags2 ") = %s\n",
               qname, errstr);
 
        puts("+++ exited with 0 +++");