diff options
| -rw-r--r-- | meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch | 176 | ||||
| -rw-r--r-- | meta/recipes-devtools/strace/strace/0001-arc-metag-nios2-or1k-tile-fix-build.patch | 117 | ||||
| -rw-r--r-- | meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch | 198 | ||||
| -rw-r--r-- | meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch | 306 | ||||
| -rw-r--r-- | meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch | 54 | ||||
| -rw-r--r-- | meta/recipes-devtools/strace/strace/update-gawk-paths.patch | 114 | ||||
| -rw-r--r-- | meta/recipes-devtools/strace/strace_4.12.bb (renamed from meta/recipes-devtools/strace/strace_4.11.bb) | 9 |
7 files changed, 63 insertions, 911 deletions
diff --git a/meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch b/meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch deleted file mode 100644 index aa61e15c81..0000000000 --- a/meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch +++ /dev/null | |||
| @@ -1,176 +0,0 @@ | |||
| 1 | From f32126ba790dd4e61d43a2140b24f02426297bb6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dmitry V. Levin" <ldv@altlinux.org> | ||
| 3 | Date: Thu, 31 Dec 2015 14:19:41 +0000 | ||
| 4 | Subject: [PATCH] Move gcc compat macros to gcc_compat.h | ||
| 5 | |||
| 6 | * defs.h: Include "gcc_compat.h". | ||
| 7 | (GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT, | ||
| 8 | ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC, | ||
| 9 | ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): Move ... | ||
| 10 | * gcc_compat.h: ... here. | ||
| 11 | * Makefile.am (strace_SOURCES): Add gcc_compat.h. | ||
| 12 | --- | ||
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 14 | Upstream-Status: Backport | ||
| 15 | |||
| 16 | Makefile.am | 1 + | ||
| 17 | defs.h | 43 +---------------------------------- | ||
| 18 | gcc_compat.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 19 | 3 files changed, 75 insertions(+), 42 deletions(-) | ||
| 20 | create mode 100644 gcc_compat.h | ||
| 21 | |||
| 22 | diff --git a/Makefile.am b/Makefile.am | ||
| 23 | index ab52778..d43608d 100644 | ||
| 24 | --- a/Makefile.am | ||
| 25 | +++ b/Makefile.am | ||
| 26 | @@ -97,6 +97,7 @@ strace_SOURCES = \ | ||
| 27 | flock.c \ | ||
| 28 | flock.h \ | ||
| 29 | futex.c \ | ||
| 30 | + gcc_compat.h \ | ||
| 31 | get_robust_list.c \ | ||
| 32 | getcpu.c \ | ||
| 33 | getcwd.c \ | ||
| 34 | diff --git a/defs.h b/defs.h | ||
| 35 | index 283ab1f..bae212c 100644 | ||
| 36 | --- a/defs.h | ||
| 37 | +++ b/defs.h | ||
| 38 | @@ -55,6 +55,7 @@ | ||
| 39 | #include <sys/syscall.h> | ||
| 40 | |||
| 41 | #include "mpers_type.h" | ||
| 42 | +#include "gcc_compat.h" | ||
| 43 | |||
| 44 | #ifndef HAVE_STRERROR | ||
| 45 | const char *strerror(int); | ||
| 46 | @@ -68,48 +69,6 @@ const char *strerror(int); | ||
| 47 | extern char *stpcpy(char *dst, const char *src); | ||
| 48 | #endif | ||
| 49 | |||
| 50 | -#if defined __GNUC__ && defined __GNUC_MINOR__ | ||
| 51 | -# define GNUC_PREREQ(maj, min) \ | ||
| 52 | - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | ||
| 53 | -#else | ||
| 54 | -# define __attribute__(x) /* empty */ | ||
| 55 | -# define GNUC_PREREQ(maj, min) 0 | ||
| 56 | -#endif | ||
| 57 | - | ||
| 58 | -#if GNUC_PREREQ(2, 5) | ||
| 59 | -# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) | ||
| 60 | -#else | ||
| 61 | -# define ATTRIBUTE_NORETURN /* empty */ | ||
| 62 | -#endif | ||
| 63 | - | ||
| 64 | -#if GNUC_PREREQ(2, 7) | ||
| 65 | -# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args)) | ||
| 66 | -# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg))) | ||
| 67 | -# define ATTRIBUTE_PACKED __attribute__((__packed__)) | ||
| 68 | -#else | ||
| 69 | -# define ATTRIBUTE_FORMAT(args) /* empty */ | ||
| 70 | -# define ATTRIBUTE_ALIGNED(arg) /* empty */ | ||
| 71 | -# define ATTRIBUTE_PACKED /* empty */ | ||
| 72 | -#endif | ||
| 73 | - | ||
| 74 | -#if GNUC_PREREQ(3, 0) | ||
| 75 | -# define ATTRIBUTE_MALLOC __attribute__((__malloc__)) | ||
| 76 | -#else | ||
| 77 | -# define ATTRIBUTE_MALLOC /* empty */ | ||
| 78 | -#endif | ||
| 79 | - | ||
| 80 | -#if GNUC_PREREQ(3, 1) | ||
| 81 | -# define ATTRIBUTE_NOINLINE __attribute__((__noinline__)) | ||
| 82 | -#else | ||
| 83 | -# define ATTRIBUTE_NOINLINE /* empty */ | ||
| 84 | -#endif | ||
| 85 | - | ||
| 86 | -#if GNUC_PREREQ(4, 3) | ||
| 87 | -# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args)) | ||
| 88 | -#else | ||
| 89 | -# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */ | ||
| 90 | -#endif | ||
| 91 | - | ||
| 92 | #ifndef offsetof | ||
| 93 | # define offsetof(type, member) \ | ||
| 94 | (((char *) &(((type *) NULL)->member)) - ((char *) (type *) NULL)) | ||
| 95 | diff --git a/gcc_compat.h b/gcc_compat.h | ||
| 96 | new file mode 100644 | ||
| 97 | index 0000000..1f2c835 | ||
| 98 | --- /dev/null | ||
| 99 | +++ b/gcc_compat.h | ||
| 100 | @@ -0,0 +1,73 @@ | ||
| 101 | +/* | ||
| 102 | + * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org> | ||
| 103 | + * All rights reserved. | ||
| 104 | + * | ||
| 105 | + * Redistribution and use in source and binary forms, with or without | ||
| 106 | + * modification, are permitted provided that the following conditions | ||
| 107 | + * are met: | ||
| 108 | + * 1. Redistributions of source code must retain the above copyright | ||
| 109 | + * notice, this list of conditions and the following disclaimer. | ||
| 110 | + * 2. Redistributions in binary form must reproduce the above copyright | ||
| 111 | + * notice, this list of conditions and the following disclaimer in the | ||
| 112 | + * documentation and/or other materials provided with the distribution. | ||
| 113 | + * 3. The name of the author may not be used to endorse or promote products | ||
| 114 | + * derived from this software without specific prior written permission. | ||
| 115 | + * | ||
| 116 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| 117 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| 118 | + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| 119 | + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 120 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 121 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 122 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 123 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 124 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 125 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 126 | + */ | ||
| 127 | + | ||
| 128 | +#ifndef GCC_COMPAT_H_ | ||
| 129 | +#define GCC_COMPAT_H_ | ||
| 130 | + | ||
| 131 | +#if defined __GNUC__ && defined __GNUC_MINOR__ | ||
| 132 | +# define GNUC_PREREQ(maj, min) \ | ||
| 133 | + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | ||
| 134 | +#else | ||
| 135 | +# define __attribute__(x) /* empty */ | ||
| 136 | +# define GNUC_PREREQ(maj, min) 0 | ||
| 137 | +#endif | ||
| 138 | + | ||
| 139 | +#if GNUC_PREREQ(2, 5) | ||
| 140 | +# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) | ||
| 141 | +#else | ||
| 142 | +# define ATTRIBUTE_NORETURN /* empty */ | ||
| 143 | +#endif | ||
| 144 | + | ||
| 145 | +#if GNUC_PREREQ(2, 7) | ||
| 146 | +# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args)) | ||
| 147 | +# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg))) | ||
| 148 | +# define ATTRIBUTE_PACKED __attribute__((__packed__)) | ||
| 149 | +#else | ||
| 150 | +# define ATTRIBUTE_FORMAT(args) /* empty */ | ||
| 151 | +# define ATTRIBUTE_ALIGNED(arg) /* empty */ | ||
| 152 | +# define ATTRIBUTE_PACKED /* empty */ | ||
| 153 | +#endif | ||
| 154 | + | ||
| 155 | +#if GNUC_PREREQ(3, 0) | ||
| 156 | +# define ATTRIBUTE_MALLOC __attribute__((__malloc__)) | ||
| 157 | +#else | ||
| 158 | +# define ATTRIBUTE_MALLOC /* empty */ | ||
| 159 | +#endif | ||
| 160 | + | ||
| 161 | +#if GNUC_PREREQ(3, 1) | ||
| 162 | +# define ATTRIBUTE_NOINLINE __attribute__((__noinline__)) | ||
| 163 | +#else | ||
| 164 | +# define ATTRIBUTE_NOINLINE /* empty */ | ||
| 165 | +#endif | ||
| 166 | + | ||
| 167 | +#if GNUC_PREREQ(4, 3) | ||
| 168 | +# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args)) | ||
| 169 | +#else | ||
| 170 | +# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */ | ||
| 171 | +#endif | ||
| 172 | + | ||
| 173 | +#endif | ||
| 174 | -- | ||
| 175 | 1.9.1 | ||
| 176 | |||
diff --git a/meta/recipes-devtools/strace/strace/0001-arc-metag-nios2-or1k-tile-fix-build.patch b/meta/recipes-devtools/strace/strace/0001-arc-metag-nios2-or1k-tile-fix-build.patch deleted file mode 100644 index a9d32037b0..0000000000 --- a/meta/recipes-devtools/strace/strace/0001-arc-metag-nios2-or1k-tile-fix-build.patch +++ /dev/null | |||
| @@ -1,117 +0,0 @@ | |||
| 1 | From dd1a80c8d213eed95fe55b7ebcb07ee165dd8e4b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dmitry V. Levin" <ldv@altlinux.org> | ||
| 3 | Date: Thu, 24 Dec 2015 15:40:55 +0000 | ||
| 4 | Subject: [PATCH] arc, metag, nios2, or1k, tile: fix build | ||
| 5 | |||
| 6 | Fix build regression introduced by commit | ||
| 7 | 34683e3926d8c2daa368afb805da422ee7043396. | ||
| 8 | |||
| 9 | * linux/32/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap. | ||
| 10 | * linux/arc/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap_pgoff. | ||
| 11 | * linux/nios2/syscallent.h: Likewise. | ||
| 12 | * linux/or1k/syscallent.h: Likewise. | ||
| 13 | * linux/tile/syscallent1.h: Add sys_ prefix to ARCH_mmap and sys_mmap_4koff. | ||
| 14 | * pathtrace.c (pathtrace_match): Handle SEN_ARCH_mmap. | ||
| 15 | * NEWS: Mention this build fix. | ||
| 16 | |||
| 17 | Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com> | ||
| 18 | Signed-off-by: Marek Vasut <marex@denx.de> | ||
| 19 | Upstream-Status: Backport | ||
| 20 | --- | ||
| 21 | NEWS | 3 +++ | ||
| 22 | linux/32/syscallent.h | 6 +++--- | ||
| 23 | linux/arc/syscallent.h | 2 +- | ||
| 24 | linux/nios2/syscallent.h | 2 +- | ||
| 25 | linux/or1k/syscallent.h | 2 +- | ||
| 26 | linux/tile/syscallent1.h | 2 +- | ||
| 27 | pathtrace.c | 1 + | ||
| 28 | 7 files changed, 11 insertions(+), 7 deletions(-) | ||
| 29 | |||
| 30 | diff --git a/NEWS b/NEWS | ||
| 31 | index fe40ca4..09263eb 100644 | ||
| 32 | --- a/NEWS | ||
| 33 | +++ b/NEWS | ||
| 34 | @@ -1,3 +1,9 @@ | ||
| 35 | +Noteworthy changes in release ?.?? (????-??-??) | ||
| 36 | +=============================================== | ||
| 37 | + | ||
| 38 | +* Bug fixes | ||
| 39 | + * Fixed build on arc, metag, nios2, or1k, and tile architectures. | ||
| 40 | + | ||
| 41 | Noteworthy changes in release 4.11 (2015-12-21) | ||
| 42 | =============================================== | ||
| 43 | |||
| 44 | diff --git a/linux/32/syscallent.h b/linux/32/syscallent.h | ||
| 45 | index 5f997e7..e6f895c 100644 | ||
| 46 | --- a/linux/32/syscallent.h | ||
| 47 | +++ b/linux/32/syscallent.h | ||
| 48 | @@ -1,5 +1,5 @@ | ||
| 49 | -#ifndef ARCH_mmap | ||
| 50 | -# define ARCH_mmap mmap | ||
| 51 | +#ifndef sys_ARCH_mmap | ||
| 52 | +# define sys_ARCH_mmap sys_mmap | ||
| 53 | #endif | ||
| 54 | [ 0] = { 2, 0, SEN(io_setup), "io_setup" }, | ||
| 55 | [ 1] = { 1, 0, SEN(io_destroy), "io_destroy" }, | ||
| 56 | @@ -276,5 +276,5 @@ | ||
| 57 | [283] = { 2, 0, SEN(membarrier), "membarrier", }, | ||
| 58 | [284] = { 3, TM, SEN(mlock2), "mlock2" }, | ||
| 59 | |||
| 60 | -#undef ARCH_mmap | ||
| 61 | +#undef sys_ARCH_mmap | ||
| 62 | #undef ARCH_WANT_SYNC_FILE_RANGE2 | ||
| 63 | diff --git a/linux/arc/syscallent.h b/linux/arc/syscallent.h | ||
| 64 | index 5847dc4..1100008 100644 | ||
| 65 | --- a/linux/arc/syscallent.h | ||
| 66 | +++ b/linux/arc/syscallent.h | ||
| 67 | @@ -1,4 +1,4 @@ | ||
| 68 | -#define ARCH_mmap mmap_pgoff | ||
| 69 | +#define sys_ARCH_mmap sys_mmap_pgoff | ||
| 70 | #include "32/syscallent.h" | ||
| 71 | [244] = { 3, 0, SEN(printargs), "arc_cacheflush"}, | ||
| 72 | [245] = { 1, 0, SEN(printargs), "arc_settls" }, | ||
| 73 | diff --git a/linux/nios2/syscallent.h b/linux/nios2/syscallent.h | ||
| 74 | index 8a4b70e..01efe3a 100644 | ||
| 75 | --- a/linux/nios2/syscallent.h | ||
| 76 | +++ b/linux/nios2/syscallent.h | ||
| 77 | @@ -1,4 +1,4 @@ | ||
| 78 | -#define ARCH_mmap mmap_pgoff | ||
| 79 | +#define sys_ARCH_mmap sys_mmap_pgoff | ||
| 80 | #include "32/syscallent.h" | ||
| 81 | [244] = {4, 0, SEN(cacheflush), "cacheflush"}, | ||
| 82 | [245 ... 259] = { }, | ||
| 83 | diff --git a/linux/or1k/syscallent.h b/linux/or1k/syscallent.h | ||
| 84 | index ed84b3b..351fe25 100644 | ||
| 85 | --- a/linux/or1k/syscallent.h | ||
| 86 | +++ b/linux/or1k/syscallent.h | ||
| 87 | @@ -1,4 +1,4 @@ | ||
| 88 | -#define ARCH_mmap mmap_pgoff | ||
| 89 | +#define sys_ARCH_mmap sys_mmap_pgoff | ||
| 90 | #include "32/syscallent.h" | ||
| 91 | [244] = { 3, NF, SEN(or1k_atomic), "or1k_atomic" }, | ||
| 92 | [245 ... 259] = { }, | ||
| 93 | diff --git a/linux/tile/syscallent1.h b/linux/tile/syscallent1.h | ||
| 94 | index c86f059..28dbab4 100644 | ||
| 95 | --- a/linux/tile/syscallent1.h | ||
| 96 | +++ b/linux/tile/syscallent1.h | ||
| 97 | @@ -1,4 +1,4 @@ | ||
| 98 | -#define ARCH_mmap mmap_4koff | ||
| 99 | +#define sys_ARCH_mmap sys_mmap_4koff | ||
| 100 | #define ARCH_WANT_SYNC_FILE_RANGE2 1 | ||
| 101 | #include "32/syscallent.h" | ||
| 102 | [244] = { 1, 0, SEN(printargs), "cmpxchg_badaddr" }, | ||
| 103 | diff --git a/pathtrace.c b/pathtrace.c | ||
| 104 | index d530ec2..e72cdf7 100644 | ||
| 105 | --- a/pathtrace.c | ||
| 106 | +++ b/pathtrace.c | ||
| 107 | @@ -216,6 +216,7 @@ pathtrace_match(struct tcb *tcp) | ||
| 108 | case SEN_mmap: | ||
| 109 | case SEN_mmap_4koff: | ||
| 110 | case SEN_mmap_pgoff: | ||
| 111 | + case SEN_ARCH_mmap: | ||
| 112 | /* x, x, x, x, fd */ | ||
| 113 | return fdmatch(tcp, tcp->u_arg[4]); | ||
| 114 | |||
| 115 | -- | ||
| 116 | 2.6.4 | ||
| 117 | |||
diff --git a/meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch b/meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch deleted file mode 100644 index c4e645b81f..0000000000 --- a/meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch +++ /dev/null | |||
| @@ -1,198 +0,0 @@ | |||
| 1 | From 3fdcdd47c6a67585123a0a0c8fffabcc9f79a3a2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dmitry V. Levin" <ldv@altlinux.org> | ||
| 3 | Date: Tue, 12 Jan 2016 14:47:12 +0000 | ||
| 4 | Subject: [PATCH] scm_rights-fd.test: rewrite without fork | ||
| 5 | |||
| 6 | * tests/scm_rights.c (main): Rewrite without fork. | ||
| 7 | Place all objects passed to sendmsg and recvmsg at the end | ||
| 8 | of memory pages followed by inaccessible pages. | ||
| 9 | * tests/scm_rights-fd.test: Update. | ||
| 10 | --- | ||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 12 | Upstream-Status: Backport | ||
| 13 | |||
| 14 | tests/scm_rights-fd.test | 12 ++--- | ||
| 15 | tests/scm_rights.c | 122 ++++++++++++++++++++++------------------------- | ||
| 16 | 2 files changed, 63 insertions(+), 71 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/tests/scm_rights-fd.test b/tests/scm_rights-fd.test | ||
| 19 | index a32ef36..48c5028 100755 | ||
| 20 | --- a/tests/scm_rights-fd.test | ||
| 21 | +++ b/tests/scm_rights-fd.test | ||
| 22 | @@ -49,18 +49,18 @@ touch -- "$file" || | ||
| 23 | framework_skip_ 'failed to create a file' | ||
| 24 | |||
| 25 | run_prog ./scm_rights /dev/zero | ||
| 26 | -run_strace_merge -y -x -enetwork $args "$file" | ||
| 27 | +run_strace -y -x -enetwork $args "$file" | ||
| 28 | |||
| 29 | +sample='\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff' | ||
| 30 | n='[1-9][0-9]*' | ||
| 31 | -msg='\{msg_name\(0\)=NULL, msg_iov\(1\)=\[\{"\\x00\\x00\\x00\\x00[^"]*", '"$n"'\}\], msg_controllen='"$n" | ||
| 32 | -rights='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, \[3</dev/null>, 4</dev/zero>, 5</[^}>]*/(A\\n){127}Z>\]\}' | ||
| 33 | +msg='\{msg_name\(0\)=NULL, msg_iov\(1\)=\[\{"'"$sample"'", 15\}\], msg_controllen='"$n" | ||
| 34 | +rights='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, \[4</dev/null>, 5</dev/zero>, 6</[^}>]*/(A\\n){127}Z>\]\}' | ||
| 35 | creds='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS, \{pid='"$n"', uid=[0-9]+, gid=[0-9]+\}\}' | ||
| 36 | -prefix='[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +' | ||
| 37 | EXPECTED="$LOG.expected" | ||
| 38 | |||
| 39 | cat > "$EXPECTED" << __EOF__ | ||
| 40 | -${prefix}sendmsg\\(1<socket:\\[[0-9]+\\]>, $msg, \\[$rights\\], msg_flags=0\\}, 0\\) += $n | ||
| 41 | -${prefix}recvmsg\\(0<socket:\\[[0-9]+\\]>, $msg, \\[$creds, $rights\\], msg_flags=0\\}, 0\\) += $n | ||
| 42 | +sendmsg\\(3<socket:\\[[0-9]+\\]>, $msg, \\[$rights\\], msg_flags=0\\}, 0\\) = 15 | ||
| 43 | +recvmsg\\(0<socket:\\[[0-9]+\\]>, $msg, \\[$creds, $rights\\], msg_flags=0\\}, 0\\) = 15 | ||
| 44 | __EOF__ | ||
| 45 | |||
| 46 | match_grep "$LOG" "$EXPECTED" | ||
| 47 | diff --git a/tests/scm_rights.c b/tests/scm_rights.c | ||
| 48 | index 1e5e850..00af4d5 100644 | ||
| 49 | --- a/tests/scm_rights.c | ||
| 50 | +++ b/tests/scm_rights.c | ||
| 51 | @@ -27,26 +27,39 @@ | ||
| 52 | |||
| 53 | #include "tests.h" | ||
| 54 | #include <assert.h> | ||
| 55 | -#include <string.h> | ||
| 56 | -#include <stdlib.h> | ||
| 57 | -#include <unistd.h> | ||
| 58 | #include <errno.h> | ||
| 59 | #include <fcntl.h> | ||
| 60 | +#include <stdlib.h> | ||
| 61 | +#include <string.h> | ||
| 62 | +#include <unistd.h> | ||
| 63 | #include <sys/socket.h> | ||
| 64 | -#include <sys/wait.h> | ||
| 65 | |||
| 66 | int main(int ac, const char **av) | ||
| 67 | { | ||
| 68 | - int i; | ||
| 69 | - int data = 0; | ||
| 70 | - struct iovec iov = { | ||
| 71 | - .iov_base = &data, | ||
| 72 | - .iov_len = sizeof(iov) | ||
| 73 | - }; | ||
| 74 | + assert(ac > 0); | ||
| 75 | + int fds[ac]; | ||
| 76 | + | ||
| 77 | + static const char sample[] = | ||
| 78 | + "\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"; | ||
| 79 | + const unsigned int data_size = sizeof(sample) - 1; | ||
| 80 | + void *data = tail_alloc(data_size); | ||
| 81 | + memcpy(data, sample, data_size); | ||
| 82 | + | ||
| 83 | + struct iovec *iov = tail_alloc(sizeof(struct iovec)); | ||
| 84 | + iov->iov_base = data; | ||
| 85 | + iov->iov_len = data_size; | ||
| 86 | |||
| 87 | - while ((i = open("/dev/null", O_RDWR)) < 3) | ||
| 88 | + struct msghdr *mh = tail_alloc(sizeof(struct msghdr)); | ||
| 89 | + memset(mh, 0, sizeof(*mh)); | ||
| 90 | + mh->msg_iov = iov; | ||
| 91 | + mh->msg_iovlen = 1; | ||
| 92 | + | ||
| 93 | + int i; | ||
| 94 | + while ((i = open("/dev/null", O_RDWR)) <= ac + 2) | ||
| 95 | assert(i >= 0); | ||
| 96 | - (void) close(3); | ||
| 97 | + while (i > 2) | ||
| 98 | + assert(close(i--) == 0); | ||
| 99 | + assert(close(0) == 0); | ||
| 100 | |||
| 101 | int sv[2]; | ||
| 102 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv)) | ||
| 103 | @@ -55,60 +68,39 @@ int main(int ac, const char **av) | ||
| 104 | if (setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one))) | ||
| 105 | perror_msg_and_skip("setsockopt"); | ||
| 106 | |||
| 107 | - pid_t pid = fork(); | ||
| 108 | - if (pid < 0) | ||
| 109 | - perror_msg_and_fail("fork"); | ||
| 110 | - | ||
| 111 | - if (pid) { | ||
| 112 | - assert(close(sv[0]) == 0); | ||
| 113 | - assert(dup2(sv[1], 1) == 1); | ||
| 114 | - assert(close(sv[1]) == 0); | ||
| 115 | - | ||
| 116 | - int fds[ac]; | ||
| 117 | - assert((fds[0] = open("/dev/null", O_RDWR)) == 3); | ||
| 118 | - for (i = 1; i < ac; ++i) | ||
| 119 | - assert((fds[i] = open(av[i], O_RDONLY)) == i + 3); | ||
| 120 | - | ||
| 121 | - union { | ||
| 122 | - struct cmsghdr cmsg; | ||
| 123 | - char buf[CMSG_LEN(sizeof(fds))]; | ||
| 124 | - } control; | ||
| 125 | - | ||
| 126 | - control.cmsg.cmsg_level = SOL_SOCKET; | ||
| 127 | - control.cmsg.cmsg_type = SCM_RIGHTS; | ||
| 128 | - control.cmsg.cmsg_len = CMSG_LEN(sizeof(fds)); | ||
| 129 | - memcpy(CMSG_DATA(&control.cmsg), fds, sizeof(fds)); | ||
| 130 | - | ||
| 131 | - struct msghdr mh = { | ||
| 132 | - .msg_iov = &iov, | ||
| 133 | - .msg_iovlen = 1, | ||
| 134 | - .msg_control = &control, | ||
| 135 | - .msg_controllen = sizeof(control) | ||
| 136 | - }; | ||
| 137 | - | ||
| 138 | - assert(sendmsg(1, &mh, 0) == sizeof(iov)); | ||
| 139 | - assert(close(1) == 0); | ||
| 140 | - | ||
| 141 | - int status; | ||
| 142 | - assert(waitpid(pid, &status, 0) == pid); | ||
| 143 | - assert(status == 0); | ||
| 144 | - } else { | ||
| 145 | - assert(close(sv[1]) == 0); | ||
| 146 | - assert(dup2(sv[0], 0) == 0); | ||
| 147 | - assert(close(sv[0]) == 0); | ||
| 148 | - | ||
| 149 | - struct cmsghdr control[4 + ac * sizeof(int) / sizeof(struct cmsghdr)]; | ||
| 150 | - | ||
| 151 | - struct msghdr mh = { | ||
| 152 | - .msg_iov = &iov, | ||
| 153 | - .msg_iovlen = 1, | ||
| 154 | - .msg_control = control, | ||
| 155 | - .msg_controllen = sizeof(control) | ||
| 156 | - }; | ||
| 157 | - | ||
| 158 | - assert(recvmsg(0, &mh, 0) == sizeof(iov)); | ||
| 159 | - assert(close(0) == 0); | ||
| 160 | + assert((fds[0] = open("/dev/null", O_RDWR)) == 4); | ||
| 161 | + for (i = 1; i < ac; ++i) | ||
| 162 | + assert((fds[i] = open(av[i], O_RDONLY)) == i + 4); | ||
| 163 | + | ||
| 164 | + unsigned int cmsg_size = CMSG_SPACE(sizeof(fds)); | ||
| 165 | + struct cmsghdr *cmsg = tail_alloc(cmsg_size); | ||
| 166 | + memset(cmsg, 0, cmsg_size); | ||
| 167 | + cmsg->cmsg_level = SOL_SOCKET; | ||
| 168 | + cmsg->cmsg_type = SCM_RIGHTS; | ||
| 169 | + cmsg->cmsg_len = CMSG_LEN(sizeof(fds)); | ||
| 170 | + memcpy(CMSG_DATA(cmsg), fds, sizeof(fds)); | ||
| 171 | + | ||
| 172 | + mh->msg_control = cmsg; | ||
| 173 | + mh->msg_controllen = cmsg_size; | ||
| 174 | + | ||
| 175 | + assert(sendmsg(sv[1], mh, 0) == (int) data_size); | ||
| 176 | + | ||
| 177 | + assert(close(sv[1]) == 0); | ||
| 178 | + assert(open("/dev/null", O_RDWR) == sv[1]); | ||
| 179 | + | ||
| 180 | + for (i = 0; i < ac; ++i) { | ||
| 181 | + assert(close(fds[i]) == 0); | ||
| 182 | + fds[i] = 0; | ||
| 183 | } | ||
| 184 | |||
| 185 | + cmsg_size += CMSG_SPACE(sizeof(struct ucred)); | ||
| 186 | + cmsg = tail_alloc(cmsg_size); | ||
| 187 | + memset(cmsg, 0, cmsg_size); | ||
| 188 | + mh->msg_control = cmsg; | ||
| 189 | + mh->msg_controllen = cmsg_size; | ||
| 190 | + | ||
| 191 | + assert(recvmsg(0, mh, 0) == (int) data_size); | ||
| 192 | + assert(close(0) == 0); | ||
| 193 | + | ||
| 194 | return 0; | ||
| 195 | } | ||
| 196 | -- | ||
| 197 | 1.9.1 | ||
| 198 | |||
diff --git a/meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch b/meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch deleted file mode 100644 index 1575ecd229..0000000000 --- a/meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch +++ /dev/null | |||
| @@ -1,306 +0,0 @@ | |||
| 1 | From 87e6b230fff800eb768b68b2e5173ebbe83fd3ef Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dmitry V. Levin" <ldv@altlinux.org> | ||
| 3 | Date: Sat, 2 Jan 2016 12:05:14 +0000 | ||
| 4 | Subject: [PATCH] tests: introduce libtests | ||
| 5 | |||
| 6 | Introduce tests/libtests.a with common functions for use in tests. | ||
| 7 | |||
| 8 | * tests/tests.h: New file. | ||
| 9 | * tests/error_msg.c: Likewise. | ||
| 10 | * tests/tail_alloc.c: Likewise. | ||
| 11 | * tests/get_page_size.c: Likewise. | ||
| 12 | * tests/Makefile.am (libtests_a_SOURCES, libtests_a_CPPFLAGS, | ||
| 13 | check_LIBRARIES, LDADD): New variables. | ||
| 14 | (clock_xettime_LDADD, filter_unavailable_LDADD, mq_LDADD, | ||
| 15 | pc_LDADD, times_LDADD): Add $(LDADD). | ||
| 16 | * tests/.gitignore: Add libtests.a. | ||
| 17 | --- | ||
| 18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 19 | Upstream-Status: Backport | ||
| 20 | |||
| 21 | tests/.gitignore | 1 + | ||
| 22 | tests/Makefile.am | 20 ++++++++++---- | ||
| 23 | tests/error_msg.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 24 | tests/get_page_size.c | 13 +++++++++ | ||
| 25 | tests/tail_alloc.c | 52 ++++++++++++++++++++++++++++++++++++ | ||
| 26 | tests/tests.h | 62 ++++++++++++++++++++++++++++++++++++++++++ | ||
| 27 | 6 files changed, 217 insertions(+), 5 deletions(-) | ||
| 28 | create mode 100644 tests/error_msg.c | ||
| 29 | create mode 100644 tests/get_page_size.c | ||
| 30 | create mode 100644 tests/tail_alloc.c | ||
| 31 | create mode 100644 tests/tests.h | ||
| 32 | |||
| 33 | diff --git a/tests/Makefile.am b/tests/Makefile.am | ||
| 34 | index 386a2c2..62d0e56 100644 | ||
| 35 | --- a/tests/Makefile.am | ||
| 36 | +++ b/tests/Makefile.am | ||
| 37 | @@ -40,6 +40,16 @@ AM_CPPFLAGS = $(ARCH_MFLAGS) \ | ||
| 38 | -I$(top_srcdir) | ||
| 39 | AM_LDFLAGS = $(ARCH_MFLAGS) | ||
| 40 | |||
| 41 | +libtests_a_SOURCES = \ | ||
| 42 | + get_page_size.c \ | ||
| 43 | + error_msg.c \ | ||
| 44 | + tail_alloc.c \ | ||
| 45 | + tests.h \ | ||
| 46 | + # end of libtests_a_SOURCES | ||
| 47 | +libtests_a_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 48 | +check_LIBRARIES = libtests.a | ||
| 49 | +LDADD = libtests.a | ||
| 50 | + | ||
| 51 | check_PROGRAMS = \ | ||
| 52 | _newselect \ | ||
| 53 | adjtimex \ | ||
| 54 | @@ -146,19 +156,19 @@ check_PROGRAMS = \ | ||
| 55 | xettimeofday \ | ||
| 56 | # end of check_PROGRAMS | ||
| 57 | |||
| 58 | -clock_xettime_LDADD = -lrt | ||
| 59 | -filter_unavailable_LDADD = -lpthread | ||
| 60 | +clock_xettime_LDADD = -lrt $(LDADD) | ||
| 61 | +filter_unavailable_LDADD = -lpthread $(LDADD) | ||
| 62 | fstat64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 63 | fstatat64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 64 | ftruncate64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 65 | lstat64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 66 | mmap64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 67 | -mq_LDADD = -lrt | ||
| 68 | +mq_LDADD = -lrt $(LDADD) | ||
| 69 | newfstatat_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 70 | -pc_LDADD = $(dl_LIBS) | ||
| 71 | +pc_LDADD = $(dl_LIBS) $(LDADD) | ||
| 72 | stat64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 73 | statfs_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 74 | -times_LDADD = -lrt | ||
| 75 | +times_LDADD = -lrt $(LDADD) | ||
| 76 | truncate64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 77 | uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 | ||
| 78 | stack_fcall_SOURCES = stack-fcall.c \ | ||
| 79 | diff --git a/tests/error_msg.c b/tests/error_msg.c | ||
| 80 | new file mode 100644 | ||
| 81 | index 0000000..3fd3411 | ||
| 82 | --- /dev/null | ||
| 83 | +++ b/tests/error_msg.c | ||
| 84 | @@ -0,0 +1,74 @@ | ||
| 85 | +/* | ||
| 86 | + * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> | ||
| 87 | + * All rights reserved. | ||
| 88 | + * | ||
| 89 | + * Redistribution and use in source and binary forms, with or without | ||
| 90 | + * modification, are permitted provided that the following conditions | ||
| 91 | + * are met: | ||
| 92 | + * 1. Redistributions of source code must retain the above copyright | ||
| 93 | + * notice, this list of conditions and the following disclaimer. | ||
| 94 | + * 2. Redistributions in binary form must reproduce the above copyright | ||
| 95 | + * notice, this list of conditions and the following disclaimer in the | ||
| 96 | + * documentation and/or other materials provided with the distribution. | ||
| 97 | + * 3. The name of the author may not be used to endorse or promote products | ||
| 98 | + * derived from this software without specific prior written permission. | ||
| 99 | + * | ||
| 100 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| 101 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| 102 | + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| 103 | + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 104 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 105 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 106 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 107 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 108 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 109 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 110 | + */ | ||
| 111 | + | ||
| 112 | +#include "tests.h" | ||
| 113 | +#include <errno.h> | ||
| 114 | +#include <stdarg.h> | ||
| 115 | +#include <stdio.h> | ||
| 116 | +#include <stdlib.h> | ||
| 117 | +#include <string.h> | ||
| 118 | + | ||
| 119 | +void | ||
| 120 | +perror_msg_and_fail(const char *fmt, ...) | ||
| 121 | +{ | ||
| 122 | + int err_no = errno; | ||
| 123 | + va_list p; | ||
| 124 | + | ||
| 125 | + va_start(p, fmt); | ||
| 126 | + vfprintf(stderr, fmt, p); | ||
| 127 | + if (err_no) | ||
| 128 | + fprintf(stderr, ": %s\n", strerror(err_no)); | ||
| 129 | + else | ||
| 130 | + putc('\n', stderr); | ||
| 131 | + exit(1); | ||
| 132 | +} | ||
| 133 | + | ||
| 134 | +void | ||
| 135 | +error_msg_and_skip(const char *fmt, ...) | ||
| 136 | +{ | ||
| 137 | + va_list p; | ||
| 138 | + | ||
| 139 | + va_start(p, fmt); | ||
| 140 | + vfprintf(stderr, fmt, p); | ||
| 141 | + putc('\n', stderr); | ||
| 142 | + exit(77); | ||
| 143 | +} | ||
| 144 | + | ||
| 145 | +void | ||
| 146 | +perror_msg_and_skip(const char *fmt, ...) | ||
| 147 | +{ | ||
| 148 | + int err_no = errno; | ||
| 149 | + va_list p; | ||
| 150 | + | ||
| 151 | + va_start(p, fmt); | ||
| 152 | + vfprintf(stderr, fmt, p); | ||
| 153 | + if (err_no) | ||
| 154 | + fprintf(stderr, ": %s\n", strerror(err_no)); | ||
| 155 | + else | ||
| 156 | + putc('\n', stderr); | ||
| 157 | + exit(77); | ||
| 158 | +} | ||
| 159 | diff --git a/tests/get_page_size.c b/tests/get_page_size.c | ||
| 160 | new file mode 100644 | ||
| 161 | index 0000000..aeea861 | ||
| 162 | --- /dev/null | ||
| 163 | +++ b/tests/get_page_size.c | ||
| 164 | @@ -0,0 +1,13 @@ | ||
| 165 | +#include "tests.h" | ||
| 166 | +#include <unistd.h> | ||
| 167 | + | ||
| 168 | +size_t | ||
| 169 | +get_page_size(void) | ||
| 170 | +{ | ||
| 171 | + static size_t page_size; | ||
| 172 | + | ||
| 173 | + if (!page_size) | ||
| 174 | + page_size = sysconf(_SC_PAGESIZE); | ||
| 175 | + | ||
| 176 | + return page_size; | ||
| 177 | +} | ||
| 178 | diff --git a/tests/tail_alloc.c b/tests/tail_alloc.c | ||
| 179 | new file mode 100644 | ||
| 180 | index 0000000..2b8b14e | ||
| 181 | --- /dev/null | ||
| 182 | +++ b/tests/tail_alloc.c | ||
| 183 | @@ -0,0 +1,52 @@ | ||
| 184 | +/* | ||
| 185 | + * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> | ||
| 186 | + * All rights reserved. | ||
| 187 | + * | ||
| 188 | + * Redistribution and use in source and binary forms, with or without | ||
| 189 | + * modification, are permitted provided that the following conditions | ||
| 190 | + * are met: | ||
| 191 | + * 1. Redistributions of source code must retain the above copyright | ||
| 192 | + * notice, this list of conditions and the following disclaimer. | ||
| 193 | + * 2. Redistributions in binary form must reproduce the above copyright | ||
| 194 | + * notice, this list of conditions and the following disclaimer in the | ||
| 195 | + * documentation and/or other materials provided with the distribution. | ||
| 196 | + * 3. The name of the author may not be used to endorse or promote products | ||
| 197 | + * derived from this software without specific prior written permission. | ||
| 198 | + * | ||
| 199 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| 200 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| 201 | + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| 202 | + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 203 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 204 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 205 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 206 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 207 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 208 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 209 | + */ | ||
| 210 | + | ||
| 211 | +#include "tests.h" | ||
| 212 | +#include <string.h> | ||
| 213 | +#include <sys/mman.h> | ||
| 214 | + | ||
| 215 | +void * | ||
| 216 | +tail_alloc(const size_t size) | ||
| 217 | +{ | ||
| 218 | + const size_t page_size = get_page_size(); | ||
| 219 | + const size_t len = (size + page_size - 1) & -page_size; | ||
| 220 | + const size_t alloc_size = len + 2 * page_size; | ||
| 221 | + | ||
| 222 | + void *p = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, | ||
| 223 | + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | ||
| 224 | + if (MAP_FAILED == p) | ||
| 225 | + perror_msg_and_fail("mmap(%zu)", alloc_size); | ||
| 226 | + | ||
| 227 | + void *start_work = p + page_size; | ||
| 228 | + void *tail_guard = start_work + len; | ||
| 229 | + | ||
| 230 | + if (munmap(p, page_size) || munmap(tail_guard, page_size)) | ||
| 231 | + perror_msg_and_fail("munmap"); | ||
| 232 | + | ||
| 233 | + memset(start_work, 0xff, len); | ||
| 234 | + return tail_guard - size; | ||
| 235 | +} | ||
| 236 | diff --git a/tests/tests.h b/tests/tests.h | ||
| 237 | new file mode 100644 | ||
| 238 | index 0000000..91fa24e | ||
| 239 | --- /dev/null | ||
| 240 | +++ b/tests/tests.h | ||
| 241 | @@ -0,0 +1,62 @@ | ||
| 242 | +/* | ||
| 243 | + * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> | ||
| 244 | + * All rights reserved. | ||
| 245 | + * | ||
| 246 | + * Redistribution and use in source and binary forms, with or without | ||
| 247 | + * modification, are permitted provided that the following conditions | ||
| 248 | + * are met: | ||
| 249 | + * 1. Redistributions of source code must retain the above copyright | ||
| 250 | + * notice, this list of conditions and the following disclaimer. | ||
| 251 | + * 2. Redistributions in binary form must reproduce the above copyright | ||
| 252 | + * notice, this list of conditions and the following disclaimer in the | ||
| 253 | + * documentation and/or other materials provided with the distribution. | ||
| 254 | + * 3. The name of the author may not be used to endorse or promote products | ||
| 255 | + * derived from this software without specific prior written permission. | ||
| 256 | + * | ||
| 257 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| 258 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| 259 | + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| 260 | + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 261 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 262 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 263 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 264 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 265 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 266 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 267 | + */ | ||
| 268 | + | ||
| 269 | +#ifndef TESTS_H_ | ||
| 270 | +# define TESTS_H_ | ||
| 271 | + | ||
| 272 | +# ifdef HAVE_CONFIG_H | ||
| 273 | +# include "config.h" | ||
| 274 | +# endif | ||
| 275 | + | ||
| 276 | +# include <sys/types.h> | ||
| 277 | +# include "gcc_compat.h" | ||
| 278 | + | ||
| 279 | +/* Cached sysconf(_SC_PAGESIZE). */ | ||
| 280 | +size_t get_page_size(void); | ||
| 281 | + | ||
| 282 | +/* Print message and strerror(errno) to stderr, then exit(1). */ | ||
| 283 | +void perror_msg_and_fail(const char *, ...) | ||
| 284 | + ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; | ||
| 285 | +/* Print message to stderr, then exit(77). */ | ||
| 286 | +void error_msg_and_skip(const char *, ...) | ||
| 287 | + ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; | ||
| 288 | +/* Print message and strerror(errno) to stderr, then exit(77). */ | ||
| 289 | +void perror_msg_and_skip(const char *, ...) | ||
| 290 | + ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; | ||
| 291 | + | ||
| 292 | +/* | ||
| 293 | + * Allocate memory that ends on the page boundary. | ||
| 294 | + * Pages allocated by this call are preceeded by an unmapped page | ||
| 295 | + * and followed also by an unmapped page. | ||
| 296 | + */ | ||
| 297 | +void *tail_alloc(const size_t) | ||
| 298 | + ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1)); | ||
| 299 | + | ||
| 300 | +# define SKIP_MAIN_UNDEFINED(arg) \ | ||
| 301 | + int main(void) { error_msg_and_skip("undefined: %s", arg); } | ||
| 302 | + | ||
| 303 | +#endif | ||
| 304 | -- | ||
| 305 | 1.9.1 | ||
| 306 | |||
diff --git a/meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch b/meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch deleted file mode 100644 index 3fbab8b66f..0000000000 --- a/meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | From 339a15b619b479c63cafba21d5fc359e613d9ee8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dmitry V. Levin" <ldv@altlinux.org> | ||
| 3 | Date: Mon, 4 Jan 2016 23:53:31 +0000 | ||
| 4 | Subject: [PATCH] tests/scm_rights.c: use libtests | ||
| 5 | |||
| 6 | * tests/scm_rights.c (main): Use perror_msg_and_fail and perror_msg_and_skip. | ||
| 7 | --- | ||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | Upstream-Status: Backport | ||
| 10 | |||
| 11 | tests/scm_rights.c | 12 ++++++++---- | ||
| 12 | 1 file changed, 8 insertions(+), 4 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/tests/scm_rights.c b/tests/scm_rights.c | ||
| 15 | index c41444f..1e5e850 100644 | ||
| 16 | --- a/tests/scm_rights.c | ||
| 17 | +++ b/tests/scm_rights.c | ||
| 18 | @@ -1,5 +1,5 @@ | ||
| 19 | /* | ||
| 20 | - * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | ||
| 21 | + * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org> | ||
| 22 | * All rights reserved. | ||
| 23 | * | ||
| 24 | * Redistribution and use in source and binary forms, with or without | ||
| 25 | @@ -25,6 +25,7 @@ | ||
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 27 | */ | ||
| 28 | |||
| 29 | +#include "tests.h" | ||
| 30 | #include <assert.h> | ||
| 31 | #include <string.h> | ||
| 32 | #include <stdlib.h> | ||
| 33 | @@ -48,12 +49,15 @@ int main(int ac, const char **av) | ||
| 34 | (void) close(3); | ||
| 35 | |||
| 36 | int sv[2]; | ||
| 37 | - assert(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0); | ||
| 38 | + if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv)) | ||
| 39 | + perror_msg_and_skip("socketpair"); | ||
| 40 | int one = 1; | ||
| 41 | - assert(setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) == 0); | ||
| 42 | + if (setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one))) | ||
| 43 | + perror_msg_and_skip("setsockopt"); | ||
| 44 | |||
| 45 | pid_t pid = fork(); | ||
| 46 | - assert(pid >= 0); | ||
| 47 | + if (pid < 0) | ||
| 48 | + perror_msg_and_fail("fork"); | ||
| 49 | |||
| 50 | if (pid) { | ||
| 51 | assert(close(sv[0]) == 0); | ||
| 52 | -- | ||
| 53 | 1.9.1 | ||
| 54 | |||
diff --git a/meta/recipes-devtools/strace/strace/update-gawk-paths.patch b/meta/recipes-devtools/strace/strace/update-gawk-paths.patch index bfc7f34419..94ee53c7fc 100644 --- a/meta/recipes-devtools/strace/strace/update-gawk-paths.patch +++ b/meta/recipes-devtools/strace/strace/update-gawk-paths.patch | |||
| @@ -12,19 +12,20 @@ Upstream-Status: Inappropriate [configuration] | |||
| 12 | 12 | ||
| 13 | Signed-off-by: Andre McCurdy <armccurdy@gmail.com> | 13 | Signed-off-by: Andre McCurdy <armccurdy@gmail.com> |
| 14 | --- | 14 | --- |
| 15 | mpers.awk | 2 +- | 15 | mpers.awk | 2 +- |
| 16 | tests/caps.awk | 2 +- | 16 | tests-m32/caps.awk | 2 +- |
| 17 | tests/match.awk | 2 +- | 17 | tests-m32/match.awk | 2 +- |
| 18 | tests/net-yy-accept.awk | 2 +- | 18 | tests-m32/sigaction.awk | 2 +- |
| 19 | tests/net-yy-connect.awk | 2 +- | 19 | tests-mx32/caps.awk | 2 +- |
| 20 | tests/sigaction.awk | 2 +- | 20 | tests-mx32/match.awk | 2 +- |
| 21 | tests/uid.awk | 2 +- | 21 | tests-mx32/sigaction.awk | 2 +- |
| 22 | tests/unix-yy-accept.awk | 2 +- | 22 | tests/caps.awk | 2 +- |
| 23 | tests/unix-yy-connect.awk | 2 +- | 23 | tests/match.awk | 2 +- |
| 24 | 9 files changed, 9 insertions(+), 9 deletions(-) | 24 | tests/sigaction.awk | 2 +- |
| 25 | 10 files changed, 10 insertions(+), 10 deletions(-) | ||
| 25 | 26 | ||
| 26 | diff --git a/mpers.awk b/mpers.awk | 27 | diff --git a/mpers.awk b/mpers.awk |
| 27 | index 73bf0b0..50e6c16 100644 | 28 | index 99248c5..ff10520 100644 |
| 28 | --- a/mpers.awk | 29 | --- a/mpers.awk |
| 29 | +++ b/mpers.awk | 30 | +++ b/mpers.awk |
| 30 | @@ -1,4 +1,4 @@ | 31 | @@ -1,4 +1,4 @@ |
| @@ -32,87 +33,94 @@ index 73bf0b0..50e6c16 100644 | |||
| 32 | +#!/usr/bin/gawk | 33 | +#!/usr/bin/gawk |
| 33 | # | 34 | # |
| 34 | # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> | 35 | # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> |
| 35 | # Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org> | 36 | # Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> |
| 36 | diff --git a/tests/caps.awk b/tests/caps.awk | 37 | diff --git a/tests-m32/caps.awk b/tests-m32/caps.awk |
| 37 | index bad8b0f..845f37c 100644 | 38 | index 67003ac..a66f1f0 100644 |
| 38 | --- a/tests/caps.awk | 39 | --- a/tests-m32/caps.awk |
| 39 | +++ b/tests/caps.awk | 40 | +++ b/tests-m32/caps.awk |
| 40 | @@ -1,4 +1,4 @@ | 41 | @@ -1,4 +1,4 @@ |
| 41 | -#!/bin/gawk | 42 | -#!/bin/gawk |
| 42 | +#!/usr/bin/gawk | 43 | +#!/usr/bin/gawk |
| 43 | # | 44 | # |
| 44 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | 45 | # This file is part of caps strace test. |
| 45 | # All rights reserved. | 46 | # |
| 46 | diff --git a/tests/match.awk b/tests/match.awk | 47 | diff --git a/tests-m32/match.awk b/tests-m32/match.awk |
| 47 | index abfbae9..f2740bf 100644 | 48 | index abfbae9..f2740bf 100644 |
| 48 | --- a/tests/match.awk | 49 | --- a/tests-m32/match.awk |
| 49 | +++ b/tests/match.awk | 50 | +++ b/tests-m32/match.awk |
| 50 | @@ -1,4 +1,4 @@ | 51 | @@ -1,4 +1,4 @@ |
| 51 | -#!/bin/gawk | 52 | -#!/bin/gawk |
| 52 | +#!/usr/bin/gawk | 53 | +#!/usr/bin/gawk |
| 53 | # | 54 | # |
| 54 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | 55 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> |
| 55 | # All rights reserved. | 56 | # All rights reserved. |
| 56 | diff --git a/tests/net-yy-accept.awk b/tests/net-yy-accept.awk | 57 | diff --git a/tests-m32/sigaction.awk b/tests-m32/sigaction.awk |
| 57 | index fed3e30..e916ab0 100644 | 58 | index 5c6b6d0..3e14464 100644 |
| 58 | --- a/tests/net-yy-accept.awk | 59 | --- a/tests-m32/sigaction.awk |
| 59 | +++ b/tests/net-yy-accept.awk | 60 | +++ b/tests-m32/sigaction.awk |
| 60 | @@ -1,4 +1,4 @@ | 61 | @@ -1,4 +1,4 @@ |
| 61 | -#!/bin/gawk | 62 | -#!/bin/gawk |
| 62 | +#!/usr/bin/gawk | 63 | +#!/usr/bin/gawk |
| 63 | # | 64 | # |
| 64 | # Copyright (c) 2014 Masatake YAMATO <yamato@redhat.com> | ||
| 65 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | 65 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> |
| 66 | diff --git a/tests/net-yy-connect.awk b/tests/net-yy-connect.awk | 66 | # All rights reserved. |
| 67 | index f4dcf91..b3cec8c 100644 | 67 | diff --git a/tests-mx32/caps.awk b/tests-mx32/caps.awk |
| 68 | --- a/tests/net-yy-connect.awk | 68 | index 67003ac..a66f1f0 100644 |
| 69 | +++ b/tests/net-yy-connect.awk | 69 | --- a/tests-mx32/caps.awk |
| 70 | +++ b/tests-mx32/caps.awk | ||
| 70 | @@ -1,4 +1,4 @@ | 71 | @@ -1,4 +1,4 @@ |
| 71 | -#!/bin/gawk | 72 | -#!/bin/gawk |
| 72 | +#!/usr/bin/gawk | 73 | +#!/usr/bin/gawk |
| 73 | # | 74 | # |
| 74 | # Copyright (c) 2014 Masatake YAMATO <yamato@redhat.com> | 75 | # This file is part of caps strace test. |
| 75 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | 76 | # |
| 76 | diff --git a/tests/sigaction.awk b/tests/sigaction.awk | 77 | diff --git a/tests-mx32/match.awk b/tests-mx32/match.awk |
| 77 | index 5c6b6d0..3e14464 100644 | 78 | index abfbae9..f2740bf 100644 |
| 78 | --- a/tests/sigaction.awk | 79 | --- a/tests-mx32/match.awk |
| 79 | +++ b/tests/sigaction.awk | 80 | +++ b/tests-mx32/match.awk |
| 80 | @@ -1,4 +1,4 @@ | 81 | @@ -1,4 +1,4 @@ |
| 81 | -#!/bin/gawk | 82 | -#!/bin/gawk |
| 82 | +#!/usr/bin/gawk | 83 | +#!/usr/bin/gawk |
| 83 | # | 84 | # |
| 84 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | 85 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> |
| 85 | # All rights reserved. | 86 | # All rights reserved. |
| 86 | diff --git a/tests/uid.awk b/tests/uid.awk | 87 | diff --git a/tests-mx32/sigaction.awk b/tests-mx32/sigaction.awk |
| 87 | index a56c5be..67b0749 100644 | 88 | index 5c6b6d0..3e14464 100644 |
| 88 | --- a/tests/uid.awk | 89 | --- a/tests-mx32/sigaction.awk |
| 89 | +++ b/tests/uid.awk | 90 | +++ b/tests-mx32/sigaction.awk |
| 90 | @@ -1,4 +1,4 @@ | 91 | @@ -1,4 +1,4 @@ |
| 91 | -#!/bin/gawk | 92 | -#!/bin/gawk |
| 92 | +#!/usr/bin/gawk | 93 | +#!/usr/bin/gawk |
| 93 | # | 94 | # |
| 94 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | 95 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> |
| 95 | # All rights reserved. | 96 | # All rights reserved. |
| 96 | diff --git a/tests/unix-yy-accept.awk b/tests/unix-yy-accept.awk | 97 | diff --git a/tests/caps.awk b/tests/caps.awk |
| 97 | index 4ed60e4..2a9d9c0 100644 | 98 | index 67003ac..a66f1f0 100644 |
| 98 | --- a/tests/unix-yy-accept.awk | 99 | --- a/tests/caps.awk |
| 99 | +++ b/tests/unix-yy-accept.awk | 100 | +++ b/tests/caps.awk |
| 101 | @@ -1,4 +1,4 @@ | ||
| 102 | -#!/bin/gawk | ||
| 103 | +#!/usr/bin/gawk | ||
| 104 | # | ||
| 105 | # This file is part of caps strace test. | ||
| 106 | # | ||
| 107 | diff --git a/tests/match.awk b/tests/match.awk | ||
| 108 | index abfbae9..f2740bf 100644 | ||
| 109 | --- a/tests/match.awk | ||
| 110 | +++ b/tests/match.awk | ||
| 100 | @@ -1,4 +1,4 @@ | 111 | @@ -1,4 +1,4 @@ |
| 101 | -#!/bin/gawk | 112 | -#!/bin/gawk |
| 102 | +#!/usr/bin/gawk | 113 | +#!/usr/bin/gawk |
| 103 | # | 114 | # |
| 104 | # Copyright (c) 2014 Masatake YAMATO <yamato@redhat.com> | ||
| 105 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | 115 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> |
| 106 | diff --git a/tests/unix-yy-connect.awk b/tests/unix-yy-connect.awk | 116 | # All rights reserved. |
| 107 | index 262bf2e..c809dfa 100644 | 117 | diff --git a/tests/sigaction.awk b/tests/sigaction.awk |
| 108 | --- a/tests/unix-yy-connect.awk | 118 | index 5c6b6d0..3e14464 100644 |
| 109 | +++ b/tests/unix-yy-connect.awk | 119 | --- a/tests/sigaction.awk |
| 120 | +++ b/tests/sigaction.awk | ||
| 110 | @@ -1,4 +1,4 @@ | 121 | @@ -1,4 +1,4 @@ |
| 111 | -#!/bin/gawk | 122 | -#!/bin/gawk |
| 112 | +#!/usr/bin/gawk | 123 | +#!/usr/bin/gawk |
| 113 | # | 124 | # |
| 114 | # Copyright (c) 2014 Masatake YAMATO <yamato@redhat.com> | ||
| 115 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> | 125 | # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> |
| 116 | -- | 126 | # All rights reserved. |
| 117 | 1.9.1 | ||
| 118 | |||
diff --git a/meta/recipes-devtools/strace/strace_4.11.bb b/meta/recipes-devtools/strace/strace_4.12.bb index 56b64bb0c9..70d74028de 100644 --- a/meta/recipes-devtools/strace/strace_4.11.bb +++ b/meta/recipes-devtools/strace/strace_4.12.bb | |||
| @@ -9,18 +9,13 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.xz \ | |||
| 9 | file://more-robust-test-for-m32-mx32-compile-support.patch \ | 9 | file://more-robust-test-for-m32-mx32-compile-support.patch \ |
| 10 | file://update-gawk-paths.patch \ | 10 | file://update-gawk-paths.patch \ |
| 11 | file://use-asm-sgidefs.h.patch \ | 11 | file://use-asm-sgidefs.h.patch \ |
| 12 | file://0001-arc-metag-nios2-or1k-tile-fix-build.patch \ | ||
| 13 | file://Makefile-ptest.patch \ | 12 | file://Makefile-ptest.patch \ |
| 14 | file://0001-tests-scm_rights.c-use-libtests.patch \ | ||
| 15 | file://0001-scm_rights-fd.test-rewrite-without-fork.patch \ | ||
| 16 | file://0001-Move-gcc-compat-macros-to-gcc_compat.h.patch \ | ||
| 17 | file://0001-tests-introduce-libtests.patch \ | ||
| 18 | file://run-ptest \ | 13 | file://run-ptest \ |
| 19 | file://0001-Fix-build-when-using-non-glibc-libc-implementation-o.patch \ | 14 | file://0001-Fix-build-when-using-non-glibc-libc-implementation-o.patch \ |
| 20 | " | 15 | " |
| 21 | 16 | ||
| 22 | SRC_URI[md5sum] = "a15d2555a7febb56d00c6e1a51c655dc" | 17 | SRC_URI[md5sum] = "efb8611fc332e71ec419c53f59faa93e" |
| 23 | SRC_URI[sha256sum] = "e86a5f6cd8f941f67f3e4b28f4e60f3d9185c951cf266404533210a2e5cd8152" | 18 | SRC_URI[sha256sum] = "51144b78cb9ba22211b95a5aafe0af3694c0d575b25975d80ca9dd4dfd7c1e59" |
| 24 | 19 | ||
| 25 | inherit autotools ptest bluetooth | 20 | inherit autotools ptest bluetooth |
| 26 | 21 | ||
