From ca7fc3695b061c48af1975d14a3e50a87329031a Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 6 Mar 2019 16:02:38 +0000 Subject: [PATCH 23/27] tests: move PTRACE_SEIZE check to a separate file The check is going to be used by another test soon. * tests/PTRACE_SEIZE.sh: New file. * tests/detach-stopped.test: Use it. * tests/Makefile.am (EXTRA_DIST): Add PTRACE_SEIZE.sh. Conflicts: tests/Makefile.am tests/detach-stopped.test Additional changes: tests-m32/PTRACE_SEIZE.sh (copy of tests/PTRACE_SEIZE.sh) tests-m32/detach-stopped.test (copy of tests/detach-stopped.test) tests-mx32/PTRACE_SEIZE.sh (copy of tests/PTRACE_SEIZE.sh) tests-mx32/detach-stopped.test (copy of tests/detach-stopped.test) --- tests/Makefile.am | 1 + tests/PTRACE_SEIZE.sh | 13 +++++++++++++ tests/detach-stopped.test | 6 +----- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100755 tests/PTRACE_SEIZE.sh Index: strace-4.24/tests/Makefile.am =================================================================== --- strace-4.24.orig/tests/Makefile.am 2019-03-10 05:40:37.969676713 +0100 +++ strace-4.24/tests/Makefile.am 2019-03-10 05:47:36.446486219 +0100 @@ -361,6 +361,7 @@ EXTRA_DIST = \ COPYING \ GPL-2.0-or-later \ + PTRACE_SEIZE.sh \ accept_compat.h \ attach-p-cmd.h \ caps-abbrev.awk \ Index: strace-4.24/tests/PTRACE_SEIZE.sh =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strace-4.24/tests/PTRACE_SEIZE.sh 2019-03-10 05:47:36.447486209 +0100 @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Skip the test if PTRACE_SEIZE is not supported. +# +# Copyright (c) 2014-2019 The strace developers. +# All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +$STRACE -d -enone / > /dev/null 2> "$LOG" ||: +if grep -x "[^:]*strace: PTRACE_SEIZE doesn't work" "$LOG" > /dev/null; then + skip_ "PTRACE_SEIZE doesn't work" +fi Index: strace-4.24/tests/detach-stopped.test =================================================================== --- strace-4.24.orig/tests/detach-stopped.test 2019-03-10 05:34:50.982151335 +0100 +++ strace-4.24/tests/detach-stopped.test 2019-03-10 05:47:36.447486209 +0100 @@ -9,17 +9,13 @@ # SPDX-License-Identifier: GPL-2.0-or-later . "${srcdir=.}/init.sh" +. "${srcdir=.}/PTRACE_SEIZE.sh" run_prog_skip_if_failed \ kill -0 $$ check_prog sleep -$STRACE -d -enone / > /dev/null 2> "$LOG" -if grep -x "[^:]*strace: PTRACE_SEIZE doesn't work" "$LOG" > /dev/null; then - skip_ "PTRACE_SEIZE doesn't work" -fi - set -e > "$LOG" Index: strace-4.24/tests-m32/PTRACE_SEIZE.sh =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strace-4.24/tests-m32/PTRACE_SEIZE.sh 2019-03-10 05:48:20.038049708 +0100 @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Skip the test if PTRACE_SEIZE is not supported. +# +# Copyright (c) 2014-2019 The strace developers. +# All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +$STRACE -d -enone / > /dev/null 2> "$LOG" ||: +if grep -x "[^:]*strace: PTRACE_SEIZE doesn't work" "$LOG" > /dev/null; then + skip_ "PTRACE_SEIZE doesn't work" +fi Index: strace-4.24/tests-m32/detach-stopped.test =================================================================== --- strace-4.24.orig/tests-m32/detach-stopped.test 2017-05-22 19:33:51.000000000 +0200 +++ strace-4.24/tests-m32/detach-stopped.test 2019-03-10 05:48:30.588944054 +0100 @@ -6,40 +6,16 @@ # Copyright (c) 2014-2017 The strace developers. # All rights reserved. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# SPDX-License-Identifier: GPL-2.0-or-later . "${srcdir=.}/init.sh" +. "${srcdir=.}/PTRACE_SEIZE.sh" run_prog_skip_if_failed \ kill -0 $$ check_prog sleep -$STRACE -d -enone / > /dev/null 2> "$LOG" -if grep -x "[^:]*strace: PTRACE_SEIZE doesn't work" "$LOG" > /dev/null; then - skip_ "PTRACE_SEIZE doesn't work" -fi - set -e > "$LOG" Index: strace-4.24/tests-mx32/detach-stopped.test =================================================================== --- strace-4.24.orig/tests-mx32/detach-stopped.test 2017-05-22 19:33:51.000000000 +0200 +++ strace-4.24/tests-mx32/detach-stopped.test 2019-03-10 05:48:33.040919501 +0100 @@ -6,40 +6,16 @@ # Copyright (c) 2014-2017 The strace developers. # All rights reserved. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# SPDX-License-Identifier: GPL-2.0-or-later . "${srcdir=.}/init.sh" +. "${srcdir=.}/PTRACE_SEIZE.sh" run_prog_skip_if_failed \ kill -0 $$ check_prog sleep -$STRACE -d -enone / > /dev/null 2> "$LOG" -if grep -x "[^:]*strace: PTRACE_SEIZE doesn't work" "$LOG" > /dev/null; then - skip_ "PTRACE_SEIZE doesn't work" -fi - set -e > "$LOG"