From 12e0ad6fa27454eb71220ababb81a386c1a8e4cf Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Mon, 10 Jul 2023 16:07:43 +0200 Subject: [PATCH] re-import sources as agreed with the maintainer --- .gitignore | 2 +- 0001-acl-2.2.53-test-runwrapper.patch | 44 ++++++++++ acl-2.2.53.tar.gz.sig | Bin 0 -> 566 bytes tests/cmd-line-options/Makefile | 88 ++++++++++++++++++++ tests/cmd-line-options/PURPOSE | 5 ++ tests/cmd-line-options/runtest.sh | 18 ++++ tests/cmd-line-options/test-core.sh | 113 ++++++++++++++++++++++++++ tests/tests.yml | 13 +++ 8 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 0001-acl-2.2.53-test-runwrapper.patch create mode 100644 acl-2.2.53.tar.gz.sig create mode 100644 tests/cmd-line-options/Makefile create mode 100644 tests/cmd-line-options/PURPOSE create mode 100755 tests/cmd-line-options/runtest.sh create mode 100755 tests/cmd-line-options/test-core.sh create mode 100644 tests/tests.yml diff --git a/.gitignore b/.gitignore index dd95c76..1985515 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/acl-2.2.53.tar.gz +/acl-2.2.*.tar.gz diff --git a/0001-acl-2.2.53-test-runwrapper.patch b/0001-acl-2.2.53-test-runwrapper.patch new file mode 100644 index 0000000..7c27c6c --- /dev/null +++ b/0001-acl-2.2.53-test-runwrapper.patch @@ -0,0 +1,44 @@ +From 085cc4ff56857d234e80f37d0316c13eb5718696 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Tue, 3 Jul 2018 10:46:58 +0200 +Subject: [PATCH] test/runwrapper: copy the preloaded library + +... to a temporary directory because the original location might +not be accessible by other users. +--- + test/runwrapper | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/test/runwrapper b/test/runwrapper +index 6e0e899..de4555a 100755 +--- a/test/runwrapper ++++ b/test/runwrapper +@@ -1,7 +1,23 @@ + #!/bin/bash + +-if [ -e "$PWD/.libs/libtestlookup.so" ]; then +- export LD_PRELOAD="$PWD/.libs/libtestlookup.so" ++src="$PWD/.libs/libtestlookup.so" ++dst= ++if [ -e "$src" ]; then ++ # copy the preloaded library to a temporary directory because ++ # the original location might not be accessible by other users ++ tmp="$(mktemp -d)" ++ chmod 0755 "$tmp" ++ dst="${tmp}/libtestlookup.so" ++ cp -L "$src" "$dst" ++ export LD_PRELOAD="$dst" + fi + + "${srcdir:-${PWD}}"/test/run "$@" ++ec="$?" ++ ++if [ -n "$dst" ]; then ++ # remove the temporary location ++ rm -rf "$dst" ++fi ++ ++exit "$ec" +-- +2.14.4 + diff --git a/acl-2.2.53.tar.gz.sig b/acl-2.2.53.tar.gz.sig new file mode 100644 index 0000000000000000000000000000000000000000..52f5e19e16f5f7b66eb263a38b2eb494f622b826 GIT binary patch literal 566 zcmV-60?GY}0y6{v0SEvc79j+=0<|X-CHRu8B^uO0V>_SdH}!!90$V6}Q~(MI5J6)* zpXfLBfu?j1{wX>E=VIYYnsqL-NMRXyI)Snco{>xRUe%46&f%{m_z`!t^56NFZep#! z^ufXr-TS%t&tw&ogTdQqwK&{$(Fp^)~ zV6K-sZvZ1tzvZ)Fvp)GlBP3i0Q5p2hj&&pI9u)J`)zRV~#eh&zc}|Q(*rSNW;;@ds zAgOow3&SfWbc66Fi8=KNPHg$8R2MQJH4x3Dk@x%9T5f_T&W5U`Pp!{2Y@^ldJCQAA zeYM>=8D_gXYG|Ahmj!Ia*T{F9*)&v1Di^GK!d`D#KGf)~DkG4Tr$v)N!O0U5uWRKJ zX-k^Ohn`WWTQL`ByW;xq9PYK5Yf-U`VJbASkP7WQj)1ShtQE|{ooVugi(dtTM8k`6 zj_xLHL0u{+hYa&r%S_-D51~aWIj&4(POR@dwk=l@C&c50=58VlgeS1ONa4 literal 0 HcmV?d00001 diff --git a/tests/cmd-line-options/Makefile b/tests/cmd-line-options/Makefile new file mode 100644 index 0000000..d4136cc --- /dev/null +++ b/tests/cmd-line-options/Makefile @@ -0,0 +1,88 @@ +# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material +# is made available to anyone wishing to use, modify, copy, or +# redistribute it subject to the terms and conditions of the GNU General +# Public License v.2. +# +# 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 for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Milos Malik + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Example Makefile for RHTS # +# This example is geared towards a test for a specific package # +# It does most of the work for you, but may require further coding # +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# + +# The toplevel namespace within which the test lives. +# FIXME: You will need to change this: +TOPLEVEL_NAMESPACE=CoreOS + +# The name of the package under test: +# FIXME: you wil need to change this: +PACKAGE_NAME=acl + +# The path of the test below the package: +# FIXME: you wil need to change this: +RELATIVE_PATH=Sanity/cmd-line-options + +# Version of the test. Used with make tag. +export TESTVERSION=1.0 + +# The combined namespace of the test. +export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) + + +# A phony target is one that is not really the name of a file. +# It is just a name for some commands to be executed when you +# make an explicit request. There are two reasons to use a +# phony target: to avoid a conflict with a file of the same +# name, and to improve performance. +.PHONY: all install download clean + +# executables to be built should be added here, they will be generated on the system under test. +BUILT_FILES= + +# data files, .c files, scripts anything needed to either compile the test and/or run it. +FILES=$(METADATA) runtest.sh Makefile PURPOSE test-core.sh + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh ./test-core.sh + +clean: + rm -f *~ *.rpm $(BUILT_FILES) + +# You may need to add other targets e.g. to build executables from source code +# Add them here: + + +# Include Common Makefile +include /usr/share/rhts/lib/rhts-make.include + +# Generate the testinfo.desc here: +$(METADATA): Makefile + @touch $(METADATA) +# Change to the test owner's name + @echo "Owner: Milos Malik " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "Description: utilities are tested if they support basic command line options" >> $(METADATA) + @echo "TestTime: 2m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) +# add any other packages for which your test ought to run here + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) +# add any other requirements for the script to run here + @echo "License: GPLv2" >> $(METADATA) + +# You may need other fields here; see the documentation + rhts-lint $(METADATA) diff --git a/tests/cmd-line-options/PURPOSE b/tests/cmd-line-options/PURPOSE new file mode 100644 index 0000000..cbf7099 --- /dev/null +++ b/tests/cmd-line-options/PURPOSE @@ -0,0 +1,5 @@ +Test Name: cmd-line-options +Author: Milos Malik +Location: /CoreOS/acl/Sanity/cmd-line-options +Short Description: Utilities are tested if they support basic command line options. +Safe: yes diff --git a/tests/cmd-line-options/runtest.sh b/tests/cmd-line-options/runtest.sh new file mode 100755 index 0000000..a852c11 --- /dev/null +++ b/tests/cmd-line-options/runtest.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material +# is made available to anyone wishing to use, modify, copy, or +# redistribute it subject to the terms and conditions of the GNU General +# Public License v.2. +# +# 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 for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Milos Malik + +rhts-run-simple-test $TEST ./test-core.sh diff --git a/tests/cmd-line-options/test-core.sh b/tests/cmd-line-options/test-core.sh new file mode 100755 index 0000000..92d8aed --- /dev/null +++ b/tests/cmd-line-options/test-core.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# Description: sanity test for acl package +# Author: Milos Malik + +##### Variable Declaration ##### +VERSION=1.0 + +# FAIL unless test explicitly passes +RESULT=FAIL + +# Each pass increases SCORE by 1 +SCORE=0 +TOTAL=8 + +# Set language so we know what results to test for +set_lang=0 +old_lang=$LANG +new_lang=en_US.UTF-8 + +# Which package and which utility do we test? +PACKAGE=acl + +##### Function Declaration ##### + +log () { + printf "\n:: $1 ::\n" +} + +check_exit_code () { + echo -e "\t* exit code: $1" + if [ $1 $2 $3 ] ; then + let "SCORE += 1" + fi +} + +##### Begin Test ##### + +log "[`date +%H:%M:%S`] Begin Test - $TEST-$VERSION" + +# Warn if not running as root that test might fail +e_user=$(whoami) +if [[ x"${e_user}" != x"root" ]]; then + log "Warning, not running as root! This test might fail." +fi + +# Temporarily set LANG to value we can trust results from +if [[ x"${LANG}" != x"${new_lang}" ]]; then + log "Warning, LANG not set to ${new_lang}!" + log "Temporarily setting LANG to ${new_lang}, was ${old_lang}" + + set_lang=1 + export LANG=${new_lang} + log "Done, LANG=${new_lang}." +fi + +log "getfacl -h" +getfacl -h >& /dev/null +check_exit_code $? -eq 0 + +log "getfacl --help" +getfacl --help >& /dev/null +check_exit_code $? -eq 0 + +log "getfacl -v" +getfacl -v >& /dev/null +check_exit_code $? -eq 0 + +log "getfacl --version" +getfacl --version >& /dev/null +check_exit_code $? -eq 0 + +log "setfacl -h" +setfacl -h >& /dev/null +check_exit_code $? -eq 0 + +log "setfacl --help" +setfacl --help >& /dev/null +check_exit_code $? -eq 0 + +log "setfacl -v" +setfacl -v >& /dev/null +check_exit_code $? -eq 0 + +log "setfacl --version" +setfacl --version >& /dev/null +check_exit_code $? -eq 0 + +# Reset LANG to original value +if [[ ${set_lang} == 1 ]]; then + log "Resetting LANG to ${old_lang}." + export LANG=${old_lang} + log "Done, LANG=${old_lang}." +fi + +log "[`date +%H:%M:%S`] End Test - $TEST-$VERSION" + +##### Report results ##### + +log "SCORE: ${SCORE}/${TOTAL}" + +if [ ${SCORE} -eq ${TOTAL} ] ; then +# everything was OK + log "RESULT: PASS" + printf "\n\n" + exit 0 +else +# something failed + log "RESULT: FAIL" + printf "\n\n" + exit 1 +fi + +##### End Test ##### diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..d6fb2ff --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,13 @@ +--- +# This first play always runs on the local staging system +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + - container + - atomic + tests: + - cmd-line-options + required_packages: + - which # which package required for cmd-line-options